[ovirt-users] Spurious error message when the RHEV capacity is maxed out?

2014-04-23 Thread Satya Vempati
We have about 900 vms in a RHEV-M 3.3 installation (3.3.2-0.50.el6ev) with 
three hosts.

Each VM has 1 socket, 1 core for CPU and 256 MB memory and 2 x 1TB disks + one 
5 GB boot disk.

Each host has 2 cpu sockets with 4 cpu cores per socket.

When we power on about 250 of these vms, we cannot power on any more vms.

Attempting to do so gets the error (in the RHEV-M) console.

Bad volume specification {'index': 0, 'iface': 'virtio', 'reqsize': '0', 
'format': 'raw', 'bootOrder': '1', 'volumeID': 
'14aa7302-7f6d-4b80-922d-3fc090695447', 'apparentsize': '5368709120', 
'imageID': '97b1985e-e507-4927-91e9-7393cde5', 'specParams': {}, 
'readonly': 'false', 'domainID': '0c7abccc-1b97-4b39-ab96-e977a19fac3a', 
'optional': 'false', 'deviceId': '97b1985e-e507-4927-91e9-7393cde5', 
'truesize': '0', 'poolID': '5849b030-626e-47cb-ad90-3ce782d831b3', 'device': 
'disk', 'shared': 'false', 'propagateErrors': 'off', 'type': 'disk'}.

This looks like a spurious error, as we can power on the same VM after 
rebooting the hosts.

And also, the hosts do not really look maxed out (CPU usage is around 25%, 
memory around 50%), but no more vm’s can be powered on.

I was looking for a sizing guide, and found only 
https://access.redhat.com/site/sites/default/files/attachments/rhev_sizing_0812.pdf

Is there any other information available?

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Adding a VMNIC via the REST api returns no error, but the NIC isn't added

2014-02-10 Thread Satya Vempati
I am using Postman rest client from Google. I am using the REST interface
directly.

I may a little behind on the versions, so let me see if I have more recent
version I could install and see if the problem goes away.

On 2/9/14, 12:40 PM, "Moti Asayag"  wrote:

>
>
>- Original Message -----
>> From: "Satya Vempati" 
>> To: "Moti Asayag" 
>> Cc: users@ovirt.org
>> Sent: Sunday, February 9, 2014 7:42:07 PM
>> Subject: Re: [Users] Adding a VMNIC via the REST api returns no error,
>>but the NIC isn't added
>> 
>> Thanks for the reply. Should have noted it earlier, I am using
>> 3.3.0-0.38.rc.el6ev.
>> 
>> I am chiefly concerned that no error is thrown when a nic isn¹t added,
>>so
>> when I am doing this programmatically I wouldn¹t be able to discover
>>that
>> the operation failed.
>> 
>
>I just tried the same example and got the following error:
>
>
>Operation Failed
>
>[Cannot add Interface. There is no VM network interface profile for the
>network the user can use. - Please use a VM network interface profile
>instead of a network name.]
>
>
>
>Where you using the restapi directly or used the SDK for posting that
>request ?
>Please provide the steps to reproduce this issue, since i wasn't able to
>experience the same behavior.
>
>> On 2/9/14, 7:56 AM, "Moti Asayag"  wrote:
>> 
>> >- Original Message -
>> >> From: "Satya Vempati" 
>> >> To: users@ovirt.org
>> >> Sent: Sunday, February 9, 2014 5:54:15 AM
>> >> Subject: [Users] Adding a VMNIC via the REST api returns no error,
>>but
>> >>the NIC isn't added
>> >> 
>> >> POST /api/vms/670fa876-a18d-436c-b999-1dc7cbbd5bcf/nics
>> >> 
>> >> 
>> >> eth0
>> >> 
>> >> rhevm
>> >> 
>> >> virtio
>> >> 
>> >> 
>> >> 
>> >> rhevm
>> >> 
>> >> 
>> >> 
>> >> 
>> >> 
>> >> Return code is 200, but no VM Nic is added.
>> >
>> >Assuming this is ovirt-engine-3.3 and above:
>> >
>> >Do you have a vnic profile for rhevm network with port_mirroring
>>enabled ?
>> >Which user are you using for adding this vnic ?
>> >
>> >You need to verify such a vnic profile exist and the user which adds
>>the
>> >vnic has permissions to use that profile.
>> >
>> >Alternately, you can provide the vnic_profile_id instead of the network
>> >name
>> >and the port mirroring which is the deprecated signature.
>> >
>> >http://www.ovirt.org/Features/Vnic_Profiles#REST_API
>> >
>> >> 
>> >> ___
>> >> Users mailing list
>> >> Users@ovirt.org
>> >> http://lists.ovirt.org/mailman/listinfo/users
>> >> 
>> 
>> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Adding a VMNIC via the REST api returns no error, but the NIC isn't added

