1. Go to this page and download the library: Download sircamp/xenapi library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sircamp / xenapi example snippets
"sircamp/xenapi": "2.1"
use Sircamp\Xenapi\Xen as Xen;
$ip = "123.123.123.123";
$user = "username";
$password = "password";
$xen = new Xen($ip,$user,$password); //OK now you have an open connection to Hypervisor
$pause = true; // start VM in pause status , dafault is false
$force = true; // force the boot of VM, default is true
$vm->start($pause, $force);
$host // this is a XenHost object istance or a string istance
$hostRef = $host;
$pause = true; // start VM in pause status , dafault is false
$force = true; // force the boot of VM, default is true
$vm->startOn($hostRef,$pause, $force);
$vm->cleanShutdown();
$vm->hardShutdown();
$vm->cleanShutdown();
$vm->hardShutdown();
$vm->suspend();
$vm->resume();
$host // this is a XenHost object istance or a string istance
$hostRef = $host;
$vm->resumeOn($hostRef);
$vm->pause();
$vm->unpause();
$name = "new_cloned_vm"; // name of cloned vm
$vm->cleanShudown(); // stop vm
$vm->clonevm($name);
$vm->getPowerState();
$vm->powerStateReset();
$vm->getUUID();
$vm->getConsoles()
$vm->getConsoleUUID($console)
$vm->getGuestMetrics()
$vm->getMetrics()
$vm->getStats()
$vm->getDiskSpace()
$format = "GB";
$vm->getDiskSpace($format);
$vm->getName()
$vm->getAll()
$optionsMap = array(
'option1' => "option first",
'option2' => "option second"
)
$host // this is a XenHost object istance or a string istance
$hostRef = $host;
$vm->poolMigrate($refHost, $optionsMap);