* The above will guarantee that you'll always get the correct data,
 * regardless of any changes in the aliasing that might happen if
 * the view is modified.
 */
?>
<i class="fa fa-link"></i>
<?php 
print l($row->node_title, 'node/' . $row->nid);
?>

<?php 
$vm_uuid = xs_get_vm_uuid_by_node($row->nid);
try {
    $xs_vm = new XsVm($vm_uuid);
} catch (Exception $e) {
    xs_log($e);
    return;
}
if (empty($xs_vm)) {
    return;
}
$vm = $xs_vm->getData();
$disk_size = $xs_vm->getDiskSpace($vm['VBDs']);
$disk_size = $disk_size / 1024 / 1024 / 1024;
$vm_metrics = $xs_vm->getMetrics();
$vm_cpus = $vm_metrics['VCPUs_number'];
// Memory in GB.
$memory = $vm_metrics['memory_actual'] / 1024 / 1024 / 1024;
$memory = $memory > 1 ? (int) ceil($memory) : $memory;
if ($xs_vm->getStatus() == 'Running') {
    $time_delta = REQUEST_TIME - $vm_metrics['start_time']->timestamp;
Example #2
0
File: XsApi.php Project: ivrh/xs
 /**
  * Loads pool master host object via XAPI.
  *
  * @param array $pool
  *   Pool object loaded via XAPI.
  *
  * @return array
  *   Pool master host object.
  */
 private function getPoolMaster($pool)
 {
     if (empty($pool['master'])) {
         return FALSE;
     }
     $master =& drupal_static(__FUNCTION__ . $pool['uuid']);
     if (!empty($master)) {
         return $master;
     }
     // Otherwise load master server.
     try {
         $master = $this->xsApi->host_get_record($pool['master']);
     } catch (Exception $e) {
         xs_log($e);
     }
     return $master;
 }
Example #3
0
File: XsVm.php Project: ivrh/xs
 /**
  * Creates VM snapshot.
  *
  * @param string $title
  *   Snapshot title.
  */
 public function createSnapshot($title)
 {
     $this->setRef();
     try {
         $this->xsApi->VM_snapshot($this->ref, $title);
     } catch (Exception $e) {
         xs_log($e);
     }
 }
Example #4
0
 /**
  * Gets VBD by VBD reference.
  *
  * @param string $vbd_ref
  *   VBD reference.
  *
  * @return array
  *   VBD array.
  */
 public function getVbd($vbd_ref)
 {
     try {
         $vbd = $this->xsApi->VBD_get_record($vbd_ref);
     } catch (Exception $e) {
         xs_log($e);
     }
     return $vbd;
 }