Francesco Romani has uploaded a new change for review.

Change subject: WIP: RFC: kill Vm.isDomainReadyForCommands()
......................................................................

WIP: RFC: kill Vm.isDomainReadyForCommands()

No longer needed after the switch to explicit
resource tracker.

WARNING: this patch is not yet ready for review,
let alone merging. It is a proof of concept and
live demo.

Change-Id: I63742187e5b971264c2cbeb5e327536fb7166a7a
Signed-off-by: Francesco Romani <[email protected]>
---
M tests/vmTests.py
M vdsm/virt/vm.py
2 files changed, 0 insertions(+), 57 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/44545/4

diff --git a/tests/vmTests.py b/tests/vmTests.py
index 30c7473..71562d7 100644
--- a/tests/vmTests.py
+++ b/tests/vmTests.py
@@ -1071,40 +1071,6 @@
             testvm._dom = fake.Domain(domState=libvirt.VIR_DOMAIN_RUNNING)
             self.assertTrue(testvm._isDomainRunning())
 
-    def testDomainIsReadyForCommands(self):
-        with fake.VM() as testvm:
-            testvm._dom = fake.Domain()
-            self.assertTrue(testvm.isDomainReadyForCommands())
-
-    def testDomainDisappearedNotReadyForCommands(self):
-        def _fail(*args):
-            raise_libvirt_error(libvirt.VIR_ERR_NO_DOMAIN,
-                                "Disappeared domain")
-
-        with fake.VM() as testvm:
-            dom = fake.Domain()
-            dom.controlInfo = _fail
-            testvm._dom = dom
-            self.assertFalse(testvm.isDomainReadyForCommands())
-
-    def testDomainNoneNotReadyForCommands(self):
-        with fake.VM() as testvm:
-            testvm._dom = None
-            self.assertFalse(testvm.isDomainReadyForCommands())
-
-    def testReadyForCommandsRaisesLibvirtError(self):
-        def _fail(*args):
-            # anything != NO_DOMAIN is good
-            raise_libvirt_error(libvirt.VIR_ERR_INTERNAL_ERROR,
-                                "Fake internal error")
-
-        with fake.VM() as testvm:
-            dom = fake.Domain()
-            dom.controlInfo = _fail
-            testvm._dom = dom
-            self.assertRaises(libvirt.libvirtError,
-                              testvm.isDomainReadyForCommands)
-
     def testReadPauseCodeDomainRunning(self):
         with fake.VM() as testvm:
             testvm._dom = fake.Domain(domState=libvirt.VIR_DOMAIN_RUNNING)
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 20b3830..6ff18d3 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -2680,29 +2680,6 @@
 
         return 'NOERR'
 
-    def isDomainReadyForCommands(self):
-        """
-        Returns True if the domain is reported to be in the safest condition
-        to accept commands.
-        False negative (domain is reported NOT ready, but it is) is possible
-        False positive (domain is reported ready, but it is NOT) is avoided
-        """
-        try:
-            state, details, stateTime = self._dom.controlInfo()
-        except AttributeError:
-            # this method may be called asynchronously by periodic
-            # operations. Thus, we must use a try/except block
-            # to avoid racy checks.
-            return False
-        except libvirt.libvirtError as e:
-            if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
-                # same as AttributeError above: possible race on shutdown
-                return False
-            else:
-                raise
-        else:
-            return state == libvirt.VIR_DOMAIN_CONTROL_OK
-
     def _timeoutExperienced(self, timeout):
         if timeout:
             self._monitorResponse = -1


-- 
To view, visit https://gerrit.ovirt.org/44545
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63742187e5b971264c2cbeb5e327536fb7166a7a
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <[email protected]>
Gerrit-Reviewer: [email protected]
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to