2014-02-09 Thread Satya Vempati
Thanks for the reply. Should have noted it earlier, I am using
3.3.0-0.38.rc.el6ev.

I am chiefly concerned that no error is thrown when a nic isn¹t added, so
when I am doing this programmatically I wouldn¹t be able to discover that
the operation failed.

On 2/9/14, 7:56 AM, "Moti Asayag"  wrote:

>- Original Message -----
>> From: "Satya Vempati" 
>> To: users@ovirt.org
>> Sent: Sunday, February 9, 2014 5:54:15 AM
>> Subject: [Users] Adding a VMNIC via the REST api returns no error, but
>>the NIC isn't added
>> 
>> POST /api/vms/670fa876-a18d-436c-b999-1dc7cbbd5bcf/nics
>> 
>> 
>> eth0
>> 
>> rhevm
>> 
>> virtio
>> 
>> 
>> 
>> rhevm
>> 
>> 
>> 
>> 
>> 
>> Return code is 200, but no VM Nic is added.
>
>Assuming this is ovirt-engine-3.3 and above:
>
>Do you have a vnic profile for rhevm network with port_mirroring enabled ?
>Which user are you using for adding this vnic ?
>
>You need to verify such a vnic profile exist and the user which adds the
>vnic has permissions to use that profile.
>
>Alternately, you can provide the vnic_profile_id instead of the network
>name
>and the port mirroring which is the deprecated signature.
>
>http://www.ovirt.org/Features/Vnic_Profiles#REST_API
>
>> 
>> ___
>> Users mailing list
>> Users@ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/users
>> 

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Adding a VMNIC via the REST api returns no error, but the NIC isn't added

2014-02-08 Thread Satya Vempati
POST /api/vms/670fa876-a18d-436c-b999-1dc7cbbd5bcf/nics


  eth0
  
  rhevm
  
  virtio
  

  
rhevm
  

  


Return code is 200, but no VM Nic is added.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Register a disk image via oVirt REST api

2014-01-20 Thread Satya Vempati
Luckily I am on NFS, so it is relatively easy to copy the file over. Which, by 
the way, is what I am doing now.

But that means I rely on the internal knowledge of how the storage domain and 
the disks are laid out on the file system. 

Relying on the internals of the oVirt implementation is what I consider to be 
hacky/clumsy. That is why I was searching for a clean solution although the 
hacky way seems to be working.

-Original Message-
From: Itamar Heim [mailto:ih...@redhat.com] 
Sent: Monday, January 20, 2014 2:02 PM
To: Satya Vempati; Juan Hernandez; users@ovirt.org
Subject: Re: [Users] Register a disk image via oVirt REST api

On 01/20/2014 11:56 PM, Satya Vempati wrote:
> Yes, but to place it in the storage domain, first I need to create a disk on 
> the storage domain and replace the disk image with my disk image. That seems 
> a little hacky.

for block storage, true.
for NFS, you can just copy the file over?

>
> If registering a disk image isn't possible today, should I file a bug/rfe to 
> put it on the roadmap?

for nfs, should be easy.
for block storage, yes, to create a disk/LV not via the engine.

