MCPcopy Create free account
hub / github.com/apache/cloudstack / _check_resource_state

Method _check_resource_state

tools/marvin/marvin/lib/base.py:3366–3383  ·  view source on GitHub ↗
(apiclient, hostid, resourcestate)

Source from the content-addressed store, hash-verified

3364
3365 @staticmethod
3366 def _check_resource_state(apiclient, hostid, resourcestate):
3367 hosts = Host.list(apiclient, id=hostid, listall=True)
3368
3369 validationresult = validateList(hosts)
3370
3371 assert validationresult is not None, "'validationresult' should not be equal to 'None'."
3372
3373 assert isinstance(validationresult, list), "'validationresult' should be a 'list'."
3374
3375 assert len(validationresult) == 3, "'validationresult' should be a list with three items in it."
3376
3377 if validationresult[0] == FAIL:
3378 raise Exception("Host list validation failed: %s" % validationresult[2])
3379
3380 if str(hosts[0].resourcestate).lower() == str(resourcestate).lower():
3381 return True, None
3382
3383 return False, "Host is not in the following state: " + str(resourcestate)
3384
3385 def delete(self, apiclient):
3386 """Delete Host"""

Callers

nothing calls this directly

Implementers 1

HostVOengine/schema/src/main/java/com/cloud/

Calls 2

validateListFunction · 0.90
listMethod · 0.65

Tested by

no test coverage detected