[PATCH] bug fix: remove the hard code of disk_path

From: ShaoHe Feng <shaohef@linux.vnet.ibm.com> Usually the path of default pool is under /var/lib/libvirt/images/ But that not means it always is. So remove this hard code. Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- tests/test_model.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_model.py b/tests/test_model.py index d661247..75cfc45 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -241,7 +241,8 @@ class ModelTests(unittest.TestCase): rollback.prependDefer(inst.vm_delete, 'test-vm-1') vm_info = inst.vm_lookup(params['name']) - disk_path = '/var/lib/libvirt/images/%s-0.img' % vm_info['uuid'] + disk_path = '%s/%s-0.img' % ( + inst.storagepool_lookup('default')['path'], vm_info['uuid']) self.assertTrue(os.access(disk_path, os.F_OK)) self.assertFalse(os.access(disk_path, os.F_OK)) -- 1.8.4.2

Reviewed-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com> But maybe you should pay more attention to the commit message grammar ;-) on 2014/03/11 14:34, shaohef@linux.vnet.ibm.com wrote:
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Usually the path of default pool is under /var/lib/libvirt/images/ But that not means it always is.
So remove this hard code.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- tests/test_model.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/test_model.py b/tests/test_model.py index d661247..75cfc45 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -241,7 +241,8 @@ class ModelTests(unittest.TestCase): rollback.prependDefer(inst.vm_delete, 'test-vm-1')
vm_info = inst.vm_lookup(params['name']) - disk_path = '/var/lib/libvirt/images/%s-0.img' % vm_info['uuid'] + disk_path = '%s/%s-0.img' % ( + inst.storagepool_lookup('default')['path'], vm_info['uuid']) self.assertTrue(os.access(disk_path, os.F_OK)) self.assertFalse(os.access(disk_path, os.F_OK))
-- Thanks and best regards! Zhou Zheng Sheng / 周征晟 E-mail: zhshzhou@linux.vnet.ibm.com Telephone: 86-10-82454397

Reviewed-by: Shu Ming <shuming@linux.vnet.ibm.com> 2014/3/11 14:34, shaohef@linux.vnet.ibm.com :
From: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Usually the path of default pool is under /var/lib/libvirt/images/ But that not means it always is.
So remove this hard code.
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com> --- tests/test_model.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/test_model.py b/tests/test_model.py index d661247..75cfc45 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -241,7 +241,8 @@ class ModelTests(unittest.TestCase): rollback.prependDefer(inst.vm_delete, 'test-vm-1')
vm_info = inst.vm_lookup(params['name']) - disk_path = '/var/lib/libvirt/images/%s-0.img' % vm_info['uuid'] + disk_path = '%s/%s-0.img' % ( + inst.storagepool_lookup('default')['path'], vm_info['uuid']) self.assertTrue(os.access(disk_path, os.F_OK)) self.assertFalse(os.access(disk_path, os.F_OK))
participants (5)
-
Aline Manera
-
Ramon Medeiros
-
shaohef@linux.vnet.ibm.com
-
Shu Ming
-
Zhou Zheng Sheng