Change in vdsm[master]: vm: do not use _dom for powerdown

fromani at redhat.com fromani at redhat.com
Mon Aug 11 15:48:36 UTC 2014


Francesco Romani has uploaded a new change for review.

Change subject: vm: do not use _dom for powerdown
......................................................................

vm: do not use _dom for powerdown

We must avoid the proliferation of trivial helper methods, but
using private VM fields across modules is a greater evil, even
if modules are part of the same package and affine, like vm.py and
vmpowerdown.py

To avoid that, a new simple method is added to request clean
shutdown of a VM through ACPI events.

Change-Id: Ia99a8a557b9bbbaf693eb0e89aa9f39c0ecce400
Signed-off-by: Francesco Romani <fromani at redhat.com>
---
M vdsm/virt/vm.py
M vdsm/virt/vmpowerdown.py
2 files changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/31353/1

diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 9e93425..a485cd9 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -4615,6 +4615,9 @@
 
         return self.releaseVm()
 
+    def acpiShutdown(self):
+        self._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)
+
     def setBalloonTarget(self, target):
 
         if self._dom is None:
diff --git a/vdsm/virt/vmpowerdown.py b/vdsm/virt/vmpowerdown.py
index 890c8be..3bdb6bf 100644
--- a/vdsm/virt/vmpowerdown.py
+++ b/vdsm/virt/vmpowerdown.py
@@ -88,7 +88,7 @@
         return self.event.wait(self.delay + self.timeout)
 
     def acpiCallback(self):
-        self.vm._dom.shutdownFlags(libvirt.VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN)
+        self.vm.acpiShutdown()
         return self.event.wait(self.timeout)
 
     def forceCallback(self):


-- 
To view, visit http://gerrit.ovirt.org/31353
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia99a8a557b9bbbaf693eb0e89aa9f39c0ecce400
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>


More information about the vdsm-patches mailing list