>
> -Original Message-
> From: Itamar Heim [mailto:ih...@redhat.com]
> Sent: Monday, January 20, 2014 1:46 PM
> To: Satya Vempati; Juan Hernandez; users@ovirt.org
> Subject: Re: [Users] Register a disk image via oVirt REST api
>
> On 01/20/2014 11:39 PM, Satya Vempati wrote:
>> It is a disk image (could be raw/cow, preallocated/thin provisioned). But is 
>> just a file. The REST API doesn't take a file path to convert the disk image 
>> into a system disk.
>
> you need to place it in the storage domain according to the naming convention 
> the storage domain has, then you can simply register it.
>
>>
>> -Original Message-
>> From: Itamar Heim [mailto:ih...@redhat.com]
>> Sent: Monday, January 20, 2014 1:37 PM
>> To: Satya Vempati; Juan Hernandez; users@ovirt.org
>> Subject: Re: [Users] Register a disk image via oVirt REST api
>>
>> On 01/20/2014 11:36 PM, Satya Vempati wrote:
>>> Well, the crux of the problem is that there doesn't seem to be a way to 
>>> convert the disk image I have into a disk that the system will recognize.
>>
>> why, which format is it?
>>
>>>
>>> -Original Message-
>>> From: Itamar Heim [mailto:ih...@redhat.com]
>>> Sent: Monday, January 20, 2014 1:32 PM
>>> To: Satya Vempati; Juan Hernandez; users@ovirt.org
>>> Subject: Re: [Users] Register a disk image via oVirt REST api
>>>
>>> On 01/20/2014 11:30 PM, Satya Vempati wrote:
>>>> Thanks Juan and Itamar.
>>>>
>>>> As Juan said, I am trying take a file that I have that contains the 
>>>> image of a disk and create a disk in the system with the same 
>>>> content
>>>>
>>>>  I am taking a similar approach to the one Juan described. I am 
>>>> creating a VM and then creating a new disk with the same size and 
>>>> attributes as my disk image. Then I am replacing the disk image of the new 
>>>> disk with the file that contains the image of the disk I want.  That seems 
>>>> to work but seemed too hacky/clumsy. I was hoping there is a more 
>>>> straightforward/clean way to do this.
>>>
>>> you can just place the disk on the storage, register the disk, and attach 
>>> it to a VM?
>>>
>>>>
>>>> -Original Message-
>>>> From: Juan Hernandez [mailto:jhern...@redhat.com]
>>>> Sent: Saturday, January 18, 2014 8:27 AM
>>>> To: Satya Vempati; users@ovirt.org
>>>> Cc: Itamar Heim
>>>> Subject: Re: [Users] Register a disk image via oVirt REST api
>>>>
>>>> On 01/17/2014 11:28 PM, Itamar Heim wrote:
>>>>> On 01/16/2014 07:21 PM, Satya Vempati wrote:
>>>>>> I have a disk image (i.e. a file) that I want to register as a 
>>>>>> disk using the REST API.
>>>>>>
>>>>>> The REST API works with existing disks, but does the API work 
>>>>>> with disk images?
>>>>>
>>>>> can you pleas explain what do you mean by an image compared to a disk?
>>>>>
>>>>
>>>> I think that what you want is to take a file that you have that contains 
>>>> the image of a disk and create a disk in the system with the same content.
>>>>
>>>> As far as I know we don't have any direct way to do this. You will need to 
>>>> create an empty disk in oVirt, and then attach it to a virtual

Re: [Users] Register a disk image via oVirt REST api

2014-01-20 Thread Satya Vempati
Yes, but to place it in the storage domain, first I need to create a disk on 
the storage domain and replace the disk image with my disk image. That seems a 
little hacky.

If registering a disk image isn't possible today, should I file a bug/rfe to 
put it on the roadmap?

-Original Message-
From: Itamar Heim [mailto:ih...@redhat.com] 
Sent: Monday, January 20, 2014 1:46 PM
To: Satya Vempati; Juan Hernandez; users@ovirt.org
Subject: Re: [Users] Register a disk image via oVirt REST api

On 01/20/2014 11:39 PM, Satya Vempati wrote:
> It is a disk image (could be raw/cow, preallocated/thin provisioned). But is 
> just a file. The REST API doesn't take a file path to convert the disk image 
> into a system disk.

you need to place it in the storage domain according to the naming convention 
the storage domain has, then you can simply register it.

