function domain_nic_remove($domain, $mac)
 {
     $dom = $this->get_domain_object($domain);
     $tmp = libvirt_domain_nic_remove($dom, $mac);
     return $tmp ? $tmp : $this->_set_last_error();
 }
示例#2
0
/**
 * detach a NIC device from a virtual machine on the virt host
 *
 * @todo FIX THIS so we can use it instead of VIRSH
 *
 * @global  resource $host_conn          libvirt connection
 *
 * @param   string   $vm_virt_id         virt_id of the vm
 * @param   string   $vm_nic_mac_address mac address of the NIC
 *
 * @return  bool                on success
 */
function ace_kvm_vm_detach_nic($vm_virt_id, $vm_nic_mac_address)
{
    global $host_conn;
    $vm_res = libvirt_domain_lookup_by_name($host_conn, $vm_virt_id);
    ace_kvm_log_last_error();
    $flags = libvirt_domain_is_active($vm_res) ? 3 : 2;
    ace_kvm_log_last_error();
    $new_vm_res = libvirt_domain_nic_remove($vm_res, $vm_nic_mac_address, $flags);
    ace_kvm_log_last_error();
    return is_resource($new_vm_res) ? TRUE : FALSE;
}