From 824428e0f2a3f4e33c84474145ba24305d6a5d98 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Fri, 16 Sep 2011 09:40:24 -0400 Subject: [PATCH] Add a FakeVirDomainSnapshot and return it from snapshotCreateXML. Fixes libvirt snapshot tests. --- nova/tests/test_libvirt.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index b7c1ef1a..1924ae05 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -52,6 +52,15 @@ def _concurrency(wait, done, target): done.send() +class FakeVirDomainSnapshot(object): + + def __init__(self, dom=None): + self.dom = dom + + def delete(self, flags): + pass + + class FakeVirtDomain(object): def __init__(self, fake_xml=None): @@ -69,7 +78,7 @@ class FakeVirtDomain(object): """ def snapshotCreateXML(self, *args): - return None + return FakeVirDomainSnapshot(self) def createWithFlags(self, launch_flags): pass