[ovirt-users] oVirt and Foreman
Juan Hernández
jhernand at redhat.com
Fri Jul 28 15:46:21 UTC 2017
On 07/28/2017 04:53 PM, Davide Ferrari wrote:
>
>
> On 28/07/17 16:14, Juan Hernández wrote:
>> Ah, I see, in your command you are listing Gluster volumes, not
>> storage domains. They are different kinds of objects inside oVirt, and
>> thus they have different identifiers. That is completely normal. If
>> you want to get the identifiers of the storage domains use "list
>> storagedomains".
>>
>
> Oh, got it. Thanks for the tip!
>
>>> Anyway, I've replaced the storage domain UUID with the one that works
>>> with the REST API and something improved: now I don't get the 404
>>> from ovirt and the machine is not deleted BUT: I've added 2 disks
>>> (20GB and 30GB) plus the base template 8Gb disk, and I get a VM with
>>> four (4) 8GB disks, and the bootable one is a random disk
>>>
>>> I've attached the engine.log with the (I hope) relevant messages
>>>
>>
>> Are you adding those disks and template using the Foreman CLI? Can you
>> share the commands that you are using?
>>
>
> Yes, I'm using Hammer CLI
>
> hammer host create --architecture-id=1 --domain billy.preprod
> --operatingsystem-id=7 --hostgroup-title Billy/Preprod --name foobar03
> --partition-table-id=192 --provision-method image --root-password
> billy12345 --compute-resource 'LeaseWeb VMs prod' --image CentOS_7.3
> --compute-attributes
> cluster=00000002-0002-0002-0002-000000000345,cores=2,memory=4294967296,start=1
> --volume
> '"size_gb=20,storage_domain=ba2bd397-9222-424d-aecc-eb652c0169d9,bootable=0"'
> --volume
> '"size_gb=30,storage_domain=ba2bd397-9222-424d-aecc-eb652c0169d9,bootable=0"'
>
>
>
>> Also, can you share again the relevant part of the
>> /var/log/ovirt-engine/ssl_access_log file? There we can see what
>> requests are actually sent to the oVirt engine.
>
> These are the requests arriving from Foreman:
> 192.168.10.158 - - [28/Jul/2017:14:19:42 +0000] "GET
> /ovirt-engine/api/vms/24831007-97ad-4f6d-9009-e6fb68a585f9 HTTP/1.1" 200
> 2865
> 192.168.10.158 - - [28/Jul/2017:14:26:19 +0000] "GET
> /ovirt-engine/api/datacenters?search= HTTP/1.1" 200 408
> 192.168.10.158 - - [28/Jul/2017:14:26:19 +0000] "GET
> /ovirt-engine/api/operatingsystems HTTP/1.1" 200 2943
> 192.168.10.158 - - [28/Jul/2017:14:26:20 +0000] "GET
> /ovirt-engine/api/datacenters?search= HTTP/1.1" 200 408
> 192.168.10.158 - - [28/Jul/2017:14:26:20 +0000] "GET
> /ovirt-engine/api/operatingsystems HTTP/1.1" 200 2943
> 192.168.10.158 - - [28/Jul/2017:14:26:20 +0000] "GET
> /ovirt-engine/api/datacenters?search= HTTP/1.1" 200 408
> 192.168.10.158 - - [28/Jul/2017:14:26:20 +0000] "GET
> /ovirt-engine/api/clusters/ HTTP/1.1" 200 1091
> 192.168.10.158 - - [28/Jul/2017:14:26:20 +0000] "POST
> /ovirt-engine/api/vms HTTP/1.1" 202 1612
> 192.168.10.158 - - [28/Jul/2017:14:26:22 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2256
> 192.168.10.158 - - [28/Jul/2017:14:26:22 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/nics
> HTTP/1.1" 200 409
> 192.168.10.158 - - [28/Jul/2017:14:26:22 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2256
> 192.168.10.158 - - [28/Jul/2017:14:26:23 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2256
> 192.168.10.158 - - [28/Jul/2017:14:26:26 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2256
> 192.168.10.158 - - [28/Jul/2017:14:26:30 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2252
> 192.168.10.158 - - [28/Jul/2017:14:26:30 +0000] "DELETE
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/nics/bf0dabd2-796b-4b07-bd69-db3915409939
> HTTP/1.1" 200 119
> 192.168.10.158 - - [28/Jul/2017:14:26:30 +0000] "POST
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/nics
> HTTP/1.1" 201 430
> 192.168.10.158 - - [28/Jul/2017:14:26:31 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/nics
> HTTP/1.1" 200 442
> 192.168.10.158 - - [28/Jul/2017:14:26:31 +0000] "GET /ovirt-engine/api/
> HTTP/1.1" 200 873
> 192.168.10.158 - - [28/Jul/2017:14:26:31 +0000] "GET
> /ovirt-engine/api/datacenters/00000001-0001-0001-0001-0000000003e3
> HTTP/1.1" 200 396
> 192.168.10.158 - - [28/Jul/2017:14:26:31 +0000] "POST
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks
> HTTP/1.1" 201 674
> 192.168.10.158 - - [28/Jul/2017:14:26:32 +0000] "POST
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks
> HTTP/1.1" 201 676
> 192.168.10.158 - - [28/Jul/2017:14:26:33 +0000] "POST
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks
> HTTP/1.1" 201 677
> 192.168.10.158 - - [28/Jul/2017:14:26:33 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks
> HTTP/1.1" 200 1136
> 192.168.10.158 - - [28/Jul/2017:14:26:34 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2668
> 192.168.10.158 - - [28/Jul/2017:14:26:34 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2668
> 192.168.10.158 - - [28/Jul/2017:14:26:34 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks
> HTTP/1.1" 200 1136
> 192.168.10.158 - - [28/Jul/2017:14:26:36 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2668
> 192.168.10.158 - - [28/Jul/2017:14:26:36 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks
> HTTP/1.1" 200 1136
> 192.168.10.158 - - [28/Jul/2017:14:26:38 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2669
> 192.168.10.158 - - [28/Jul/2017:14:26:38 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks
> HTTP/1.1" 200 1138
> 192.168.10.158 - - [28/Jul/2017:14:26:42 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2660
> 192.168.10.158 - - [28/Jul/2017:14:26:43 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks
> HTTP/1.1" 200 1125
> 192.168.10.158 - - [28/Jul/2017:14:26:43 +0000] "POST
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/start
> HTTP/1.1" 200 616
> 192.168.10.158 - - [28/Jul/2017:14:26:44 +0000] "GET
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7 HTTP/1.1" 200
> 2804
>
> There are 3 POSTs to /disks so it seems that the culprit is indeed
> Foreman, but looking at Foreman's production.log I cannot see much more
> than this (even with logging level set to debug):
>
> 2017-07-28 16:26:20 [app] [I] Parameters:
> {"host"=>{"name"=>"foobar03", "architecture_id"=>1, "domain_id"=>9,
> "operatingsystem_id"=>7, "ptable_id"=>192, "compute_resource_id"=>5, "hos
> tgroup_id"=>34, "image_id"=>6, "build"=>true, "enabled"=>true,
> "provision_method"=>"image", "managed"=>true,
> "compute_attributes"=>{"cluster"=>"00000002-0002-0002-0002-000000000345", "c
>
> ores"=>"2", "memory"=>"4294967296", "start"=>"1",
> "volumes_attributes"=>{"0"=>{"\"size_gb"=>"20",
> "storage_domain"=>"ba2bd397-9222-424d-aecc-eb652c0169d9",
> "bootable"=>"0"}, "1"=>{"\"si
> ze_gb"=>"30", "storage_domain"=>"ba2bd397-9222-424d-aecc-eb652c0169d9",
> "bootable"=>"0"}}}, "overwrite"=>true, "host_parameters_attributes"=>[],
> "interfaces_attributes"=>[], "root_pass"
> =>"[FILTERED]"}, "apiv"=>"v2"}
>
The oVirt access log indeed shows that three disks are added to the
virtual machine. May it be that Foreman thinks that it has to explicitly
add a boot disk? Ohad, Ivan, any idea?
>
> More over, looking at
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks it
> throws a 404, the endpoint seems to be
> /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/diskattachments
> while /ovirt-engine/api/vms/47f5035a-696c-4578-ace9-b23d865c6aa7/disks
> seems to work only with API v3. Maybe I should change the base URL for
> the ovirt's API in foreman config, shouldn't I?
>
I think you don't need to change anything there. Foreman uses 'rbovirt',
and 'rbovirt' explicitly requests version 3 of the API using the
'Version: 3' header.
More information about the Users
mailing list