>
> -Original Message-
> From: Itamar Heim [mailto:ih...@redhat.com]
> Sent: Monday, January 20, 2014 1:37 PM
> To: Satya Vempati; Juan Hernandez; users@ovirt.org
> Subject: Re: [Users] Register a disk image via oVirt REST api
>
> On 01/20/2014 11:36 PM, Satya Vempati wrote:
>> Well, the crux of the problem is that there doesn't seem to be a way to 
>> convert the disk image I have into a disk that the system will recognize.
>
> why, which format is it?
>
>>
>> -Original Message-
>> From: Itamar Heim [mailto:ih...@redhat.com]
>> Sent: Monday, January 20, 2014 1:32 PM
>> To: Satya Vempati; Juan Hernandez; users@ovirt.org
>> Subject: Re: [Users] Register a disk image via oVirt REST api
>>
>> On 01/20/2014 11:30 PM, Satya Vempati wrote:
>>> Thanks Juan and Itamar.
>>>
>>> As Juan said, I am trying take a file that I have that contains the 
>>> image of a disk and create a disk in the system with the same 
>>> content
>>>
>>> I am taking a similar approach to the one Juan described. I am creating 
>>> a VM and then creating a new disk with the same size and attributes as my 
>>> disk image. Then I am replacing the disk image of the new disk with the 
>>> file that contains the image of the disk I want.  That seems to work but 
>>> seemed too hacky/clumsy. I was hoping there is a more straightforward/clean 
>>> way to do this.
>>
>> you can just place the disk on the storage, register the disk, and attach it 
>> to a VM?
>>
>>>
>>> -Original Message-
>>> From: Juan Hernandez [mailto:jhern...@redhat.com]
>>> Sent: Saturday, January 18, 2014 8:27 AM
>>> To: Satya Vempati; users@ovirt.org
>>> Cc: Itamar Heim
>>> Subject: Re: [Users] Register a disk image via oVirt REST api
>>>
>>> On 01/17/2014 11:28 PM, Itamar Heim wrote:
>>>> On 01/16/2014 07:21 PM, Satya Vempati wrote:
>>>>> I have a disk image (i.e. a file) that I want to register as a 
>>>>> disk using the REST API.
>>>>>
>>>>> The REST API works with existing disks, but does the API work with 
>>>>> disk images?
>>>>
>>>> can you pleas explain what do you mean by an image compared to a disk?
>>>>
>>>
>>> I think that what you want is to take a file that you have that contains 
>>> the image of a disk and create a disk in the system with the same content.
>>>
>>> As far as I know we don't have any direct way to do this. You will need to 
>>> create an empty disk in oVirt, and then attach it to a virtual machine. 
>>> Once it is attached to that virtual machine then you can write to it, but 
>>> always via the virtual machine. For example, you can use the API as follows 
>>> to create a new disk that isn't attached to any VM:
>>>
>>> curl \
>>> -k \
>>> -X POST \
>>> -H "Accept: application/xml" \
>>> -H "Content-Type: application/xml" \ -d "
>>> 
>>>  newdisk
>>>  1073741824
>>>  raw
>>>  virtio
>>> 
>>> " \
>>> -u admin@internal:** \
>>> https://rhel.example.com/api/storagedomains/the_id_of_the_storage_do
>>> m
>>> a
>>> in/disks
>>>
>>> Then prepare a VM that you will use to copy the contents of your file to 
>>> the new disk, and use the API to attach the new disk to this VM (you can 
>>> preserve this VM, and use multiple times for this purpose):
>>>
>>> curl \
>>> -k \
>>> -X POST \
>>> -H "Accept: application/xml" \
>>> -H "Content-

Re: [Users] Register a disk image via oVirt REST api

2014-01-20 Thread Satya Vempati
It is a disk image (could be raw/cow, preallocated/thin provisioned). But is 
just a file. The REST API doesn't take a file path to convert the disk image 
into a system disk.

-Original Message-
From: Itamar Heim [mailto:ih...@redhat.com] 
Sent: Monday, January 20, 2014 1:37 PM
To: Satya Vempati; Juan Hernandez; users@ovirt.org
Subject: Re: [Users] Register a disk image via oVirt REST api

