[oVirt] Update/Add functionalities for import storage domain (#26568)

* ovirt_templates: Update the argument spec of templates.

Add id of template since it is needed for register.

* ovirt_vms: Register unregistered VM.

Use register of VM with id instead of name since an
unregitered entity can be registered also without name attribute.

* ovirt_hosts: Add iscsidiscover to ovirt_hosts

Adding functionality of iscsidiscover to be used to discover iscsi
targets.

* ovirt_storage_domains: Add support for import block storage domain.

* Add functionality of partial import to unregistered VMs.

* Add functionality of partial import to unregistered Templates.

* ovirt_hosts: Add iscsilogin to ovirt hosts.

Add functionality of iscsi login to ovirt hosts to be used to connect to
iscsi targets and to be able to import iSCSI storage domain eventually.

* Add ovirt_storage_templates_facts

Adding fact module for storage templates.
The module should help with registering unregistered templates.

* Add ovirt_storage_vms_facts

Adding fact module for storage VMs.
The module should help with registering unregistered VMs.
This commit is contained in:
maorlipchuk
2017-08-23 15:44:02 +03:00
committed by Ryan Brown
parent 2f3d9566f9
commit 07feec30d3
7 changed files with 458 additions and 40 deletions

View File

@@ -746,6 +746,17 @@ class BaseModule(object):
'diff': self._diff,
}
def wait_for_import(self):
if self._module.params['wait']:
start = time.time()
timeout = self._module.params['timeout']
poll_interval = self._module.params['poll_interval']
while time.time() < start + timeout:
entity = self.search_entity()
if entity:
return entity
time.sleep(poll_interval)
def search_entity(self, search_params=None):
"""
Always first try to search by `ID`, if ID isn't specified,
@@ -755,10 +766,10 @@ class BaseModule(object):
entity = None
if 'id' in self._module.params and self._module.params['id'] is not None:
entity = search_by_attributes(self._service, id=self._module.params['id'])
entity = get_entity(self._service.service(self._module.params['id']))
elif search_params is not None:
entity = search_by_attributes(self._service, **search_params)
elif 'name' in self._module.params and self._module.params['name'] is not None:
elif self._module.params.get('name') is not None:
entity = search_by_attributes(self._service, name=self._module.params['name'])
return entity