From b5d127fb5158ce739d4bfe0134dee73d992b39d1 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Thu, 8 Mar 2012 16:26:13 -0800 Subject: [PATCH] Make snapshots with qemu-img instead of libvirt * snapshot is only supposed to snapshot the root drive, whereas libvirt snapshots snapshot the memory and all attached disks * removes silly qemu_img flag * fixes bug 946830 Change-Id: I6afc9dbaa855f06864cd5a37f89ad63555e35d23 --- nova/rootwrap/compute.py | 4 ++++ nova/tests/fake_libvirt_utils.py | 8 ++++++++ nova/tests/test_libvirt.py | 10 ++++++++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/nova/rootwrap/compute.py b/nova/rootwrap/compute.py index 31c0ad91..9985edb3 100755 --- a/nova/rootwrap/compute.py +++ b/nova/rootwrap/compute.py @@ -179,6 +179,10 @@ filterlist = [ # nova/virt/xenapi/vm_utils.py: 'mkfs' filters.CommandFilter("/sbin/mkfs", "root"), + # nova/virt/libvirt/utils.py: 'qemu-img' + filters.CommandFilter("/usr/bin/qemu-img", "root"), + # nova/virt/libvirt/connection.py: filters.ReadFileFilter("/etc/iscsi/initiatorname.iscsi"), + ] diff --git a/nova/tests/fake_libvirt_utils.py b/nova/tests/fake_libvirt_utils.py index 726e28a1..bdd24e4b 100644 --- a/nova/tests/fake_libvirt_utils.py +++ b/nova/tests/fake_libvirt_utils.py @@ -61,6 +61,14 @@ def chown(path, owner): pass +def create_snapshot(disk_path, snapshot_name): + pass + + +def delete_snapshot(disk_path, snapshot_name): + pass + + def extract_snapshot(disk_path, source_fmt, snapshot_name, out_path, dest_fmt): files[out_path] = '' diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index d8a44eec..2de87f2d 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -96,8 +96,14 @@ class FakeVirtDomain(object): def name(self): return "fake-domain %s" % self - def snapshotCreateXML(self, *args): - return FakeVirDomainSnapshot(self) + def info(self): + return [power_state.RUNNING, None, None, None, None] + + def create(self): + pass + + def managedSave(self, *args): + pass def createWithFlags(self, launch_flags): pass