|
|
|
@ -667,7 +667,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
|
|
|
|
|
poll_async = self.module.params.get('poll_async')
|
|
|
|
|
if poll_async:
|
|
|
|
|
instance = self._poll_job(instance, 'virtualmachine')
|
|
|
|
|
instance = self.poll_job(instance, 'virtualmachine')
|
|
|
|
|
return instance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -716,7 +716,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
|
|
|
|
|
# Ensure VM has stopped
|
|
|
|
|
instance = self.stop_instance()
|
|
|
|
|
instance = self._poll_job(instance, 'virtualmachine')
|
|
|
|
|
instance = self.poll_job(instance, 'virtualmachine')
|
|
|
|
|
self.instance = instance
|
|
|
|
|
|
|
|
|
|
# Change service offering
|
|
|
|
@ -743,7 +743,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
if 'errortext' in instance:
|
|
|
|
|
self.module.fail_json(msg="Failed: '%s'" % instance['errortext'])
|
|
|
|
|
|
|
|
|
|
instance = self._poll_job(instance, 'virtualmachine')
|
|
|
|
|
instance = self.poll_job(instance, 'virtualmachine')
|
|
|
|
|
self.instance = instance
|
|
|
|
|
|
|
|
|
|
# Start VM again if it was running before
|
|
|
|
@ -776,7 +776,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
|
|
|
|
|
poll_async = self.module.params.get('poll_async')
|
|
|
|
|
if poll_async:
|
|
|
|
|
instance = self._poll_job(res, 'virtualmachine')
|
|
|
|
|
instance = self.poll_job(res, 'virtualmachine')
|
|
|
|
|
return instance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -799,7 +799,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
|
|
|
|
|
poll_async = self.module.params.get('poll_async')
|
|
|
|
|
if poll_async:
|
|
|
|
|
res = self._poll_job(res, 'virtualmachine')
|
|
|
|
|
res = self.poll_job(res, 'virtualmachine')
|
|
|
|
|
return instance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -820,7 +820,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
|
|
|
|
|
poll_async = self.module.params.get('poll_async')
|
|
|
|
|
if poll_async:
|
|
|
|
|
instance = self._poll_job(instance, 'virtualmachine')
|
|
|
|
|
instance = self.poll_job(instance, 'virtualmachine')
|
|
|
|
|
return instance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -841,7 +841,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
|
|
|
|
|
poll_async = self.module.params.get('poll_async')
|
|
|
|
|
if poll_async:
|
|
|
|
|
instance = self._poll_job(instance, 'virtualmachine')
|
|
|
|
|
instance = self.poll_job(instance, 'virtualmachine')
|
|
|
|
|
return instance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -859,7 +859,7 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
|
|
|
|
|
poll_async = self.module.params.get('poll_async')
|
|
|
|
|
if poll_async:
|
|
|
|
|
instance = self._poll_job(instance, 'virtualmachine')
|
|
|
|
|
instance = self.poll_job(instance, 'virtualmachine')
|
|
|
|
|
|
|
|
|
|
elif instance['state'].lower() in [ 'stopping', 'stopped' ]:
|
|
|
|
|
instance = self.start_instance()
|
|
|
|
@ -875,16 +875,9 @@ class AnsibleCloudStackInstance(AnsibleCloudStack):
|
|
|
|
|
|
|
|
|
|
self.result['changed'] = True
|
|
|
|
|
|
|
|
|
|
args = {}
|
|
|
|
|
args['templateid'] = self.get_template_or_iso(key='id')
|
|
|
|
|
args['virtualmachineid'] = instance['id']
|
|
|
|
|
res = self.cs.restoreVirtualMachine(**args)
|
|
|
|
|
if 'errortext' in res:
|
|
|
|
|
self.module.fail_json(msg="Failed: '%s'" % res['errortext'])
|
|
|
|
|
|
|
|
|
|
poll_async = self.module.params.get('poll_async')
|
|
|
|
|
if poll_async:
|
|
|
|
|
instance = self._poll_job(res, 'virtualmachine')
|
|
|
|
|
poll_async = self.module.params.get('poll_async')
|
|
|
|
|
if poll_async:
|
|
|
|
|
instance = self.poll_job(res, 'virtualmachine')
|
|
|
|
|
return instance
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|