libvirt: introduce freeze filesystems

Adds method to freeze in Guest's object which replace direct call to
libvirt.

Implements: blueprint libvirt-clean-driver
Change-Id: Ia530b1072c5af21dc114be627af90a39e38fa01b
This commit is contained in:
Sahid Orentino Ferdjaoui 2015-11-24 05:52:52 -05:00
parent 49a2ac4232
commit 6ce70203dd
4 changed files with 12 additions and 1 deletions

View File

@ -773,6 +773,9 @@ class Domain(object):
def abortJob(self):
pass
def fsFreeze(self):
pass
class DomainSnapshot(object):
def __init__(self, name, domain):

View File

@ -369,6 +369,10 @@ class GuestTestCase(test.NoDBTestCase):
with mock.patch.object(self.domain, "isActive", return_value=False):
self.assertFalse(self.guest.is_active())
def test_freeze_filesystems(self):
self.guest.freeze_filesystems()
self.domain.fsFreeze.assert_called_once_with()
class GuestBlockTestCase(test.NoDBTestCase):

View File

@ -1520,7 +1520,7 @@ class LibvirtDriver(driver.ComputeDriver):
# We should be able to remove domain at the end.
domain = guest._domain
if quiesced:
domain.fsFreeze()
guest.freeze_filesystems()
else:
domain.fsThaw()
except libvirt.libvirtError as ex:

View File

@ -369,6 +369,10 @@ class Guest(object):
"Determines whether guest is currently running."
return self._domain.isActive()
def freeze_filesystems(self):
"""Freeze filesystems within guest."""
self._domain.fsFreeze()
class BlockDevice(object):
"""Wrapper around block device API"""