def post_present(self, entity_id): if self.param('storage'): sd, sd_service = self._get_storage_domain_service() if entity_id not in [ sd_conn.id for sd_conn in self._connection.follow_link( sd.storage_connections) ]: scs_service = sd_service.storage_connections_service() if not self._module.check_mode: scs_service.add(connection=otypes.StorageConnection( id=entity_id, ), ) self.changed = True
def build_entity(self): return otypes.StorageConnection( address=self.param('address'), path=self.param('path'), nfs_version=self.param('nfs_version'), nfs_timeo=self.param('nfs_timeout'), nfs_retrans=self.param('nfs_retrans'), mount_options=self.param('mount_options'), password=self.param('password'), username=self.param('username'), port=self.param('port'), target=self.param('target'), type=otypes.StorageType(self.param('type')) if self.param('type') is not None else None, vfs_type=self.param('vfs_type'), )
def post_present(self, entity_id): if self.param('storage'): sds_service = self._connection.system_service( ).storage_domains_service() sd = search_by_name(sds_service, self.param('storage')) if sd is None: raise Exception("Storage '%s' was not found." % self.param('storage')) if entity_id not in [ sd_conn.id for sd_conn in self._connection.follow_link( sd.storage_connections) ]: scs_service = sds_service.storage_domain_service( sd.id).storage_connections_service() if not self._module.check_mode: scs_service.add(connection=otypes.StorageConnection( id=entity_id, ), ) self.changed = True