add_libvirt_dom


Description:

[ Version ( since = "1.29.14" ) ]
public int32 add_libvirt_dom (void* dom, AddLibvirtDom? optargs) throws Error

add the disk(s) from a libvirt domain

This function adds the disk(s) attached to the libvirt domain dom. It works by requesting the domain XML from libvirt, parsing it for disks, and calling guestfs_session_add_drive_opts on each one.

In the C API we declare "void *dom", but really it has type "virDomainPtr dom". This is so we don't need <libvirt.h>.

The number of disks added is returned. This operation is atomic: if an error is returned, then no disks are added.

This function does some minimal checks to make sure the libvirt domain is not running (unless readonly is true). In a future version we will try to acquire the libvirt lock on each disk.

Disks must be accessible locally. This often means that adding disks from a remote libvirt connection (see <ulink url='http://libvirt.org/remote.html'> http://libvirt.org/remote.html </ulink>) will fail unless those disks are accessible via the same device path locally too.

The optional live flag controls whether this call will try to connect to a running virtual machine guestfsd process if it sees a suitable &lt;channel&gt; element in the libvirt XML definition. The default (if the flag is omitted) is never to try. See "ATTACHING TO RUNNING DAEMONS" in guestfs(3) for more information.

The optional readonlydisk parameter controls what we do for disks which are marked &lt;readonly/&gt; in the libvirt XML. See add_domain for possible values.

The other optional parameters are passed directly through to guestfs_session_add_drive_opts.

Parameters:

this

A GuestfsSession object

dom

pointer (not implemented in gobject bindings)

optargs

a GuestfsAddLibvirtDom containing optional arguments

Returns:

the returned value, or -1 on error