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='https://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 is ignored in libguestfs &ge; 1.48.

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.

If present, the value of logical_block_size attribute of &lt;blockio/&gt; tag in libvirt XML will be passed as blocksize parameter to guestfs_session_add_drive_opts.

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