[ovirt-users] oVirt and Foreman

Juan Hernández jhernand at redhat.com
Tue Aug 1 16:44:35 UTC 2017


On 07/28/2017 06:03 PM, Davide Ferrari wrote:
> 
> 
> On 28/07/17 17:46, Juan Hernández wrote:
>>
>> 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?
>>
> 
> I've explicitly added the template id to the hammer command line and 
> still adds 3 disks but at least now two of them respect the size I'm 
> passing through Hammer. But it still sets a random disk as the bootable 
> one and I cannot find a way to force to use the disk already present in 
> the oVirt template as the bootable one
> Is there a way in oVirt to log the JSONs passed in the various POST 
> requests?
> 

There is no such mechanism available by default You can get some more 
information about the requests and responses using the WildFly request 
dumping filter, but it won't give you the request or response bodies. If 
you want to do that first you need to go to the oVirt engine machine and 
start the "jboss-cli.sh" tool:

   # /usr/share/ovirt-engine-wildfly/bin/jboss-cli.sh \
   --controller=localhost:8706 \
   --user=admin at internal \
   --connect

That will as for the password of the "admin at internal" user, and then it 
should display you a prompt like this:

   [standalone at localhost:8706 /]

In that prompt you can type any WildFly management command. For more 
information see here:

   https://docs.jboss.org/author/display/WFLY/Command+Line+Interface

In this particular case you can first add the request dumping filter to 
the configuration, typing the following command:

   /subsystem=undertow/configuration=filter/custom-filter=myfilter:\
  add(class-name=io.undertow.server.handlers.RequestDumpingHandler,\
   module=io.undertow.core)

Then you can enable that filter for the /ovirt-engine/api/* URL:

 
/subsystem=undertow/server=default-server/host=default-host/filter-ref=myfilter:add(predicate="regex['/ovirt-engine/api.*']")

Note again that this won't give you the request and response bodies, so 
it may not be worth.

Another thing you may want to try, in the Foreman side, is to modify the 
"rbovirt" gem so it writes the request bodies to some place. For 
example, you can locate the "rbovirt.rb" file in your Foreman 
installation, and then, after this line:

   https://github.com/abenari/rbovirt/blob/v0.1.3/lib/rbovirt.rb#L131

Add something that writes the request body to a file, for example:

   open('/tmp/mylog', 'a') { |f| f.write(body) }

Then you will probably need to restart Foreman.

Remember to restore the "rbovirt.rb" file when you finish.

>>>
>>> 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. 
> 
> Well, I've added it anyway and it didn't break anything :)
> 
> 


More information about the Users mailing list