diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-05-16 19:17:01 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-05-16 19:17:01 +0000 |
| commit | c5f9d86a3c8d6f831458435af080a0e49bbfd1d6 (patch) | |
| tree | d311eee3be2d5be86cabece003a313fc20c7d9ba | |
| parent | 01f968e6c440c1eae0069639571a9a8c07cf229f (diff) | |
| parent | 0624b7aab0c0fe4869111ad8e302151548d6ba20 (diff) | |
| download | nova-c5f9d86a3c8d6f831458435af080a0e49bbfd1d6.tar.gz nova-c5f9d86a3c8d6f831458435af080a0e49bbfd1d6.tar.xz nova-c5f9d86a3c8d6f831458435af080a0e49bbfd1d6.zip | |
Merge "handle updated qemu-img info output"
| -rw-r--r-- | nova/virt/libvirt/utils.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py index 948b6dfb8..9f63c13c1 100644 --- a/nova/virt/libvirt/utils.py +++ b/nova/virt/libvirt/utils.py @@ -110,10 +110,18 @@ def get_disk_backing_file(path): :returns: a path to the image's backing store """ out, err = execute('qemu-img', 'info', path) - backing_file = [i.split('actual path:')[1].strip()[:-1] - for i in out.split('\n') if 0 <= i.find('backing file')] + backing_file = None + + for line in out.split('\n'): + if line.startswith('backing file: '): + if 'actual path: ' in line: + backing_file = line.split('actual path: ')[1][:-1] + else: + backing_file = line.split('backing file: ')[1] + break if backing_file: - backing_file = os.path.basename(backing_file[0]) + backing_file = os.path.basename(backing_file) + return backing_file |
