Storage Domain - Python API

Latest response

Hi

We have 14 RHV host running local storage with 1 export domain that we detach and attach to each data centre when required. The export-domain can only be attached to one data centre at a time.

I was looking a Python using the API to automatic some tasks for example moving 1 VM from one host to another., but I can't seem to find a way to detach the export domain from the data centre and add it to another.

Can anyone suggest the best way to complete this function?

We are using RHV version 4.3

Kind Regards
Jason

Responses

Hi Jason,

Please refer to https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.3/html-single/python_sdk_guide/index#Attaching_Storage_Domains_to_a_Data_Center

It uses the the 'add' method to attach the SD and likely the 'remove' method should be used for detaching.

Why are you using local storage for your hosts and separate datacenters? Centralized storage and a single datacenter provides you with the benefit of live migration of VM's between hosts and quicker recovery when a host fails.

regards, Siem

Hi Siem

The local storage is what we decided many years ago with SAN's being to expensive and we haven't updated yet. We just migrated from Citrx Xen to RHV and centralised storage is the next process.

I have looked through the document long with the suggestions and examples at githut for oVirt but couldn't find anything for the "export-domain" The Storage Domains doesn't use "remove" I had tried that, comes back up

"AttributeError: 'StorageDomainService' object has no attribute remove"

I tried same with attribute maintenance which also resulted in same error.

Kind Regards Jason

Depending how far away your central storage solution is, you might want to consider RHHI. This allows you to use your local hypervisor disk in a gluster cluster (ceph in the future):

Red Hat Hyperconverged Infrastructure

Thanks Marcus, I will have a look at that.