summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-05-29 00:42:38 +0000
committerGerrit Code Review <review@openstack.org>2013-05-29 00:42:38 +0000
commitc246c053fb341984e81d6df573675caf84faa759 (patch)
treed0a7bc9d2db45d74c2c0ceebb8fc64cc49521801
parent6d99004ab93df2e5afce82f313a2e9c9a3768ff1 (diff)
parentdc48d3d14978ebb9afe6d1371b2af988107b7f5d (diff)
Merge "Remove path_exists from NFS/GlusterFS drivers"
-rw-r--r--nova/tests/virt/libvirt/test_libvirt_volume.py4
-rw-r--r--nova/virt/libvirt/volume.py22
2 files changed, 4 insertions, 22 deletions
diff --git a/nova/tests/virt/libvirt/test_libvirt_volume.py b/nova/tests/virt/libvirt/test_libvirt_volume.py
index 86773dd10..59e7d7fea 100644
--- a/nova/tests/virt/libvirt/test_libvirt_volume.py
+++ b/nova/tests/virt/libvirt/test_libvirt_volume.py
@@ -444,7 +444,7 @@ class LibvirtVolumeTestCase(test.TestCase):
libvirt_driver.disconnect_volume(connection_info, "vde")
expected_commands = [
- ('stat', export_mnt_base),
+ ('mkdir', '-p', export_mnt_base),
('mount', '-t', 'nfs', export_string, export_mnt_base)]
self.assertEqual(self.executes, expected_commands)
@@ -500,7 +500,7 @@ class LibvirtVolumeTestCase(test.TestCase):
libvirt_driver.disconnect_volume(connection_info, "vde")
expected_commands = [
- ('stat', export_mnt_base),
+ ('mkdir', '-p', export_mnt_base),
('mount', '-t', 'glusterfs', export_string, export_mnt_base)]
self.assertEqual(self.executes, expected_commands)
diff --git a/nova/virt/libvirt/volume.py b/nova/virt/libvirt/volume.py
index 317d398d6..859e5ecea 100644
--- a/nova/virt/libvirt/volume.py
+++ b/nova/virt/libvirt/volume.py
@@ -493,8 +493,7 @@ class LibvirtNFSVolumeDriver(LibvirtBaseVolumeDriver):
def _mount_nfs(self, mount_path, nfs_share, ensure=False):
"""Mount nfs export to mount path."""
- if not self._path_exists(mount_path):
- utils.execute('mkdir', '-p', mount_path)
+ utils.execute('mkdir', '-p', mount_path)
# Construct the NFS mount command.
nfs_cmd = ['mount', '-t', 'nfs']
@@ -515,14 +514,6 @@ class LibvirtNFSVolumeDriver(LibvirtBaseVolumeDriver):
"""returns string that represents hash of base_str (in hex format)."""
return hashlib.md5(base_str).hexdigest()
- @staticmethod
- def _path_exists(path):
- """Check path."""
- try:
- return utils.execute('stat', path, run_as_root=True)
- except processutils.ProcessExecutionError:
- return False
-
class LibvirtAOEVolumeDriver(LibvirtBaseVolumeDriver):
"""Driver to attach AoE volumes to libvirt."""
@@ -620,8 +611,7 @@ class LibvirtGlusterfsVolumeDriver(LibvirtBaseVolumeDriver):
def _mount_glusterfs(self, mount_path, glusterfs_share, ensure=False):
"""Mount glusterfs export to mount path."""
- if not self._path_exists(mount_path):
- utils.execute('mkdir', '-p', mount_path)
+ utils.execute('mkdir', '-p', mount_path)
try:
utils.execute('mount', '-t', 'glusterfs', glusterfs_share,
@@ -638,14 +628,6 @@ class LibvirtGlusterfsVolumeDriver(LibvirtBaseVolumeDriver):
"""returns string that represents hash of base_str (in hex format)."""
return hashlib.md5(base_str).hexdigest()
- @staticmethod
- def _path_exists(path):
- """Check path."""
- try:
- return utils.execute('stat', path, run_as_root=True)
- except processutils.ProcessExecutionError:
- return False
-
class LibvirtFibreChannelVolumeDriver(LibvirtBaseVolumeDriver):
"""Driver to attach Fibre Channel Network volumes to libvirt."""