def cirros_template(system, ovirt_image_repo, default_cluster, default_storage_domain): ovirt_image_sd = storagelib.StorageDomain(system) ovirt_image_sd.import_by_name(providers.OVIRT_IMAGE_REPO_NAME) default_storage_domain.import_image(default_cluster, ovirt_image_sd, CIRROS_IMAGE_NAME, template_name=CIRROS_TEMPLATE_NAME) templatelib.wait_for_template_ok_status(system, CIRROS_TEMPLATE_NAME) return CIRROS_TEMPLATE_NAME
def ipv6_nfs_storage_domain(system, host, engine_storage_ipv6): DOMAIN_NAME = 'nfs-ipv6' DEFAULT_DOMAIN_PATH = '/exports/nfs/share2' sd = storagelib.StorageDomain(system) host_storage_data = storagelib.HostStorageData( storage_type=storagelib.StorageType.NFS, address='[' + engine_storage_ipv6 + ']', path=DEFAULT_DOMAIN_PATH, nfs_version=storagelib.NfsVersion.V4_2) with storage_domain(system, DOMAIN_NAME, storagelib.StorageDomainType.DATA, host, host_storage_data) as sd: yield sd
def cirros_template(system, ovirt_image_repo, default_cluster, default_storage_domain, cirros_image, transformed_cirros_image): ovirt_image_sd = storagelib.StorageDomain(system) ovirt_image_sd.import_by_name(providers.OVIRT_IMAGE_REPO_NAME) cirros_template = transformed_cirros_image default_storage_domain.import_image(default_cluster, ovirt_image_sd, cirros_image, template_name=cirros_template) templatelib.wait_for_template_ok_status(system, cirros_template) return cirros_template
def default_storage_domain(system, engine_ip, host_0_up, default_data_center): # workaround for BZ 1779280 time.sleep(5) storage_domain = storagelib.StorageDomain(system) storage_domain.create(name=DEFAULT_DOMAIN_NAME, domain_type=storagelib.StorageDomainType.DATA, host=host_0_up, host_storage_data=storagelib.HostStorageData( storage_type=storagelib.StorageType.NFS, address=engine_ip, path=DEFAULT_DOMAIN_PATH, nfs_version=storagelib.NfsVersion.V4_2)) storage_domain.wait_for_unattached_status() default_data_center.attach_storage_domain(storage_domain) default_data_center.wait_for_sd_active_status(storage_domain) return storage_domain
def default_storage_domain(system, storage_facts, host_0_up, default_data_center): host_0_up.workaround_bz_1779280() storage_domain = storagelib.StorageDomain(system) try: storage_domain.import_by_name(DEFAULT_DOMAIN_NAME) except EntityNotFoundError: storage_domain.create( name=DEFAULT_DOMAIN_NAME, domain_type=storagelib.StorageDomainType.DATA, host=host_0_up, host_storage_data=storagelib.HostStorageData( storage_type=storagelib.StorageType.NFS, address=storage_facts.default_ip(urlize=True), path=DEFAULT_DOMAIN_PATH, nfs_version=storagelib.NfsVersion.V4_2, ), ) storage_domain.wait_for_unattached_status() default_data_center.attach_storage_domain(storage_domain) default_data_center.wait_for_sd_active_status(storage_domain) return storage_domain