SELinux relabel API
by Richard W.M. Jones
[
I realized that we were discussing adding this feature, in various
private email, IRC, and this long bugzilla thread:
https://bugzilla.redhat.com/show_bug.cgi?id=1060423
That's not how we should do things. Let's discuss it on the
mailing list.
]
One thing that virt-customize/virt-sysprep/virt-builder have to do is
relabel SELinux guests.
What we do at the moment is run:
if load_policy && fixfiles restore; then
rm -f /.autorelabel
else
touch /.autorelabel
echo '%s: SELinux relabelling failed, will relabel at boot instead.'
fi
while chrooted into the guest (using the 'guestfs_sh' API).
This has a number of problems:
- It has to load the policy using 'load_policy', but this doesn't
work sometimes:
* RHEL 5 load_policy takes a parameter.
* Doesn't work if appliance kernel is significantly different from
guest kernel version, because the binary policy format changes
irregularly and is not backwards compatible.
* Requires the appliance [host] kernel to be compiled with
LSM/SELinux support.
- Touching /.autorelabel is often broken, eg. it's broken in Fedora 20
because of systemd (RHBZ#1049656).
- /etc/resolv.conf will not be relabelled if guestfs network is on,
because of resolv.conf shenanigans in libguestfs.git/daemon/command.c
- It requires running guest code, which we'd like to avoid.
What would be nice would be to have an API to just do this
relabelling. Libguestfs could change this API as required to handle
different guests.
Dan Walsh helpfully pointed out to us that we've been doing it wrong
all along :-) A much better way to relabel is to run:
setfiles /etc/selinux/targeted/contexts/files/file_contexts DIR
where 'file_contexts' is a file which contains the default labels for
files (a set of regexps), and 'DIR' is the directory at which
relabelling starts. Note that 'setfiles' would be the libguestfs
appliance binary, so no guest binary needs to be run.
A simple API could just look like this:
guestfs_selinux_relabel (g);
which would always use the 'targeted' policy from the guest, and
always start relabelling at the root. This would work fine for
virt-builder.
For Colin's requirements for Project Atomic, I suspect he will want to
be able to set the file_contexts file and the root directory, but I'll
leave him to describe what would be useful.
A couple of notes:
- I'd like to avoid baking in assumptions from the 'setfiles' command
as far as possible. libguestfs APIs last for many years and some
have caused us many years of regret (but that's our job) :-/
- Is it a good idea to tie this into inspection in some way -- for
example, inspection could provide us with the path to the current or
default SELinux policy.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
8 years, 11 months
missing btrfs subvol support
by Olaf Hering
Is btrfs subvol support failing just for me? Looks like nothing adds the
required '@/' string. virt-ls uses the first variant of the command:
><rescue> mount -vo subvol=var/spool,ro /dev/sda2 /sysroot/
[ 113.852047] BTRFS info (device sda2): disk space caching is enabled
[ 113.852869] BTRFS: has skinny extents
mount: mount(2) failed: No such file or directory
><rescue> mount -vo subvol=@var/spool,ro /dev/sda2 /sysroot/
[ 116.082642] BTRFS info (device sda2): disk space caching is enabled
[ 116.083476] BTRFS: has skinny extents
mount: mount(2) failed: No such file or directory
><rescue> mount -vo subvol=@/var/spool,ro /dev/sda2 /sysroot/
[ 123.995343] BTRFS info (device sda2): disk space caching is enabled
[ 123.996238] BTRFS: has skinny extents
mount: /dev/sda2 mounted on /sysroot.
><rescue> exit
fstab is:
UUID=d538a81f-9778-424d-96cc-e48dd2d4a323 swap swap defaults 0 0
UUID=65b72f12-eccb-4cf2-a4f4-9c4bb462456f / btrfs defaults 0 0
UUID=65b72f12-eccb-4cf2-a4f4-9c4bb462456f /var/spool btrfs subvol=@/var/spool 0 0
Olaf
9 years, 2 months
[libguestfs] conversion issue on NFS shares
by Artur Krzywdzinski
Hi
T'm trying to convert XEN virtual machine image into raw. Source file is on
NFS export and destination is also on nfs export. (both exports are mounted
on migration servers RW access). I'm getting permission denied.
I have RW access to both exports - I can create, delete objects on both
exports from migration server. But when I copy img file onto migration
server local filesystem, conversion works, from local fs to nfs export.
However when I tried to run guestfish against file located on NFS - I'm
getting the same erro - Permission denied .
[root@kvm01 export]# virt-v2v -i disk migr01.img -o local -os /tmp
[ 0.0] Opening the source -i disk migr01.img
[ 0.0] Creating an overlay to protect the source from being modified
[ 0.0] Opening the overlay
virt-v2v: error: libguestfs error: could not create appliance through
libvirt.
Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct
Original error from libvirt: internal error: process exited while
connecting to monitor: 2014-10-16T14:25:13.729270Z qemu-kvm: -drive
file=/var/tmp/v2vovl60e1a0.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2,cache=unsafe,discard=unmap:
could not open disk image /var/tmp/v2vovl60e1a0.qcow2: Could not open
backing file: Could not open '/mnt/xen01/export/migr01.img': Permission
denied
[code=1 domain=10]
If reporting bugs, run virt-v2v with debugging enabled and include the
complete output:
virt-v2v -v -x [...]
[root@kvm01 export]#
--
Artur Krzywdzinski
9 years, 6 months
[PATCH v5 REBASE 0/4] virt-resize: add support for resizing logical
by Hu Tao
Hi Rich,
This is rebase of v5 series. Meanwhile, I found a bug when shrinking
partitions, and the fix is incuded in this version (patch 2).
Regards,
Hu
changes to v4:
1. add support to resize extended partition (--resize or --expand extended partition)
2. fix the problem of deficit of 512 bytes when expanding a logical partition
(this problem can be reproduced in v4 by only expanding a logical partition, without resizing any other partitions)
3. update the test script to support logical partitions and extended partition
changes to v3:
1. merge patch 1 and patch 3 in v3
2. let mbr_part_type return 'primary' for GPT partitions
3. add test for resizing logical partitions
4. fix extending the extended partition (yet). see patch 7.
changes to v2:
1. remove p_part_num
2. remove filter_parts
3. name the function calculate_target_partitions
4. remove the code to restart guest introduced in v2
changes to v1:
1. spit the patches so it's easier to review
2. fix the parted error caused by unaligned logical partitions
3. extend the content of logical partitions
4. refactor to make logical partitions a seperate list
Hu Tao (4):
resize: add partition type LogicalPartition
resize: add support to resize logical partitions
resize: support resize extended partition
resize: test: add support for resizing extended and logical partitions
resize/resize.ml | 123 +++++++++++++++++++++++++++++++++++++++------
resize/test-virt-resize.pl | 32 ++----------
2 files changed, 112 insertions(+), 43 deletions(-)
--
1.9.3
9 years, 8 months
[PATCH 0/3] WIP readline escaping functions
by mzatko@redhat.com
From: Maros Zatko <hacxman(a)gmail.com>
Auxiliary functions for readline to support space character escaping
in filenames in future.
Escaping function is taken from fish.c (used to be parse_quoted_string)
plus its un-escaping counterpart. There are a few tests for both.
Maros Zatko (3):
fish: rl.{c,h} - escaping functions for readline
fish: basic tests for readline escaping
autotools: add fish/test
Makefile.am | 1 +
configure.ac | 1 +
fish/rl.c | 158 ++++++++++++++++++++++++++++++++++++++++++++++++
fish/rl.h | 32 ++++++++++
fish/test/Makefile.am | 39 ++++++++++++
fish/test/testquoting.c | 120 ++++++++++++++++++++++++++++++++++++
6 files changed, 351 insertions(+)
create mode 100644 fish/rl.c
create mode 100644 fish/rl.h
create mode 100644 fish/test/Makefile.am
create mode 100644 fish/test/testquoting.c
--
1.9.3
10 years
[PATCH] Fix, simplify out-of-tree build/install for bash completions
by Hilko Bengen
---
bash/Makefile.am | 54 +++++++++++++++---------------------------------------
1 file changed, 15 insertions(+), 39 deletions(-)
diff --git a/bash/Makefile.am b/bash/Makefile.am
index 10f0861..780da64 100644
--- a/bash/Makefile.am
+++ b/bash/Makefile.am
@@ -21,6 +21,10 @@ scripts = \
guestfish \
guestmount \
virt-alignment-scan \
+ virt-rescue \
+ virt-resize
+
+symlinks = \
virt-builder \
virt-cat \
virt-df \
@@ -30,53 +34,21 @@ scripts = \
virt-inspector \
virt-log \
virt-ls \
- virt-rescue \
- virt-resize \
virt-sparsify \
virt-sysprep
# Note: Don't distribute the symbolic links, only the real files.
EXTRA_DIST = \
README \
- guestfish \
- guestmount \
- virt-alignment-scan \
- virt-rescue \
- virt-resize
+ $(scripts)
# Some of the scripts are simply symbolic links.
-virt-cat:
- rm -f $@
- $(LN_S) virt-alignment-scan $@
-virt-df:
- rm -f $@
- $(LN_S) virt-alignment-scan $@
-virt-edit:
- rm -f $@
- $(LN_S) virt-alignment-scan $@
-virt-filesystems:
- rm -f $@
- $(LN_S) virt-alignment-scan $@
-virt-format:
- rm -f $@
- $(LN_S) virt-alignment-scan $@
-virt-inspector:
- rm -f $@
- $(LN_S) virt-alignment-scan $@
-virt-log:
- rm -f $@
- $(LN_S) virt-alignment-scan $@
-virt-ls:
- rm -f $@
- $(LN_S) virt-alignment-scan $@
-virt-sysprep:
+virt-cat virt-df virt-edit virt-filesystems virt-format virt-inspector \
+virt-log virt-ls virt-sysprep:
rm -f $@
$(LN_S) virt-alignment-scan $@
-virt-builder:
- rm -f $@
- $(LN_S) virt-resize $@
-virt-sparsify:
+virt-builder virt-sparsify:
rm -f $@
$(LN_S) virt-resize $@
@@ -87,10 +59,14 @@ if HAVE_BASH_COMPLETION
bashcompletiondir = $(BASH_COMPLETIONS_DIR)
#bashcompletion_DATA = $(scripts)
-all-local: $(scripts)
+all-local: $(scripts) $(symlinks)
+ test $(srcdir) != $(builddir) && cd $(srcdir) && cp $(scripts) $(abs_builddir)/
-install-data-local: $(scripts)
+install-data-local:
$(mkdir_p) $(DESTDIR)$(bashcompletiondir)
- cp -d $(scripts) $(DESTDIR)$(bashcompletiondir)
+ cp -d $(scripts) $(symlinks) $(DESTDIR)$(bashcompletiondir)
+
+clean-local:
+ test $(srcdir) != $(builddir) && rm -f $(symlinks) $(scripts)
endif
--
2.1.1
10 years
[PATCH] fish: fix dir completion on filesystems w/o dirent.d_type (RHBZ#1153844).
by Pino Toscano
On filesystems whose dirent.d_type is DT_UNKNOWN or some unknown value,
manually check whether an entry is a directory, thus completing in the
proper way.
---
fish/destpaths.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fish/destpaths.c b/fish/destpaths.c
index f224106..df1ec00 100644
--- a/fish/destpaths.c
+++ b/fish/destpaths.c
@@ -191,7 +191,13 @@ complete_dest_paths_generator (const char *text, int state)
else {
words = w;
words[nr_words].name = p;
- words[nr_words].is_dir = dirents->val[i].ftyp == 'd';
+ if (dirents->val[i].ftyp == 'u'
+ || dirents->val[i].ftyp == '?') {
+ int is_dir = guestfs_is_dir_opts (g, words[nr_words].name,
+ GUESTFS_IS_DIR_OPTS_FOLLOWSYMLINKS, 1, -1);
+ words[nr_words].is_dir = is_dir;
+ } else
+ words[nr_words].is_dir = dirents->val[i].ftyp == 'd';
nr_words++;
}
}
--
1.9.3
10 years
[PATCH] builder: move the gpgkey_type type from Sigchecker to Utils
by Pino Toscano
No functional change, just code motion.
---
builder/builder.ml | 6 +++---
builder/list_entries.ml | 12 ++++++------
builder/list_entries.mli | 2 +-
builder/sigchecker.ml | 5 -----
builder/sigchecker.mli | 7 +------
builder/utils.ml | 5 +++++
6 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/builder/builder.ml b/builder/builder.ml
index d7d8fb2..9a77a23 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -154,13 +154,13 @@ let main () =
fun { Sources.uri = uri; Sources.gpgkey = gpgkey; Sources.proxy = proxy } ->
let gpgkey =
match gpgkey with
- | None -> Sigchecker.No_Key
- | Some key -> Sigchecker.KeyFile key in
+ | None -> Utils.No_Key
+ | Some key -> Utils.KeyFile key in
uri, gpgkey, proxy
) repos in
let sources = List.map (
fun (source, fingerprint) ->
- source, Sigchecker.Fingerprint fingerprint, Downloader.SystemProxy
+ source, Utils.Fingerprint fingerprint, Downloader.SystemProxy
) sources in
let sources = List.append repos sources in
let index : Index_parser.index =
diff --git a/builder/list_entries.ml b/builder/list_entries.ml
index 2727c9f..2f8107f 100644
--- a/builder/list_entries.ml
+++ b/builder/list_entries.ml
@@ -50,10 +50,10 @@ and list_entries_long ~sources index =
fun (source, key, proxy) ->
printf (f_"Source URI: %s\n") source;
(match key with
- | Sigchecker.No_Key -> ()
- | Sigchecker.Fingerprint fp ->
+ | Utils.No_Key -> ()
+ | Utils.Fingerprint fp ->
printf (f_"Fingerprint: %s\n") fp;
- | Sigchecker.KeyFile kf ->
+ | Utils.KeyFile kf ->
printf (f_"Key: %s\n") kf;
);
printf "\n"
@@ -103,10 +103,10 @@ and list_entries_json ~sources index =
let item = [ "uri", JSON.String source ] in
let item =
match key with
- | Sigchecker.No_Key -> item
- | Sigchecker.Fingerprint fp ->
+ | Utils.No_Key -> item
+ | Utils.Fingerprint fp ->
("fingerprint", JSON.String fp) :: item
- | Sigchecker.KeyFile kf ->
+ | Utils.KeyFile kf ->
("key", JSON.String kf) :: item in
JSON.Dict item
) sources in
diff --git a/builder/list_entries.mli b/builder/list_entries.mli
index ce012c4..520eb33 100644
--- a/builder/list_entries.mli
+++ b/builder/list_entries.mli
@@ -16,4 +16,4 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
-val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:(string * Sigchecker.gpgkey_type * Downloader.proxy_mode) list -> Index_parser.index -> unit
+val list_entries : list_format:([ `Short | `Long | `Json ]) -> sources:(string * Utils.gpgkey_type * Downloader.proxy_mode) list -> Index_parser.index -> unit
diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml
index 489da28..0c292fb 100644
--- a/builder/sigchecker.ml
+++ b/builder/sigchecker.ml
@@ -24,11 +24,6 @@ open Utils
open Printf
open Unix
-type gpgkey_type =
- | No_Key
- | Fingerprint of string
- | KeyFile of string
-
type t = {
verbose : bool;
gpg : string;
diff --git a/builder/sigchecker.mli b/builder/sigchecker.mli
index 5b1885b..4eb7a88 100644
--- a/builder/sigchecker.mli
+++ b/builder/sigchecker.mli
@@ -18,12 +18,7 @@
type t
-type gpgkey_type =
- | No_Key
- | Fingerprint of string
- | KeyFile of string
-
-val create : verbose:bool -> gpg:string -> gpgkey:gpgkey_type -> check_signature:bool -> t
+val create : verbose:bool -> gpg:string -> gpgkey:Utils.gpgkey_type -> check_signature:bool -> t
val verify : t -> string -> unit
(** Verify the file is signed (if check_signature is true). *)
diff --git a/builder/utils.ml b/builder/utils.ml
index f4f290d..8962636 100644
--- a/builder/utils.ml
+++ b/builder/utils.ml
@@ -22,6 +22,11 @@ open Printf
open Common_utils
+type gpgkey_type =
+ | No_Key
+ | Fingerprint of string
+ | KeyFile of string
+
let prog = Filename.basename Sys.executable_name
let error ?exit_code fs = error ~prog ?exit_code fs
let warning fs = warning ~prog fs
--
1.9.3
10 years
[PATCH] v2v: -o libvirt: Get the <features/> right in the output XML (RHBZ#1159258).
by Richard W.M. Jones
Implement what old virt-v2v did (from
lib/Sys/VirtConvert/Connection/LibVirtTarget.pm)
Thanks: Tingting Zheng, Matthew Booth
---
v2v/output_libvirt.ml | 118 ++++++++++++++++++++++++++++++++++++++++++++++---
v2v/output_libvirt.mli | 2 +-
v2v/output_local.ml | 13 +++++-
v2v/test-v2v-i-ova.xml | 5 ++-
4 files changed, 128 insertions(+), 10 deletions(-)
diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index 305ce35..7fdc0d9 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -25,6 +25,42 @@ open Types
open Utils
open DOM
+module StringSet = Set.Make (String)
+
+let string_set_of_list =
+ List.fold_left (fun set x -> StringSet.add x set) StringSet.empty
+
+let target_features_of_capabilities_doc doc arch =
+ let xpathctx = Xml.xpath_new_context doc in
+ let expr =
+ (* NB: Pay attention to the square brackets. This returns the
+ * <guest> nodes!
+ *)
+ sprintf "/capabilities/guest[arch[@name='%s']/domain/@type='kvm']" arch in
+ let obj = Xml.xpath_eval_expression xpathctx expr in
+
+ if Xml.xpathobj_nr_nodes obj < 1 then (
+ (* Old virt-v2v used to die here, but that seems unfair since the
+ * user has gone through conversion before we reach here.
+ *)
+ warning (f_"the target hypervisor does not support a %s KVM guest") arch;
+ []
+ ) else (
+ let node (* first matching <guest> *) = Xml.xpathobj_node doc obj 0 in
+ Xml.xpathctx_set_current_context xpathctx node;
+
+ (* Get guest/features/* nodes. *)
+ let obj = Xml.xpath_eval_expression xpathctx "features/*" in
+
+ let features = ref [] in
+ for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
+ let feature_node = Xml.xpathobj_node doc obj i in
+ let feature_name = Xml.node_name feature_node in
+ features := feature_name :: !features
+ done;
+ !features
+ )
+
let append_child child = function
| PCData _ | Comment _ -> assert false
| Element e -> e.e_children <- e.e_children @ [child]
@@ -33,15 +69,48 @@ let append_attr attr = function
| PCData _ | Comment _ -> assert false
| Element e -> e.e_attrs <- e.e_attrs @ [attr]
-let create_libvirt_xml ?pool source targets guestcaps =
+let create_libvirt_xml ?pool source targets guestcaps target_features =
let memory_k = source.s_memory /^ 1024L in
+ (* We have the machine features of the guest when it was on the
+ * source hypervisor (source.s_features). We have the acpi flag
+ * which tells us whether acpi is required by this guest
+ * (guestcaps.gcaps_acpi). And we have the set of hypervisor
+ * features supported by the target (target_features). Combine all
+ * this into a final list of features.
+ *)
+ let features = string_set_of_list source.s_features in
+ let target_features = string_set_of_list target_features in
+
+ (* If the guest supports ACPI, add it to the output XML. Conversely
+ * if the guest does not support ACPI, then we must drop it.
+ * (RHBZ#1159258)
+ *)
let features =
- List.filter (
- fun feature ->
- (* drop acpi if the guest doesn't support it *)
- feature <> "acpi" || guestcaps.gcaps_acpi
- ) source.s_features in
+ if guestcaps.gcaps_acpi then
+ StringSet.add "acpi" features
+ else
+ StringSet.remove "acpi" features in
+
+ (* Make sure we don't add any features which are not supported by
+ * the target hypervisor.
+ *)
+ let features = StringSet.inter(*section*) features target_features in
+
+ (* But if the target supports apic or pae then we should add them
+ * anyway (old virt-v2v did this).
+ *)
+ let features =
+ let features_force = ["apic"; "pae"] in
+ List.fold_left (
+ fun set force ->
+ if StringSet.mem force target_features then
+ StringSet.add "apic" set
+ else
+ set
+ ) features features_force in
+
+ let features = List.sort compare (StringSet.elements features) in
let disks =
let block_prefix =
@@ -202,12 +271,36 @@ let create_libvirt_xml ?pool source targets guestcaps =
class output_libvirt verbose oc output_pool = object
inherit output verbose
+ val mutable capabilities_doc = None
+
method as_options =
match oc with
| None -> sprintf "-o libvirt -os %s" output_pool
| Some uri -> sprintf "-o libvirt -oc %s -os %s" uri output_pool
method prepare_targets source targets =
+ (* Get the capabilities from libvirt. *)
+ let cmd =
+ match oc with
+ | None -> "virsh capabilities"
+ | Some uri -> sprintf "virsh -c %s capabilities" (quote uri) in
+ if verbose then printf "%s\n%!" cmd;
+ let xml = external_command ~prog cmd in
+ let xml = String.concat "\n" xml in
+
+ if verbose then printf "libvirt capabilities XML:\n%s\n%!" xml;
+
+ (* This just checks that the capabilities XML is well-formed,
+ * early so that we catch parsing errors before conversion.
+ *)
+ let doc = Xml.parse_memory xml in
+
+ (* Stash the capabilities XML, since we cannot get the bits we
+ * need from it until we know the guest architecture, which happens
+ * after conversion.
+ *)
+ capabilities_doc <- Some doc;
+
(* Connect to output libvirt instance and check that the pool exists
* and dump out its XML.
*)
@@ -250,11 +343,22 @@ class output_libvirt verbose oc output_pool = object
| Some uri ->
sprintf "virsh -c %s pool-refresh %s"
(quote uri) (quote output_pool) in
+ if verbose then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then
warning (f_"could not refresh libvirt pool %s") output_pool;
+ (* Parse the capabilities XML in order to get the supported features. *)
+ let doc =
+ match capabilities_doc with
+ | None -> assert false
+ | Some doc -> doc in
+ let target_features =
+ target_features_of_capabilities_doc doc guestcaps.gcaps_arch in
+
(* Create the metadata. *)
- let doc = create_libvirt_xml ~pool:output_pool source targets guestcaps in
+ let doc =
+ create_libvirt_xml ~pool:output_pool source targets
+ guestcaps target_features in
let tmpfile, chan = Filename.open_temp_file "v2vlibvirt" ".xml" in
DOM.doc_to_chan chan doc;
diff --git a/v2v/output_libvirt.mli b/v2v/output_libvirt.mli
index 25d4690..da41956 100644
--- a/v2v/output_libvirt.mli
+++ b/v2v/output_libvirt.mli
@@ -23,5 +23,5 @@ val output_libvirt : bool -> string option -> string -> Types.output
{!Types.output} object specialized for writing output to
libvirt. *)
-val create_libvirt_xml : ?pool:string -> Types.source -> Types.target list -> Types.guestcaps -> DOM.doc
+val create_libvirt_xml : ?pool:string -> Types.source -> Types.target list -> Types.guestcaps -> string list -> DOM.doc
(** This is called from {!Output_local} to generate the libvirt XML. *)
diff --git a/v2v/output_local.ml b/v2v/output_local.ml
index db36f0e..ffcfad0 100644
--- a/v2v/output_local.ml
+++ b/v2v/output_local.ml
@@ -37,7 +37,18 @@ class output_local verbose dir = object
) targets
method create_metadata source targets guestcaps _ =
- let doc = Output_libvirt.create_libvirt_xml source targets guestcaps in
+ (* We don't know what target features the hypervisor supports, but
+ * assume a common set that libvirt supports.
+ *)
+ let target_features =
+ match guestcaps.gcaps_arch with
+ | "i686" -> [ "acpi"; "apic"; "pae" ]
+ | "x86_64" -> [ "acpi"; "apic" ]
+ | _ -> [] in
+
+ let doc =
+ Output_libvirt.create_libvirt_xml source targets
+ guestcaps target_features in
let name = source.s_name in
let file = dir // name ^ ".xml" in
diff --git a/v2v/test-v2v-i-ova.xml b/v2v/test-v2v-i-ova.xml
index ff83285..2d611f9 100644
--- a/v2v/test-v2v-i-ova.xml
+++ b/v2v/test-v2v-i-ova.xml
@@ -7,7 +7,10 @@
<os>
<type arch='x86_64'>hvm</type>
</os>
- <features/>
+ <features>
+ <acpi/>
+ <apic/>
+ </features>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
--
2.0.4
10 years