K
K
Kirill Parasotchenko2014-06-14 11:41:30
Xen
Kirill Parasotchenko, 2014-06-14 11:41:30

How can an XCP virtual machine get information about itself by querying XAPI?

Hello!
If someone has experience with PHP-xenapi , please help me figure it out. I have a server with Xen Cloud Platform 1.6. The XCP system has a virtual machine that makes requests to XAPI.
How can this machine get its name-label and other information about itself by accessing XAPI?
Here is the list of APIs
. The main condition is that the machine does not know its uuid or its name.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill Parasotchenko, 2014-06-14
@Taiyonoryoshiy

You will have to write your own answer. The solution is not the best, but it works.

$xapi = new XenApi($uri, $login, $password);
$vifs = $xapi->VIF_get_all();
foreach($vifs as $value){
    $vif = $xapi->VIF_get_record($value);
    if($vif['MAC'] === $mac){
        $selfVM = $vif['VM'];
    }
}

where $mac is the MAC address of the desired machine;
$selfVM - pointer to the desired machine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question