import ovirtsdk4 as sdk
import ovirtsdk4.types as types
connection = sdk.Connection(
url='https://engine.example.com/ovirt-engine/api',
username='admin@internal',
password='password',
ca_file='ca.pem',
)
# Get the reference to the storage domains service:
sds_service = connection.system_service().storage_domains_service()
# Use the "add" method to create a new NFS storage domain:
sd = sds_service.add(
types.StorageDomain(
name='myiso',
description='My ISO',
type=types.StorageDomainType.ISO,
host=types.Host(
name='myhost',
),
storage=types.HostStorage(
type=types.StorageType.NFS,
address='FQDN',
path='/nfs/ovirt/path/to/myiso',
),
),
)
# Wait until the storage domain is unattached:
sd_service = sds_service.storage_domain_service(sd.id)
while True:
time.sleep(5)
sd = sd_service.get()
if sd.status == types.StorageDomainStatus.UNATTACHED:
break
print("Storage Domain '%s' added (%s)." % (sd.name(), sd.id()))
# Close the connection to the server:
connection.close()
import ovirtsdk4 as sdk
import ovirtsdk4.types as types
connection = sdk.Connection(
url='https://engine.example.com/ovirt-engine/api',
username='admin@internal',
password='password',
ca_file='ca.pem',
)
# Get the reference to the storage domains service:
sds_service = connection.system_service().storage_domains_service()
# Use the "add" method to create a new NFS storage domain:
sd = sds_service.add(
types.StorageDomain(
name='myiso',
description='My ISO',
type=types.StorageDomainType.ISO,
host=types.Host(
name='myhost',
),
storage=types.HostStorage(
type=types.StorageType.NFS,
address='FQDN',
path='/nfs/ovirt/path/to/myiso',
),
),
)
# Wait until the storage domain is unattached:
sd_service = sds_service.storage_domain_service(sd.id)
while True:
time.sleep(5)
sd = sd_service.get()
if sd.status == types.StorageDomainStatus.UNATTACHED:
break
print("Storage Domain '%s' added (%s)." % (sd.name(), sd.id()))
# Close the connection to the server:
connection.close()
Copy to ClipboardCopied!Toggle word wrapToggle overflow