0001-JiraId-CLOUDSTACK-6282.patch Added automated tests for Instances API calls to test_escalations.py file and added utility functions to base.py file

This commit is contained in:
unknown 2014-04-18 15:32:17 +05:30 committed by SrikanteswaraRao Talluri
parent f57f22a79e
commit 2e95b5b707
2 changed files with 4063 additions and 6 deletions

File diff suppressed because it is too large Load Diff

View File

@ -463,10 +463,12 @@ class VirtualMachine:
cmd.id = self.id
apiclient.startVirtualMachine(cmd)
def stop(self, apiclient):
def stop(self, apiclient, forced=None):
"""Stop the instance"""
cmd = stopVirtualMachine.stopVirtualMachineCmd()
cmd.id = self.id
if forced:
cmd.forced = forced
apiclient.stopVirtualMachine(cmd)
def reboot(self, apiclient):
@ -597,8 +599,15 @@ class VirtualMachine:
def detach_iso(self, apiclient):
"""Detach ISO to instance"""
cmd = detachIso.detachIsoCmd()
cmd.id = self.id
cmd.virtualmachineid = self.id
return apiclient.detachIso(cmd)
def scale_virtualmachine(self, apiclient, serviceOfferingId):
""" Scale up of service offering for the Instance"""
cmd = scaleVirtualMachine.scaleVirtualMachineCmd()
cmd.id = self.id
cmd.serviceofferingid = serviceOfferingId
return apiclient.scaleVirtualMachine(cmd)
def change_service_offering(self, apiclient, serviceOfferingId):
"""Change service offering of the instance"""
@ -3392,6 +3401,14 @@ class SSHKeyPair:
cmd.projectid = projectid
return (apiclient.createSSHKeyPair(cmd))
@classmethod
def register(cls, apiclient, name, publickey):
"""Registers SSH keypair"""
cmd = registerSSHKeyPair.registerSSHKeyPairCmd()
cmd.name = name
cmd.publickey = publickey
return (apiclient.registerSSHKeyPair(cmd))
def delete(self, apiclient):
"""Delete SSH key pair"""
cmd = deleteSSHKeyPair.deleteSSHKeyPairCmd()