ports/misc/py-cinder/files/patch-cinder_volume_drivers_nfs.py
Martin Wilke 070a6ba29d - Update to 12.0.4
- Added LICENSE_FILE
- Changed MASTER_SITES to official OpenStack repository
- Removed EXTRA_PATCHES (those patches have been rebased and were converted into
  mandatory patches)
- Enabled building for Python 3+ versions
- Sorted variables according to the PHB
- Changed RC scripts to work with different Python versions
- Added CONFLICTS_INSTALL
- Added OPTIONS for MySQL, PostgreSQL, memcached and MongoDB support
- changed post-patch target to prevent the installation to files into ${ETCDIR}
  by distutils and to replace occurences of /etc to ${PREFIX}/etc
- Changed post-install target to install the files into ${ETCDIR}
- Updated the shipped cinder.conf.sample
- Updated pkg-message

PR:		232245
Submitted by:	freebsd_ports@k-worx.org
Approved by:	maintainer
Sponsored by:	iXsystems Inc.
2019-01-29 14:05:58 +00:00

39 lines
1.8 KiB
Python

--- cinder/volume/drivers/nfs.py.orig 2018-06-18 13:37:33 UTC
+++ cinder/volume/drivers/nfs.py
@@ -182,10 +182,10 @@ class NfsDriver(remotefs.RemoteFSSnapDriverDistributed
self.shares = {} # address : options
- # Check if mount.nfs is installed on this system; note that we
+ # Check if mount_nfs is installed on this system; note that we
# need to be root, to also find mount.nfs on distributions, where
# it is not located in an unprivileged users PATH (e.g. /sbin).
- package = 'mount.nfs'
+ package = 'mount_nfs'
try:
self._execute(package, check_exit_code=False,
run_as_root=True)
@@ -342,16 +342,16 @@ class NfsDriver(remotefs.RemoteFSSnapDriverDistributed
"""
mount_point = self._get_mount_point_for_share(nfs_share)
- df, _ = self._execute('stat', '-f', '-c', '%S %b %a', mount_point,
+ df, _ = self._execute('df', '-k', mount_point,
run_as_root=self._execute_as_root)
- block_size, blocks_total, blocks_avail = map(float, df.split())
- total_available = block_size * blocks_avail
- total_size = block_size * blocks_total
+ df = df.splitlines()[1]
+ block_size = 1024
+ total_available = block_size * int(df.split()[3])
+ total_size = block_size * int(df.split()[1])
- du, _ = self._execute('du', '-sb', '--apparent-size', '--exclude',
- '*snapshot*', mount_point,
+ du, _ = self._execute('du', '-Aks', mount_point,
run_as_root=self._execute_as_root)
- total_allocated = float(du.split()[0])
+ total_allocated = float(du.split()[0]) * 1024
return total_size, total_available, total_allocated
def _get_mount_point_base(self):