[ovirt-users] Discovering oVirt/RHEV Engine from a VM guest

Shawn Starr shawn.starr at rogers.com
Thu Sep 25 04:41:49 UTC 2014


Hello everyone,

I wonder if you can tell me how I can do this. I'm creating a VM image that 
needs to discover it's hostname, IP address information so I can configure 
/etc/sysconfig/network, /etc/sysconfig/network-scripts/ifcfg-[interface] and 
other things.

If I know the oVirt/RHEV engine to connect to, I can get this information 
successfully.

However, when creating a dummy 'gold' VM image and having oVirt clone it. I 
have no 'key' to tell me what engine to connect to, other than trying them all 
and hoping for best.

I've written some code with the oVirt SDK that needs to know the URL:

from ovirtsdk.api import API
import platform
import yaml
import sys

   api =  API(url="https://HOW_TO_DISCOVER_THIS/api",
          username="USER at internal",
          password="PASSWORD",
          insecure=True)

...

Is there a way to know the engine to connect to when VM has booted up?

I tried poking around ovirt/rhev-agent and noticed this:

in /usr/share/rhev-agent/vdsAgentLogic.py:
        self.vio.write('host-name', { 'name' : self.dr.getMachineName() })

It *looks* like I could get the host name from what oVirt has configured w/o 
knowing the engine to connect to? But I cannot open /dev/virtio-
ports/com.redhat.rhevm.vdsm (since rhev-agentd) has it opened 'too many files 
open' error.

When using OpenNebula in past, they mounted a ISO CD image that contained the 
VM's metadata you could read in as configuration and having also used AWS EC2 
You can connect to localhost to the VM itself to get metadata to get this sort 
of information.

I really appreciate any help, if there's an easy way.

Thanks,
Shawn.



More information about the Users mailing list