On 01/20/2014 11:36 PM, Satya Vempati wrote:
> Well, the crux of the problem is that there doesn't seem to be a way to 
> convert the disk image I have into a disk that the system will recognize.

why, which format is it?

>
> -Original Message-
> From: Itamar Heim [mailto:ih...@redhat.com]
> Sent: Monday, January 20, 2014 1:32 PM
> To: Satya Vempati; Juan Hernandez; users@ovirt.org
> Subject: Re: [Users] Register a disk image via oVirt REST api
>
> On 01/20/2014 11:30 PM, Satya Vempati wrote:
>> Thanks Juan and Itamar.
>>
>> As Juan said, I am trying take a file that I have that contains the 
>> image of a disk and create a disk in the system with the same content
>>
>>I am taking a similar approach to the one Juan described. I am creating a 
>> VM and then creating a new disk with the same size and attributes as my disk 
>> image. Then I am replacing the disk image of the new disk with the file that 
>> contains the image of the disk I want.  That seems to work but seemed too 
>> hacky/clumsy. I was hoping there is a more straightforward/clean way to do 
>> this.
>
> you can just place the disk on the storage, register the disk, and attach it 
> to a VM?
>
>>
>> -Original Message-
>> From: Juan Hernandez [mailto:jhern...@redhat.com]
>> Sent: Saturday, January 18, 2014 8:27 AM
>> To: Satya Vempati; users@ovirt.org
>> Cc: Itamar Heim
>> Subject: Re: [Users] Register a disk image via oVirt REST api
>>
>> On 01/17/2014 11:28 PM, Itamar Heim wrote:
>>> On 01/16/2014 07:21 PM, Satya Vempati wrote:
>>>> I have a disk image (i.e. a file) that I want to register as a disk 
>>>> using the REST API.
>>>>
>>>> The REST API works with existing disks, but does the API work with 
>>>> disk images?
>>>
>>> can you pleas explain what do you mean by an image compared to a disk?
>>>
>>
>> I think that what you want is to take a file that you have that contains the 
>> image of a disk and create a disk in the system with the same content.
>>
>> As far as I know we don't have any direct way to do this. You will need to 
>> create an empty disk in oVirt, and then attach it to a virtual machine. Once 
>> it is attached to that virtual machine then you can write to it, but always 
>> via the virtual machine. For example, you can use the API as follows to 
>> create a new disk that isn't attached to any VM:
>>
>> curl \
>> -k \
>> -X POST \
>> -H "Accept: application/xml" \
>> -H "Content-Type: application/xml" \
>> -d "
>> 
>> newdisk
>> 1073741824
>> raw
>> virtio
>> 
>> " \
>> -u admin@internal:** \
>> https://rhel.example.com/api/storagedomains/the_id_of_the_storage_dom
>> a
>> in/disks
>>
>> Then prepare a VM that you will use to copy the contents of your file to the 
>> new disk, and use the API to attach the new disk to this VM (you can 
>> preserve this VM, and use multiple times for this purpose):
>>
>> curl \
>> -k \
>> -X POST \
>> -H "Accept: application/xml" \
>> -H "Content-Type: application/xml" \
>> -d "
>> 
>> " \
>> -u admin@internal:** \
>> https://rhel.example.com/api/vms/the_id_of_the_vm/disks
>>
>> (Note that in order to attach the disk you have to provide the disk 
>> id returned by the API when you created it.)
>>
>> Then activate the disk, so that the VM can see it:
>>
>> curl \
>> -k \
>> -X POST \
>> -H "Accept: application/xml" \
>> -H "Content-Type: application/xml" \
>> -d "
>> 
>> " \
>> -u admin@internal:** \
>> https://rhel.example.com/api/vms/the_id_of_the_vm/disks/the_id_of_the
>> _
>> disk/activate
>>
>> Now you will have to copy the contents of the file to the disk via the VM. 
>> For example, assuming that you have SSH enabled on that VM and that the disk 
>> device inside the VM is /dev/vdb (it won't allways be this, depends on the 
>> number and order of attached disks) you can do something like thi

Re: [Users] Register a disk image via oVirt REST api

2014-01-20 Thread Satya Vempati
Well, the crux of the problem is that there doesn't seem to be a way to convert 
the disk image I have into a disk that the system will recognize.

