<?php include "libvirt.class"; $libvirt = new libvirt(); $vmname = "133050024CS101"; echo $vmname; $ip = "10.129.12.26"; $conn = $libvirt->connect_libvirt_remote($ip); echo libvirt_connect_get_hostname($conn); // $output=$libvirt->domain_shutdown($vmname); // if(!$output) echo libvirt_get_last_error(); // else echo "<pre>$output</pre>"; // echo $libvirt->vncport($vmname); ?>
function get_hostname() { return libvirt_connect_get_hostname($this->conn); }
/** * determine if virt host is already connected * * @global resource $host_conn libvirt host connection resource * * @param string $host_name name of virt host * @param string $host_domain domain of virt host * * @return bool host is connected? */ function ace_kvm_host_is_connected($host_name, $host_domain) { global $host_conn; if (is_resource($host_conn)) { $connected_host_name = libvirt_connect_get_hostname($host_conn); ace_kvm_log_last_error(); $fqdn = $host_name . '.' . $host_domain; if ($connected_host_name == $fqdn) { return TRUE; } else { return FALSE; } } else { return FALSE; } }