Files
libguestfs/v2v/domainxml.mli
Richard W.M. Jones ecbf093850 v2v: Allow libvirt >= 2.1.0 to be used for Xen and vCenter conversions.
Libvirt >= 2.1.0 now allows you to open files which have a "json:"
QEMU pseudo-URL as backingfile, whereas previously it would fail hard
in this case (RHBZ#1134878).

When virt-v2v performs conversions from Xen (over SSH) or vCenter
(over HTTPS) it uses these pseudo-URLs as backingfiles.  We had to
tell people to use LIBGUESTFS_BACKEND=direct to avoid libvirt in this
situation.

This commit narrows the check so it will now only print the error if
libvirt < 2.1.0 and LIBGUESTFS_BACKEND=direct is not set.  Also the
error is modified to tell users they can either upgrade libvirt or set
LIBGUESTFS_BACKEND=direct to work around the problem.

Note there is not an easy way apart from checking the version number
of libvirt to tell if the json pseudo-URL is supported.

As a side-effect, this commit also prints the libvirt version number
in debugging output when virt-v2v starts up, which is sometimes useful
information for narrowing down bugs (it is in fact already printed by
libguestfs, so this is duplicate information, but it's a bit easier to
find when it's at the top of the debug).

Thanks: Peter Krempa.
2016-08-25 09:02:01 +01:00

56 lines
2.5 KiB
OCaml

(* virt-v2v
* Copyright (C) 2009-2016 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
(** This module implements various [virsh]-like commands, but with
non-broken authentication handling.
If you do [virsh dumpxml foo] and if the libvirt source (eg. ESX)
requires an interactive password, then virsh unhelpfully sends the
password prompt to stdout, which is the same place we would be
reading the XML from. This file works around this brokenness. *)
val dumpxml : ?password:string -> ?conn:string -> string -> string
(** [dumpxml ?password ?conn dom] returns the libvirt XML of domain [dom].
The optional [?conn] parameter is the libvirt connection URI.
[dom] may be a guest name or UUID. *)
val pool_dumpxml : ?conn:string -> string -> string
(** [pool_dumpxml ?conn pool] returns the libvirt XML of pool [pool].
The optional [?conn] parameter is the libvirt connection URI.
[pool] may be a pool name or UUID. *)
val vol_dumpxml : ?conn:string -> string -> string -> string
(** [vol_dumpxml ?conn pool vol] returns the libvirt XML of volume [vol],
which is part of the pool [pool].
The optional [?conn] parameter is the libvirt connection URI.
[pool] may be a pool name or UUID. *)
val capabilities : ?conn:string -> unit -> string
(** [capabilities ?conn ()] returns the libvirt capabilities XML.
The optional [?conn] parameter is the libvirt connection URI. *)
val domain_exists : ?conn:string -> string -> bool
(** [domain_exists ?conn dom] returns a boolean indicating if the
the libvirt XML domain [dom] exists.
The optional [?conn] parameter is the libvirt connection URI.
[dom] may be a guest name, but not a UUID. *)
val libvirt_get_version : unit -> int * int * int
(** [libvirt_get_version] returns the triple [(major, minor, release)]
version number of the libvirt library that we are linked against. *)