-Original Message-
From: Itamar Heim [mailto:ih...@redhat.com] 
Sent: Monday, January 20, 2014 1:32 PM
To: Satya Vempati; Juan Hernandez; users@ovirt.org
Subject: Re: [Users] Register a disk image via oVirt REST api

On 01/20/2014 11:30 PM, Satya Vempati wrote:
> Thanks Juan and Itamar.
>
> As Juan said, I am trying take a file that I have that contains the 
> image of a disk and create a disk in the system with the same content
>
>   I am taking a similar approach to the one Juan described. I am creating a 
> VM and then creating a new disk with the same size and attributes as my disk 
> image. Then I am replacing the disk image of the new disk with the file that 
> contains the image of the disk I want.  That seems to work but seemed too 
> hacky/clumsy. I was hoping there is a more straightforward/clean way to do 
> this.

you can just place the disk on the storage, register the disk, and attach it to 
a VM?

>
> -Original Message-
> From: Juan Hernandez [mailto:jhern...@redhat.com]
> Sent: Saturday, January 18, 2014 8:27 AM
> To: Satya Vempati; users@ovirt.org
> Cc: Itamar Heim
> Subject: Re: [Users] Register a disk image via oVirt REST api
>
> On 01/17/2014 11:28 PM, Itamar Heim wrote:
>> On 01/16/2014 07:21 PM, Satya Vempati wrote:
>>> I have a disk image (i.e. a file) that I want to register as a disk 
>>> using the REST API.
>>>
>>> The REST API works with existing disks, but does the API work with 
>>> disk images?
>>
>> can you pleas explain what do you mean by an image compared to a disk?
>>
>
> I think that what you want is to take a file that you have that contains the 
> image of a disk and create a disk in the system with the same content.
>
> As far as I know we don't have any direct way to do this. You will need to 
> create an empty disk in oVirt, and then attach it to a virtual machine. Once 
> it is attached to that virtual machine then you can write to it, but always 
> via the virtual machine. For example, you can use the API as follows to 
> create a new disk that isn't attached to any VM:
>
> curl \
> -k \
> -X POST \
> -H "Accept: application/xml" \
> -H "Content-Type: application/xml" \
> -d "
> 
>newdisk
>1073741824
>raw
>virtio
> 
> " \
> -u admin@internal:** \
> https://rhel.example.com/api/storagedomains/the_id_of_the_storage_doma
> in/disks
>
> Then prepare a VM that you will use to copy the contents of your file to the 
> new disk, and use the API to attach the new disk to this VM (you can preserve 
> this VM, and use multiple times for this purpose):
>
> curl \
> -k \
> -X POST \
> -H "Accept: application/xml" \
> -H "Content-Type: application/xml" \
> -d "
> 
> " \
> -u admin@internal:** \
> https://rhel.example.com/api/vms/the_id_of_the_vm/disks
>
> (Note that in order to attach the disk you have to provide the disk id 
> returned by the API when you created it.)
>
> Then activate the disk, so that the VM can see it:
>
> curl \
> -k \
> -X POST \
> -H "Accept: application/xml" \
> -H "Content-Type: application/xml" \
> -d "
> 
> " \
> -u admin@internal:** \
> https://rhel.example.com/api/vms/the_id_of_the_vm/disks/the_id_of_the_
> disk/activate
>
> Now you will have to copy the contents of the file to the disk via the VM. 
> For example, assuming that you have SSH enabled on that VM and that the disk 
> device inside the VM is /dev/vdb (it won't allways be this, depends on the 
> number and order of attached disks) you can do something like this:
>
> ssh root@myvm 'cat > /dev/vdb' < myfile.img ssh root@myvm 'sync'
>
> Once the contents of the file have been copied you can deactivate the disk 
> and detach it from this intermediate VM, and maybe attach it to another one.
>
> Take into account that all these operations are lengthy ones, specially the 
> operation to create the disk, and that the RESTAPI will usually return once 
> the operation is initiated, so you will need to wait till they are finished. 
> For example, when creating the disk you should poll the state of the VM till 
> it is "ok".
>
> --
> Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta 3ºD, 
> 28016 Madrid, Spain Inscrita en el Reg. Mercantil de Madrid - C.I.F. 
> B82657941 - Red Hat S.L.
>

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


