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:
parent
49a2ac4232
commit
6ce70203dd
|
@ -773,6 +773,9 @@ class Domain(object):
|
|||
def abortJob(self):
|
||||
pass
|
||||
|
||||
def fsFreeze(self):
|
||||
pass
|
||||
|
||||
|
||||
class DomainSnapshot(object):
|
||||
def __init__(self, name, domain):
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"""
|
||||
|
|
Loading…
Reference in New Issue