Revert "CLOUDSTACK-6257: Adding function to check state of VM" This reverts commit 1be8b87fb7fb0203464ac4c66596008855ac5041.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d81c5c44 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d81c5c44 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d81c5c44 Branch: refs/heads/4.4-forward Commit: d81c5c44f112df8c0e4388e9d88300b24eefe3d0 Parents: 6581680 Author: Girish Shilamkar <gir...@clogeny.com> Authored: Mon May 5 11:23:27 2014 +0530 Committer: Girish Shilamkar <gir...@clogeny.com> Committed: Mon May 5 11:23:27 2014 +0530 ---------------------------------------------------------------------- tools/marvin/marvin/codes.py | 5 --- tools/marvin/marvin/integration/lib/base.py | 46 ------------------------ 2 files changed, 51 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d81c5c44/tools/marvin/marvin/codes.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/codes.py b/tools/marvin/marvin/codes.py index cb268e2..92d6cf9 100644 --- a/tools/marvin/marvin/codes.py +++ b/tools/marvin/marvin/codes.py @@ -31,11 +31,6 @@ """ RUNNING = "Running" -STOPPED = "Stopped" -STOPPING = "Stopping" -STARTING = "Starting" -DESTROYED = "Destroyed" -EXPUNGING = "Expunging" RECURRING = "RECURRING" ENABLED = "Enabled" NETWORK_OFFERING = "network_offering" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d81c5c44/tools/marvin/marvin/integration/lib/base.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py index 17616a6..c23ea8a 100755 --- a/tools/marvin/marvin/integration/lib/base.py +++ b/tools/marvin/marvin/integration/lib/base.py @@ -22,11 +22,6 @@ import marvin from utils import is_server_ssh_ready, random_gen from marvin.cloudstackAPI import * -from marvin.codes import (FAILED, FAIL, PASS, RUNNING, STOPPED, - STARTING, DESTROYED, EXPUNGING, - STOPPING) -from marvin.cloudstackException import GetDetailExceptionInfo -from marvin.lib.utils import validateList # Import System modules import time import hashlib @@ -224,16 +219,6 @@ class User: class VirtualMachine: """Manage virtual machine lifecycle""" - '''Class level variables''' - # Variables denoting VM state - start - STOPPED = STOPPED - RUNNING = RUNNING - DESTROYED = DESTROYED - EXPUNGING = EXPUNGING - STOPPING = STOPPING - STARTING = STARTING - # Varibles denoting VM state - end - def __init__(self, items, services): self.__dict__.update(items) if "username" in services: @@ -481,10 +466,6 @@ class VirtualMachine: cmd = stopVirtualMachine.stopVirtualMachineCmd() cmd.id = self.id apiclient.stopVirtualMachine(cmd) - response = self.getState(apiclient, VirtualMachine.STOPPED) - if response[0] == FAIL: - raise Exception(response[1]) - return def reboot(self, apiclient): """Reboot the instance""" @@ -536,33 +517,6 @@ class VirtualMachine: ) return self.ssh_client - def getState(self, apiclient, state, timeout=600): - """List VM and check if its state is as expected - @returnValue - List[Result, Reason] - 1) Result - FAIL if there is any exception - in the operation or VM state does not change - to expected state in given time else PASS - 2) Reason - Reason for failure""" - - returnValue = [FAIL, "VM state not trasited to %s,\ - operation timed out" % state] - - while timeout>0: - try: - vms = VirtualMachine.list(apiclient, id=self.id, listAll=True) - validationresult = validateList(vms) - if validationresult[0] == FAIL: - raise Exception("VM list validation failed: %s" % validationresult[2]) - elif str(vms[0].state).lower() == str(state).lower(): - returnValue = [PASS, None] - break - except Exception as e: - returnValue = [FAIL, e] - break - time.sleep(60) - timeout -= 60 - return returnValue - def resetSshKey(self, apiclient, **kwargs): """Resets SSH key"""