首页 > 代码库 > libvirt C-API

libvirt C-API

1,warming-up

Specifying URIs to libVirt;
name parameter to virConnectOpen or
          virConnectOpenReadOnly
virConnectPtr conn = virConnectOpenReadOnly ("test:///default");

/etc/libvirt/libvirt.conf

uri_aliases = [
    "ruiyHail=qemu+ssh://root@ruiy.hail.cc/system",
    "sleet=qemu+ssh://ruiy@sleet.cc/system",
]

uri_default = "qemu:///system"

A URL aliases should be a string made up;
VIR_CONNECT_NO_ALIASES parameter virConnectOpenAuth

if the URI passed to virConnectOpen* is NULL,libvirt will use following logic to determine what URI to use;
environment variabe LIBVIRT_DEFAULT_URI
client configuration file uri_default parameter
probe

specifying URIs to virsh,virt-manager and virt-install
In virsh use the -c or --connect options
virsh -c test:///default list
virsh_default_connect_uri
libvirt_default_uri
deprecated
interactive virsh shell;

Transport Layer Security
TLS
CA certificate:    /etc/pki/CA/caert.pem
Server certificate:    /etc/pki/libvirt/servercert.pem
Server private key:    /etc/pki/libvirt/private/serverkey.pem
pki infrastructure public keys
pid process idenntified
offer rich syntax many features
pass a NULL pointer to virConnectOpen*
/etc/xen/xend-config.sxp
(xend-unix-server yes)
(xend-http-server yes)
definitely not recommended for production use

libvirt C-API