Re: [Users] Register a disk image via oVirt REST api

2014-01-20 Thread Satya Vempati
Thanks Juan and Itamar.

As Juan said, I am trying take a file that I have that contains the image of a 
disk and create a disk in the system with the same content

 I am taking a similar approach to the one Juan described. I am creating a VM 
and then creating a new disk with the same size and attributes as my disk 
image. Then I am replacing the disk image of the new disk with the file that 
contains the image of the disk I want.  That seems to work but seemed too 
hacky/clumsy. I was hoping there is a more straightforward/clean way to do this.

-Original Message-
From: Juan Hernandez [mailto:jhern...@redhat.com] 
Sent: Saturday, January 18, 2014 8:27 AM
To: Satya Vempati; users@ovirt.org
Cc: Itamar Heim
Subject: Re: [Users] Register a disk image via oVirt REST api

On 01/17/2014 11:28 PM, Itamar Heim wrote:
> On 01/16/2014 07:21 PM, Satya Vempati wrote:
>> I have a disk image (i.e. a file) that I want to register as a disk 
>> using the REST API.
>>
>> The REST API works with existing disks, but does the API work with 
>> disk images?
> 
> can you pleas explain what do you mean by an image compared to a disk?
> 

I think that what you want is to take a file that you have that contains the 
image of a disk and create a disk in the system with the same content.

As far as I know we don't have any direct way to do this. You will need to 
create an empty disk in oVirt, and then attach it to a virtual machine. Once it 
is attached to that virtual machine then you can write to it, but always via 
the virtual machine. For example, you can use the API as follows to create a 
new disk that isn't attached to any VM:

curl \
-k \
-X POST \
-H "Accept: application/xml" \
-H "Content-Type: application/xml" \
-d "

  newdisk
  1073741824
  raw
  virtio

" \
-u admin@internal:** \
https://rhel.example.com/api/storagedomains/the_id_of_the_storage_domain/disks

Then prepare a VM that you will use to copy the contents of your file to the 
new disk, and use the API to attach the new disk to this VM (you can preserve 
this VM, and use multiple times for this purpose):

curl \
-k \
-X POST \
-H "Accept: application/xml" \
-H "Content-Type: application/xml" \
-d "

" \
-u admin@internal:** \
https://rhel.example.com/api/vms/the_id_of_the_vm/disks

(Note that in order to attach the disk you have to provide the disk id returned 
by the API when you created it.)

Then activate the disk, so that the VM can see it:

curl \
-k \
-X POST \
-H "Accept: application/xml" \
-H "Content-Type: application/xml" \
-d "

" \
-u admin@internal:** \
https://rhel.example.com/api/vms/the_id_of_the_vm/disks/the_id_of_the_disk/activate

Now you will have to copy the contents of the file to the disk via the VM. For 
example, assuming that you have SSH enabled on that VM and that the disk device 
inside the VM is /dev/vdb (it won't allways be this, depends on the number and 
order of attached disks) you can do something like this:

ssh root@myvm 'cat > /dev/vdb' < myfile.img ssh root@myvm 'sync'

Once the contents of the file have been copied you can deactivate the disk and 
detach it from this intermediate VM, and maybe attach it to another one.

Take into account that all these operations are lengthy ones, specially the 
operation to create the disk, and that the RESTAPI will usually return once the 
operation is initiated, so you will need to wait till they are finished. For 
example, when creating the disk you should poll the state of the VM till it is 
"ok".

--
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta 3ºD, 
28016 Madrid, Spain Inscrita en el Reg. Mercantil de Madrid - C.I.F. B82657941 
- Red Hat S.L.
___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users


[Users] Register a disk image via oVirt REST api

2014-01-16 Thread Satya Vempati
I have a disk image (i.e. a file) that I want to register as a disk using the 
REST API.

The REST API works with existing disks, but does the API work with disk images?

___
Users mailing list
Users@ovirt.org
http://lists.ovirt.org/mailman/listinfo/users