[ovirt-devel] cloud-init metadata service

Juan Hernández jhernand at redhat.com
Wed Mar 1 16:00:20 UTC 2017


On 03/01/2017 04:53 PM, Marc Young wrote:
> What feels hacky is that I have so little information about the VM i'm
> running from within that I'd have a hard time crawling the API enough to
> know the information I got was about the VM I'm testing against. Per my
> later email the ID in /var/lib/cloud/data/instance-id is not the same
> that I'd need to hit the REST API to describe
> 

I'd suggest you create the virtual machines assigning them a BIOS serial
number that helps you find them via the API. Easiest is to create them
so that the BIOS serial number is the id of the VM in ovirt. You have an
exmaple of how to set the serial number policy here:


https://github.com/oVirt/ovirt-engine-sdk-ruby/blob/master/sdk/examples/set_vm_serial_number.rb

In your case you probably want to do this:

  vm_service.update(
    serial_number: {
      policy: OvirtSDK4::SerialNumberPolicy::VM
    }
  )

> On Wed, Mar 1, 2017 at 9:45 AM, Yaniv Kaul <ykaul at redhat.com
> <mailto:ykaul at redhat.com>> wrote:
> 
> 
> 
>     On Wed, Mar 1, 2017 at 4:53 PM Marc Young <3vilpenguin at gmail.com
>     <mailto:3vilpenguin at gmail.com>> wrote:
> 
>         Ive looked through what documentation I can find and i only come
>         up on bug reports from years ago, but: is there anyway to get
>         metadata about a oVirt server metadata from the context of a VM
>         ? cloud-init supports a metadata service that sits
>         on 169.254.169.254 to retrieve info like instance-id etc. This
>         is very useful in AWS which I'm familiar with.
> 
> 
>     We support cloud-init via config drive, not over the network.
>      
> 
> 
>         My context is that I'd like to run some assertions against a VM
>         and the test framework I'm using runs all assertions from within
>         the VM itself. So If i wanted to assert that the host running my
>         VM is "x.foo.com <http://x.foo.com>" I'd have to be able to
>         retrieve that from within the VM. I can do that via the REST API
>         but that requires me to get a REST user/pass inside the vm and
>         feels hacky. The common way of doing this at openstack/aws is to
>         curl the metadata service which replies with information only
>         relevant to the machine asking.
> 
> 
>     Feels OK to me - doesn't sound too hacky to me.
>     You can do it via Ansible, but still need creds.
>     I don't remember if anything in the VM BIOS (dmidecode) will help
>     you there - I think not.
>     Y.
>      
> 
>         _______________________________________________
>         Devel mailing list
>         Devel at ovirt.org <mailto:Devel at ovirt.org>
>         http://lists.ovirt.org/mailman/listinfo/devel
>         <http://lists.ovirt.org/mailman/listinfo/devel>
> 
> 
> 
> 
> _______________________________________________
> Devel mailing list
> Devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/devel
> 



More information about the Devel mailing list