8000 Ovirt add managed storage domain by mnecas · Pull Request #57995 · ansible/ansible · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Ovirt add managed storage domain #57995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 18, 2019
55 changes: 52 additions & 3 deletions lib/ansible/modules/cloud/ovirt/ovirt_storage_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@
mount_options:
description:
- Option which wil 10000 l be passed when mounting storage.
managed_block_storage:
description:
- "Dictionary with values for managed block storage type"
- "Note: available from ovirt 4.3"
suboptions:
driver_options:
description:
- "The options to be passed when creating a storage domain using a cinder driver."
- "List of dictionary containing C(name) and C(value) of driver option"
driver_sensitive_options:
description:
- "Parameters containing sensitive information, to be passed when creating a storage domain using a cinder driver."
- "List of dictionary containing C(name) and C(value) of driver sensitive option"
version_added: "2.9"
fcp:
description:
- "Dictionary with values for fibre channel storage type:"
Expand Down Expand Up @@ -325,6 +339,26 @@
address: 10.34.63.199
path: /path/iso

# Create managed storage domain
# Available from ovirt 4.3 and ansible 2.9
- ovirt_storage_domain:
name: my_managed_domain
host: myhost
data_center: mydatacenter
managed_block_storage:
driver_options:
- name: rbd_pool
value: pool1
- name: rbd_user
value: admin
- name: volume_driver
value: cinder.volume.drivers.rbd.RBDDriver
- name: rbd_keyring_conf
value: /etc/ceph/keyring
driver_sensitive_options:
- name: secret_password
value: password

# Remove storage domain
- ovirt_storage_domain:
state: absent
Expand Down Expand Up @@ -375,12 +409,12 @@
class StorageDomainModule(BaseModule):

def _get_storage_type(self):
for sd_type in ['nfs', 'iscsi', 'posixfs', 'glusterfs', 'fcp', 'localfs']:
for sd_type in ['nfs', 'iscsi', 'posixfs', 'glusterfs', 'fcp', 'localfs', 'managed_block_storage']:
if self.param(sd_type) is not None:
return sd_type

def _get_storage(self):
for sd_type in ['nfs', 'iscsi', 'posixfs', 'glusterfs', 'fcp', 'localfs']:
for sd_type in ['nfs', 'iscsi', 'posixfs', 'glusterfs', 'fcp', 'localfs', 'managed_block_storage']:
if self.param(sd_type) is not None:
return self.param(sd_type)

Expand Down Expand Up @@ -433,10 +467,22 @@ def build_entity(self):
warning_low_space_indicator=self.param('warning_low_space'),
import_=True if self.param('state') == 'imported' else None,
id=self.param('id') if self.param('state') == 'imported' else None,
type=otypes.StorageDomainType(self.param('domain_function')),
type=otypes.StorageDomainType(storage_type if storage_type == 'managed_block_storage' else self.param('domain_function')),
host=otypes.Host(name=self.param('host')),
discard_after_delete=self.param('discard_after_delete'),
storage=otypes.HostStorage(
driver_options=[
otypes.Property(
name=do.get('name'),
value=do.get('value')
) for do in storage.get('driver_options')
] if storage.get('driver_options') else None,
driver_sensitive_options=[
otypes.Property(
name=dso.get('name'),
value=dso.get('value')
) for dso in storage.get('driver_sensitive_options')
] if storage.get('driver_sensitive_options') else None,
type=otypes.StorageType(storage_type),
logical_units=[
otypes.LogicalUnit(
Expand Down Expand Up @@ -671,6 +717,9 @@ def main():
localfs=dict(default=None, type='dict'),
nfs=dict(default=None, type='dict'),
iscsi=dict(default=None, type='dict'),
managed_block_storage=dict(default=None, type='dict', options=dict(
driver_options=dict(type='list'),
driver_sensitive_options=dict(type='list', no_log=True))),
posixfs=dict(default=None, type='dict'),
glusterfs=dict(default=None, type='dict'),
fcp=dict(default=None, type='dict'),
Expand Down
0