That works, thank you !
Regards,
-----------------------------
Guy Chen, RHV
Performance
O: +972.9.7692152 M: +972.52.8545202
guchen(a)redhat.com
----- Original Message -----
From: "Ondra Machacek" <omachace(a)redhat.com>
To: "Guy Chen" <guchen(a)redhat.com>
Cc: "users" <users(a)ovirt.org>
Sent: Friday, May 19, 2017 9:22:30 AM
Subject: Re: [ovirt-users] add direct LUN disk to a VM with python SDK
I've sent following example to our Python SDK,
feel free to try and review:
https://gerrit.ovirt.org/#/c/77003/1
Also you may checkout relevant Ansible module, which support this
functionality as well:
http://docs.ansible.com/ansible/ovirt_disks_module.html
On Wed, May 17, 2017 at 1:21 PM, Guy Chen <guchen(a)redhat.com> wrote:
>
> I am trying to add direct LUN disk to a VM with python ovirtsdk4 ( storage
> domain is iscsi ) .
> Adding a COW disk is working as in the SDK example, attached below, i have
> tried different things that i saw online but did not work, anybody have an
> example of how to add a direct LUN disk ?
>
> def add_VM_disk(self):
>
>
> vms_service = self.connection.system_service().vms_service()
> vm = vms_service.list(search='name=myvm')[0]
>
> # Locate the service that manages the disk attachments of the virtual
> # machine:
> disk_attachments_service =
> vms_service.vm_service(vm.id).disk_attachments_service()
>
> # Use the "add" method of the disk attachments service to add the
disk.
> # Note that the size of the disk, the `provisioned_size` attribute, is
> # specified in bytes, so to create a disk of 10 GiB the value should
> # be 10 * 2^30.
> disk_attachment = disk_attachments_service.add(
> types.DiskAttachment(
> disk=types.Disk(
> name='mydisk',
> description='My disk',
> format=types.DiskFormat.COW,
> provisioned_size=10 * 2 ** 30,
> ),
> interface=types.DiskInterface.VIRTIO,
> bootable=False,
> active=True,
> ),
> )
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users(a)ovirt.org
>
http://lists.ovirt.org/mailman/listinfo/users
>
>