[ovirt-users] ovirt ansible module

Juan Hernández jhernand at redhat.com
Wed Mar 8 10:29:35 UTC 2017


On 03/08/2017 10:08 AM, Oğuz Yarımtepe wrote:
> I didn't see any parameter at the current ansible documentation related
> with these features. How can i set these feature if i am using ansible?
> Any possibility to set them via SDK after the vm is opened via ansible?
> 

The target storage domain for the lease can be set using the Python SDK,
like this:

---8<---
import ovirtsdk4 as sdk
import ovirtsdk4.types as types

# This example shows how to set the storage domain where the lease of a
# virtual machine should be created.

# Create the connection to the server:
connection = sdk.Connection(
    url='https://engine.example.com/ovirt-engine/api',
    username='admin at internal',
    password='...',
    ca_file='ca.pem'
)

# Get the reference to the root of the tree of services:
system_service = connection.system_service()

# Find the virtual machine:
vms_service = system_service.vms_service()
vm = vms_service.list(search='name=myvm')[0]

# Find the storage domain:
sds_service = system_service.storage_domains_service()
sd = sds_service.list(search='name=mydata')[0]

# Update the storage machine so that high availability is enabled and
# the lease is created in the selected storage domain:
vm_service = vms_service.vm_service(vm.id)
vm_service.update(
    vm=types.Vm(
        high_availability=types.HighAvailability(
            enabled=True
        ),
        lease=types.StorageDomainLease(
            storage_domain=types.StorageDomain(
                id=sd.id
            )
        )
    )
)

# Close the connection to the server:
connection.close()
--->8---

~
> On Wed, Mar 8, 2017 at 8:46 AM, Oved Ourfali <oourfali at redhat.com
> <mailto:oourfali at redhat.com>> wrote:
> 
>     The VM leases feature is a new feature in 4.1, and I'm not sure
>     whether it was included in the ansible modules or not.
>     CC-ing Ondra as he will know for sure.
> 
> 
>     On Wed, Mar 8, 2017 at 3:20 AM, Oğuz Yarımtepe
>     <oguzyarimtepe at gmail.com <mailto:oguzyarimtepe at gmail.com>> wrote:
> 
>         Hi,
> 
>         I am ttesting the ovirt ansible module. Couldn't figured ot how
>         to open a new vm from template with thin provisioning and Target
>         Storage Domain for VM Lease definition. Any idea how can i set
>         these values at the ansible playbook?
>          
> 
>         -- 
>         Oğuz Yarımtepe
>         http://about.me/oguzy
> 
>         _______________________________________________
>         Users mailing list
>         Users at ovirt.org <mailto:Users at ovirt.org>
>         http://lists.ovirt.org/mailman/listinfo/users
>         <http://lists.ovirt.org/mailman/listinfo/users>
> 
> 
> 
> 
> 
> -- 
> Oğuz Yarımtepe
> http://about.me/oguzy
> 
> 
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 



More information about the Users mailing list