mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
cs_snapshot_policy: fix VM not found in non-default zone
This commit is contained in:
parent
d6e1f02990
commit
4dc3874176
2 changed files with 3 additions and 3 deletions
|
@ -406,7 +406,7 @@ class AnsibleCloudStack(object):
|
||||||
return self.vm_default_nic
|
return self.vm_default_nic
|
||||||
self.fail_json(msg="No default IP address of VM '%s' found" % self.module.params.get('vm'))
|
self.fail_json(msg="No default IP address of VM '%s' found" % self.module.params.get('vm'))
|
||||||
|
|
||||||
def get_vm(self, key=None):
|
def get_vm(self, key=None, filter_zone=True):
|
||||||
if self.vm:
|
if self.vm:
|
||||||
return self._get_by_key(key, self.vm)
|
return self._get_by_key(key, self.vm)
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ class AnsibleCloudStack(object):
|
||||||
'account': self.get_account(key='name'),
|
'account': self.get_account(key='name'),
|
||||||
'domainid': self.get_domain(key='id'),
|
'domainid': self.get_domain(key='id'),
|
||||||
'projectid': self.get_project(key='id'),
|
'projectid': self.get_project(key='id'),
|
||||||
'zoneid': self.get_zone(key='id'),
|
'zoneid': self.get_zone(key='id') if filter_zone else None,
|
||||||
}
|
}
|
||||||
vms = self.query_api('listVirtualMachines', **args)
|
vms = self.query_api('listVirtualMachines', **args)
|
||||||
if vms:
|
if vms:
|
||||||
|
|
|
@ -222,7 +222,7 @@ class AnsibleCloudStackSnapshotPolicy(AnsibleCloudStack):
|
||||||
'account': self.get_account(key='name'),
|
'account': self.get_account(key='name'),
|
||||||
'domainid': self.get_domain(key='id'),
|
'domainid': self.get_domain(key='id'),
|
||||||
'projectid': self.get_project(key='id'),
|
'projectid': self.get_project(key='id'),
|
||||||
'virtualmachineid': self.get_vm(key='id'),
|
'virtualmachineid': self.get_vm(key='id', filter_zone=False),
|
||||||
'type': self.module.params.get('volume_type'),
|
'type': self.module.params.get('volume_type'),
|
||||||
}
|
}
|
||||||
volumes = self.query_api('listVolumes', **args)
|
volumes = self.query_api('listVolumes', **args)
|
||||||
|
|
Loading…
Reference in a new issue