Create cinder disk via python sdk

Hi As part of migrating from KVM to Ceph, I'm trying to create a Cinder disk via the python sdk. This is what I have so far and it fails with the message that the cinder type null doesn't exist: disk_attachment = disk_attachments_service.add( types.DiskAttachment( disk=types.Disk( name = 'API_Disk_Cinder_test', format=types.DiskFormat.RAW, provisioned_size=12 * 2**30, storage_domains=[ types.StorageDomain( name='ovirt2-cinder', ), ], openstack_volume_type=types.OpenStackVolumeType( 'ceph', openstack_volume_provider=types.OpenStackVolumeProvider('ovirt2-cinder'), ) ), interface=types.DiskInterface.VIRTIO, bootable=False, active=True, ), ) Doing it similarly with an NFS backend works so I know the connection details are correct, so I didn't bother including them. Regards,

On 12/02/2016 02:00 PM, Logan Kuhn wrote:
Hi
As part of migrating from KVM to Ceph, I'm trying to create a Cinder disk via the python sdk. This is what I have so far and it fails with the message that the cinder type null doesn't exist:
disk_attachment = disk_attachments_service.add( types.DiskAttachment( disk=types.Disk( name = 'API_Disk_Cinder_test', format=types.DiskFormat.RAW, provisioned_size=12 * 2**30, storage_domains=[ types.StorageDomain( name='ovirt2-cinder', ), ], openstack_volume_type=types.OpenStackVolumeType( 'ceph',
^Here you should have: name='ceph', Python SDK is using named arguments, so be carefull what you are actually sending.
openstack_volume_provider=types.OpenStackVolumeProvider('ovirt2-cinder'),
^Here you should have: openstack_volume_provider=types.OpenStackVolumeProvider(name='ovirt2-cinder'),
) ), interface=types.DiskInterface.VIRTIO, bootable=False, active=True, ), )
Doing it similarly with an NFS backend works so I know the connection details are correct, so I didn't bother including them.
Regards,
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

Thank you!!!! That is exactly what I needed. Do you know if there is more comprehensive documentation for the 4.x Python sdk? Regards, Logan Kuhn On Fri, Dec 2, 2016 at 7:35 AM, Ondra Machacek <omachace@redhat.com> wrote:
On 12/02/2016 02:00 PM, Logan Kuhn wrote:
Hi
As part of migrating from KVM to Ceph, I'm trying to create a Cinder disk via the python sdk. This is what I have so far and it fails with the message that the cinder type null doesn't exist:
disk_attachment = disk_attachments_service.add( types.DiskAttachment( disk=types.Disk( name = 'API_Disk_Cinder_test', format=types.DiskFormat.RAW, provisioned_size=12 * 2**30, storage_domains=[ types.StorageDomain( name='ovirt2-cinder', ), ], openstack_volume_type=types.OpenStackVolumeType( 'ceph',
^Here you should have:
name='ceph',
Python SDK is using named arguments, so be carefull what you are actually sending.
openstack_volume_provider=types.OpenStackVolumeProvider('ovirt2-cinder'),
^Here you should have:
openstack_volume_provider=types.OpenStackVolumeProvider(name ='ovirt2-cinder'),
)
), interface=types.DiskInterface.VIRTIO, bootable=False, active=True, ), )
Doing it similarly with an NFS backend works so I know the connection details are correct, so I didn't bother including them.
Regards,
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
participants (2)
-
Logan Kuhn
-
Ondra Machacek