|
|
ffd6ed |
From 1f743267838b68dfade8451b5610925c16237457 Mon Sep 17 00:00:00 2001
|
|
|
ffd6ed |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
ffd6ed |
Date: Mon, 20 Apr 2015 17:35:44 +0100
|
|
|
ffd6ed |
Subject: [PATCH] v2v: Pass sound card information from the source to the
|
|
|
ffd6ed |
target (RHBZ#1176493).
|
|
|
ffd6ed |
|
|
|
ffd6ed |
Collect sound card information from the source, and where possible,
|
|
|
ffd6ed |
create a compatible sound card on the target.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
Notes:
|
|
|
ffd6ed |
|
|
|
ffd6ed |
* VMware's libvirt driver, and also OVF files, do not appear to
|
|
|
ffd6ed |
contain any sound card information, so it cannot be collected from
|
|
|
ffd6ed |
VMware sources.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
* Xen does emulate sound cards and makes that information available
|
|
|
ffd6ed |
through libvirt XML.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
* There are no paravirt drivers for sound that I'm aware of.
|
|
|
ffd6ed |
Therefore we can just copy the same sound model to the target (so
|
|
|
ffd6ed |
the sound device does not appear to change). If the target, KVM,
|
|
|
ffd6ed |
does not support the device, it is dropped. But ...
|
|
|
ffd6ed |
|
|
|
ffd6ed |
* ... Unfortunately we cannot easily tell which sound cards are
|
|
|
ffd6ed |
supported by KVM on the target. This is especially a problem for
|
|
|
ffd6ed |
RHEL, where many sound drivers have been removed. There is a
|
|
|
ffd6ed |
convenience function, `Utils.qemu_supports_sound_card', which can be
|
|
|
ffd6ed |
modified by packagers to hard code the list of supported sound
|
|
|
ffd6ed |
cards.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
* If a sound card is dubious / not supported by the target / has any
|
|
|
ffd6ed |
other problem, then we drop it, since it is more important that the
|
|
|
ffd6ed |
guest boots on the target than that sound works.
|
|
|
ffd6ed |
|
|
|
ffd6ed |
(cherry picked from commit 2b0c6e8565977c3a53e3a834f3518cce2128aaec)
|
|
|
ffd6ed |
---
|
|
|
ffd6ed |
v2v/Makefile.am | 2 ++
|
|
|
ffd6ed |
v2v/input_disk.ml | 1 +
|
|
|
ffd6ed |
v2v/input_libvirtxml.ml | 25 ++++++++++++++
|
|
|
ffd6ed |
v2v/input_ova.ml | 1 +
|
|
|
ffd6ed |
v2v/output_libvirt.ml | 11 +++++-
|
|
|
ffd6ed |
v2v/output_qemu.ml | 16 +++++++++
|
|
|
ffd6ed |
v2v/test-v2v-i-ova-formats.expected | 1 +
|
|
|
ffd6ed |
v2v/test-v2v-i-ova-gz.expected | 1 +
|
|
|
ffd6ed |
v2v/test-v2v-i-ova-two-disks.expected | 1 +
|
|
|
ffd6ed |
v2v/test-v2v-print-source.sh | 1 +
|
|
|
ffd6ed |
v2v/test-v2v-sound.sh | 64 +++++++++++++++++++++++++++++++++++
|
|
|
ffd6ed |
v2v/test-v2v-sound.xml | 36 ++++++++++++++++++++
|
|
|
ffd6ed |
v2v/types.ml | 27 +++++++++++++++
|
|
|
ffd6ed |
v2v/types.mli | 9 +++++
|
|
|
ffd6ed |
v2v/utils.ml | 11 ++++++
|
|
|
ffd6ed |
15 files changed, 206 insertions(+), 1 deletion(-)
|
|
|
ffd6ed |
create mode 100755 v2v/test-v2v-sound.sh
|
|
|
ffd6ed |
create mode 100644 v2v/test-v2v-sound.xml
|
|
|
ffd6ed |
|
|
|
ffd6ed |
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
|
|
|
ffd6ed |
index ab26baf..242dd49 100644
|
|
|
ffd6ed |
--- a/v2v/Makefile.am
|
|
|
ffd6ed |
+++ b/v2v/Makefile.am
|
|
|
ffd6ed |
@@ -31,6 +31,7 @@ EXTRA_DIST = \
|
|
|
ffd6ed |
test-v2v-i-ova-two-disks.ovf \
|
|
|
ffd6ed |
test-v2v-networks-and-bridges-expected.xml \
|
|
|
ffd6ed |
test-v2v-networks-and-bridges.xml \
|
|
|
ffd6ed |
+ test-v2v-sound.xml \
|
|
|
ffd6ed |
virt-v2v.pod
|
|
|
ffd6ed |
|
|
|
ffd6ed |
CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o virt-v2v
|
|
|
ffd6ed |
@@ -244,6 +245,7 @@ TESTS += \
|
|
|
ffd6ed |
test-v2v-of-option.sh \
|
|
|
ffd6ed |
test-v2v-on-option.sh \
|
|
|
ffd6ed |
test-v2v-print-source.sh \
|
|
|
ffd6ed |
+ test-v2v-sound.sh \
|
|
|
ffd6ed |
test-v2v-windows-conversion.sh
|
|
|
ffd6ed |
endif ENABLE_APPLIANCE
|
|
|
ffd6ed |
|
|
|
ffd6ed |
diff --git a/v2v/input_disk.ml b/v2v/input_disk.ml
|
|
|
ffd6ed |
index 54e0bbe..c308907 100644
|
|
|
ffd6ed |
--- a/v2v/input_disk.ml
|
|
|
ffd6ed |
+++ b/v2v/input_disk.ml
|
|
|
ffd6ed |
@@ -88,6 +88,7 @@ class input_disk verbose input_format disk = object
|
|
|
ffd6ed |
s_display =
|
|
|
ffd6ed |
Some { s_display_type = Window; s_keymap = None; s_password = None;
|
|
|
ffd6ed |
s_listen = LNone; s_port = None };
|
|
|
ffd6ed |
+ s_sound = None;
|
|
|
ffd6ed |
s_disks = [disk];
|
|
|
ffd6ed |
s_removables = [];
|
|
|
ffd6ed |
s_nics = [network];
|
|
|
ffd6ed |
diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml
|
|
|
ffd6ed |
index 16a8115..0db0a88 100644
|
|
|
ffd6ed |
--- a/v2v/input_libvirtxml.ml
|
|
|
ffd6ed |
+++ b/v2v/input_libvirtxml.ml
|
|
|
ffd6ed |
@@ -140,6 +140,30 @@ let parse_libvirt_xml ?conn ~verbose xml =
|
|
|
ffd6ed |
None
|
|
|
ffd6ed |
) in
|
|
|
ffd6ed |
|
|
|
ffd6ed |
+ (* Sound card. *)
|
|
|
ffd6ed |
+ let sound =
|
|
|
ffd6ed |
+ let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/sound" in
|
|
|
ffd6ed |
+ let nr_nodes = Xml.xpathobj_nr_nodes obj in
|
|
|
ffd6ed |
+ if nr_nodes < 1 then None
|
|
|
ffd6ed |
+ else (
|
|
|
ffd6ed |
+ (* Ignore everything except the first <sound> device. *)
|
|
|
ffd6ed |
+ let node = Xml.xpathobj_node doc obj 0 in
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+ Xml.xpathctx_set_current_context xpathctx node;
|
|
|
ffd6ed |
+ match xpath_to_string "@model" "" with
|
|
|
ffd6ed |
+ | "" -> None
|
|
|
ffd6ed |
+ | "ac97" -> Some { s_sound_model = AC97 }
|
|
|
ffd6ed |
+ | "es1370" -> Some { s_sound_model = ES1370 }
|
|
|
ffd6ed |
+ | "ich6" -> Some { s_sound_model = ICH6 }
|
|
|
ffd6ed |
+ | "ich9" -> Some { s_sound_model = ICH9 }
|
|
|
ffd6ed |
+ | "pcspk" -> Some { s_sound_model = PCSpeaker }
|
|
|
ffd6ed |
+ | "sb16" -> Some { s_sound_model = SB16 }
|
|
|
ffd6ed |
+ | "usb" -> Some { s_sound_model = USBAudio }
|
|
|
ffd6ed |
+ | model ->
|
|
|
ffd6ed |
+ warning ~prog (f_"unknown sound model %s ignored") model;
|
|
|
ffd6ed |
+ None
|
|
|
ffd6ed |
+ ) in
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
(* Non-removable disk devices. *)
|
|
|
ffd6ed |
let disks =
|
|
|
ffd6ed |
let get_disks, add_disk =
|
|
|
ffd6ed |
@@ -324,6 +348,7 @@ let parse_libvirt_xml ?conn ~verbose xml =
|
|
|
ffd6ed |
s_vcpu = vcpu;
|
|
|
ffd6ed |
s_features = features;
|
|
|
ffd6ed |
s_display = display;
|
|
|
ffd6ed |
+ s_sound = sound;
|
|
|
ffd6ed |
s_disks = [];
|
|
|
ffd6ed |
s_removables = removables;
|
|
|
ffd6ed |
s_nics = nics;
|
|
|
ffd6ed |
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
|
|
|
ffd6ed |
index f530b92..84ac57e 100644
|
|
|
ffd6ed |
--- a/v2v/input_ova.ml
|
|
|
ffd6ed |
+++ b/v2v/input_ova.ml
|
|
|
ffd6ed |
@@ -359,6 +359,7 @@ object
|
|
|
ffd6ed |
s_vcpu = vcpu;
|
|
|
ffd6ed |
s_features = []; (* XXX *)
|
|
|
ffd6ed |
s_display = None; (* XXX *)
|
|
|
ffd6ed |
+ s_sound = None;
|
|
|
ffd6ed |
s_disks = disks;
|
|
|
ffd6ed |
s_removables = removables;
|
|
|
ffd6ed |
s_nics = List.rev !nics;
|
|
|
ffd6ed |
diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
|
|
|
ffd6ed |
index dee432d..368f235 100644
|
|
|
ffd6ed |
--- a/v2v/output_libvirt.ml
|
|
|
ffd6ed |
+++ b/v2v/output_libvirt.ml
|
|
|
ffd6ed |
@@ -257,7 +257,16 @@ let create_libvirt_xml ?pool source targets guestcaps target_features =
|
|
|
ffd6ed |
|
|
|
ffd6ed |
video, graphics in
|
|
|
ffd6ed |
|
|
|
ffd6ed |
- let devices = disks @ removables @ nics @ [video] @ [graphics] @
|
|
|
ffd6ed |
+ let sound =
|
|
|
ffd6ed |
+ match source.s_sound with
|
|
|
ffd6ed |
+ | None -> []
|
|
|
ffd6ed |
+ | Some { s_sound_model = model } ->
|
|
|
ffd6ed |
+ if qemu_supports_sound_card model then
|
|
|
ffd6ed |
+ [ e "sound" [ "model", string_of_source_sound_model model ] [] ]
|
|
|
ffd6ed |
+ else
|
|
|
ffd6ed |
+ [] in
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+ let devices = disks @ removables @ nics @ [video] @ [graphics] @ sound @
|
|
|
ffd6ed |
(* Standard devices added to every guest. *) [
|
|
|
ffd6ed |
e "input" ["type", "tablet"; "bus", "usb"] [];
|
|
|
ffd6ed |
e "input" ["type", "mouse"; "bus", "ps2"] [];
|
|
|
ffd6ed |
diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml
|
|
|
ffd6ed |
index 860e1bf..77152a4 100644
|
|
|
ffd6ed |
--- a/v2v/output_qemu.ml
|
|
|
ffd6ed |
+++ b/v2v/output_qemu.ml
|
|
|
ffd6ed |
@@ -102,6 +102,22 @@ object
|
|
|
ffd6ed |
(match guestcaps.gcaps_video with Cirrus -> "cirrus" | QXL -> "qxl")
|
|
|
ffd6ed |
);
|
|
|
ffd6ed |
|
|
|
ffd6ed |
+ (* Add a sound card. *)
|
|
|
ffd6ed |
+ (match source.s_sound with
|
|
|
ffd6ed |
+ | None -> ()
|
|
|
ffd6ed |
+ | Some { s_sound_model = model } ->
|
|
|
ffd6ed |
+ if qemu_supports_sound_card model then (
|
|
|
ffd6ed |
+ match model with
|
|
|
ffd6ed |
+ | AC97 -> fpf "%s-device AC97" nl
|
|
|
ffd6ed |
+ | ES1370 -> fpf "%s-device ES1370" nl
|
|
|
ffd6ed |
+ | ICH6 -> fpf "%s-device intel-hda -device hda-duplex" nl
|
|
|
ffd6ed |
+ | ICH9 -> fpf "%s-device ich9-intel-hda" nl
|
|
|
ffd6ed |
+ | PCSpeaker -> fpf "%s-soundhw pcspk" nl (* not qdev-ified *)
|
|
|
ffd6ed |
+ | SB16 -> fpf "%s-device sb16" nl
|
|
|
ffd6ed |
+ | USBAudio -> fpf "%s-device usb-audio" nl
|
|
|
ffd6ed |
+ )
|
|
|
ffd6ed |
+ );
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
(* Add a serial console to Linux guests. *)
|
|
|
ffd6ed |
if inspect.i_type = "linux" then
|
|
|
ffd6ed |
fpf "%s-serial stdio" nl;
|
|
|
ffd6ed |
diff --git a/v2v/test-v2v-i-ova-formats.expected b/v2v/test-v2v-i-ova-formats.expected
|
|
|
ffd6ed |
index 8b3d62c..68a761e 100644
|
|
|
ffd6ed |
--- a/v2v/test-v2v-i-ova-formats.expected
|
|
|
ffd6ed |
+++ b/v2v/test-v2v-i-ova-formats.expected
|
|
|
ffd6ed |
@@ -6,6 +6,7 @@ hypervisor type: vmware
|
|
|
ffd6ed |
nr vCPUs: 1
|
|
|
ffd6ed |
CPU features:
|
|
|
ffd6ed |
display:
|
|
|
ffd6ed |
+ sound:
|
|
|
ffd6ed |
disks:
|
|
|
ffd6ed |
disk1.vmdk (vmdk) [scsi]
|
|
|
ffd6ed |
removable media:
|
|
|
ffd6ed |
diff --git a/v2v/test-v2v-i-ova-gz.expected b/v2v/test-v2v-i-ova-gz.expected
|
|
|
ffd6ed |
index e605afa..4eeb74d 100644
|
|
|
ffd6ed |
--- a/v2v/test-v2v-i-ova-gz.expected
|
|
|
ffd6ed |
+++ b/v2v/test-v2v-i-ova-gz.expected
|
|
|
ffd6ed |
@@ -6,6 +6,7 @@ hypervisor type: vmware
|
|
|
ffd6ed |
nr vCPUs: 1
|
|
|
ffd6ed |
CPU features:
|
|
|
ffd6ed |
display:
|
|
|
ffd6ed |
+ sound:
|
|
|
ffd6ed |
disks:
|
|
|
ffd6ed |
.vmdk (vmdk) [scsi]
|
|
|
ffd6ed |
removable media:
|
|
|
ffd6ed |
diff --git a/v2v/test-v2v-i-ova-two-disks.expected b/v2v/test-v2v-i-ova-two-disks.expected
|
|
|
ffd6ed |
index cd31898..f54f370 100644
|
|
|
ffd6ed |
--- a/v2v/test-v2v-i-ova-two-disks.expected
|
|
|
ffd6ed |
+++ b/v2v/test-v2v-i-ova-two-disks.expected
|
|
|
ffd6ed |
@@ -6,6 +6,7 @@ hypervisor type: vmware
|
|
|
ffd6ed |
nr vCPUs: 1
|
|
|
ffd6ed |
CPU features:
|
|
|
ffd6ed |
display:
|
|
|
ffd6ed |
+ sound:
|
|
|
ffd6ed |
disks:
|
|
|
ffd6ed |
disk1.vmdk (vmdk) [scsi]
|
|
|
ffd6ed |
disk2.vmdk (vmdk) [scsi]
|
|
|
ffd6ed |
diff --git a/v2v/test-v2v-print-source.sh b/v2v/test-v2v-print-source.sh
|
|
|
ffd6ed |
index cd32db9..5abd391 100755
|
|
|
ffd6ed |
--- a/v2v/test-v2v-print-source.sh
|
|
|
ffd6ed |
+++ b/v2v/test-v2v-print-source.sh
|
|
|
ffd6ed |
@@ -59,6 +59,7 @@ hypervisor type: test
|
|
|
ffd6ed |
nr vCPUs: 1
|
|
|
ffd6ed |
CPU features:
|
|
|
ffd6ed |
display:
|
|
|
ffd6ed |
+ sound:
|
|
|
ffd6ed |
disks:
|
|
|
ffd6ed |
/windows.img (raw) [virtio]
|
|
|
ffd6ed |
removable media:
|
|
|
ffd6ed |
diff --git a/v2v/test-v2v-sound.sh b/v2v/test-v2v-sound.sh
|
|
|
ffd6ed |
new file mode 100755
|
|
|
ffd6ed |
index 0000000..7cb6f24
|
|
|
ffd6ed |
--- /dev/null
|
|
|
ffd6ed |
+++ b/v2v/test-v2v-sound.sh
|
|
|
ffd6ed |
@@ -0,0 +1,64 @@
|
|
|
ffd6ed |
+#!/bin/bash -
|
|
|
ffd6ed |
+# libguestfs virt-v2v test script
|
|
|
ffd6ed |
+# Copyright (C) 2015 Red Hat Inc.
|
|
|
ffd6ed |
+#
|
|
|
ffd6ed |
+# This program is free software; you can redistribute it and/or modify
|
|
|
ffd6ed |
+# it under the terms of the GNU General Public License as published by
|
|
|
ffd6ed |
+# the Free Software Foundation; either version 2 of the License, or
|
|
|
ffd6ed |
+# (at your option) any later version.
|
|
|
ffd6ed |
+#
|
|
|
ffd6ed |
+# This program is distributed in the hope that it will be useful,
|
|
|
ffd6ed |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ffd6ed |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ffd6ed |
+# GNU General Public License for more details.
|
|
|
ffd6ed |
+#
|
|
|
ffd6ed |
+# You should have received a copy of the GNU General Public License
|
|
|
ffd6ed |
+# along with this program; if not, write to the Free Software
|
|
|
ffd6ed |
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+# Test <sound> is transferred to destination domain.
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+unset CDPATH
|
|
|
ffd6ed |
+export LANG=C
|
|
|
ffd6ed |
+set -e
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+if [ -n "$SKIP_TEST_V2V_SOUND_SH" ]; then
|
|
|
ffd6ed |
+ echo "$0: test skipped because environment variable is set"
|
|
|
ffd6ed |
+ exit 77
|
|
|
ffd6ed |
+fi
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+if [ "$(guestfish get-backend)" = "uml" ]; then
|
|
|
ffd6ed |
+ echo "$0: test skipped because UML backend does not support network"
|
|
|
ffd6ed |
+ exit 77
|
|
|
ffd6ed |
+fi
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+abs_builddir="$(pwd)"
|
|
|
ffd6ed |
+libvirt_uri="test://$abs_builddir/test-v2v-sound.xml"
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+f=../tests/guests/windows.img
|
|
|
ffd6ed |
+if ! test -f $f || ! test -s $f; then
|
|
|
ffd6ed |
+ echo "$0: test skipped because phony Windows image was not created"
|
|
|
ffd6ed |
+ exit 77
|
|
|
ffd6ed |
+fi
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+virt_tools_data_dir=${VIRT_TOOLS_DATA_DIR:-/usr/share/virt-tools}
|
|
|
ffd6ed |
+if ! test -r $virt_tools_data_dir/rhsrvany.exe; then
|
|
|
ffd6ed |
+ echo "$0: test skipped because rhsrvany.exe is not installed"
|
|
|
ffd6ed |
+ exit 77
|
|
|
ffd6ed |
+fi
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+d=test-v2v-sound.d
|
|
|
ffd6ed |
+rm -rf $d
|
|
|
ffd6ed |
+mkdir $d
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+$VG virt-v2v --debug-gc \
|
|
|
ffd6ed |
+ -i libvirt -ic "$libvirt_uri" windows \
|
|
|
ffd6ed |
+ -o local -os $d --no-copy
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+# Test the libvirt XML metadata was created.
|
|
|
ffd6ed |
+test -f $d/windows.xml
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+# Check the <sound> element exists in the output.
|
|
|
ffd6ed |
+grep 'sound model=.ich9' $d/windows.xml
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+rm -r $d
|
|
|
ffd6ed |
diff --git a/v2v/test-v2v-sound.xml b/v2v/test-v2v-sound.xml
|
|
|
ffd6ed |
new file mode 100644
|
|
|
ffd6ed |
index 0000000..f2babef
|
|
|
ffd6ed |
--- /dev/null
|
|
|
ffd6ed |
+++ b/v2v/test-v2v-sound.xml
|
|
|
ffd6ed |
@@ -0,0 +1,36 @@
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+libguestfs virt-v2v tool
|
|
|
ffd6ed |
+Copyright (C) 2009-2015 Red Hat Inc.
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+This program is free software; you can redistribute it and/or modify
|
|
|
ffd6ed |
+it under the terms of the GNU General Public License as published by
|
|
|
ffd6ed |
+the Free Software Foundation; either version 2 of the License, or
|
|
|
ffd6ed |
+(at your option) any later version.
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+This program is distributed in the hope that it will be useful,
|
|
|
ffd6ed |
+but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
ffd6ed |
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
ffd6ed |
+GNU General Public License for more details.
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+You should have received a copy of the GNU General Public License
|
|
|
ffd6ed |
+along with this program; if not, write to the Free Software
|
|
|
ffd6ed |
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
ffd6ed |
+-->
|
|
|
ffd6ed |
+<node>
|
|
|
ffd6ed |
+ <domain type='test'>
|
|
|
ffd6ed |
+ <name>windows</name>
|
|
|
ffd6ed |
+ <memory>1048576</memory>
|
|
|
ffd6ed |
+ <os>
|
|
|
ffd6ed |
+ <type>hvm</type>
|
|
|
ffd6ed |
+ <boot dev='hd'/>
|
|
|
ffd6ed |
+ </os>
|
|
|
ffd6ed |
+ <devices>
|
|
|
ffd6ed |
+ <disk type='file' device='disk'>
|
|
|
ffd6ed |
+ <driver name='qemu' type='raw'/>
|
|
|
ffd6ed |
+ <source file='../tests/guests/windows.img'/>
|
|
|
ffd6ed |
+ <target dev='vda' bus='virtio'/>
|
|
|
ffd6ed |
+ </disk>
|
|
|
ffd6ed |
+ <sound model="ich9"/>
|
|
|
ffd6ed |
+ </devices>
|
|
|
ffd6ed |
+ </domain>
|
|
|
ffd6ed |
+</node>
|
|
|
ffd6ed |
diff --git a/v2v/types.ml b/v2v/types.ml
|
|
|
ffd6ed |
index bbe679a..00ff526 100644
|
|
|
ffd6ed |
--- a/v2v/types.ml
|
|
|
ffd6ed |
+++ b/v2v/types.ml
|
|
|
ffd6ed |
@@ -28,6 +28,7 @@ type source = {
|
|
|
ffd6ed |
s_vcpu : int;
|
|
|
ffd6ed |
s_features : string list;
|
|
|
ffd6ed |
s_display : source_display option;
|
|
|
ffd6ed |
+ s_sound : source_sound option;
|
|
|
ffd6ed |
s_disks : source_disk list;
|
|
|
ffd6ed |
s_removables : source_removable list;
|
|
|
ffd6ed |
s_nics : source_nic list;
|
|
|
ffd6ed |
@@ -64,6 +65,12 @@ and s_display_listen =
|
|
|
ffd6ed |
| LAddress of string
|
|
|
ffd6ed |
| LNetwork of string
|
|
|
ffd6ed |
|
|
|
ffd6ed |
+and source_sound = {
|
|
|
ffd6ed |
+ s_sound_model : source_sound_model;
|
|
|
ffd6ed |
+}
|
|
|
ffd6ed |
+and source_sound_model =
|
|
|
ffd6ed |
+ AC97 | ES1370 | ICH6 | ICH9 | PCSpeaker | SB16 | USBAudio
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
let rec string_of_source s =
|
|
|
ffd6ed |
sprintf " source name: %s
|
|
|
ffd6ed |
hypervisor type: %s
|
|
|
ffd6ed |
@@ -71,6 +78,7 @@ hypervisor type: %s
|
|
|
ffd6ed |
nr vCPUs: %d
|
|
|
ffd6ed |
CPU features: %s
|
|
|
ffd6ed |
display: %s
|
|
|
ffd6ed |
+ sound: %s
|
|
|
ffd6ed |
disks:
|
|
|
ffd6ed |
%s
|
|
|
ffd6ed |
removable media:
|
|
|
ffd6ed |
@@ -86,6 +94,9 @@ NICs:
|
|
|
ffd6ed |
(match s.s_display with
|
|
|
ffd6ed |
| None -> ""
|
|
|
ffd6ed |
| Some display -> string_of_source_display display)
|
|
|
ffd6ed |
+ (match s.s_sound with
|
|
|
ffd6ed |
+ | None -> ""
|
|
|
ffd6ed |
+ | Some sound -> string_of_source_sound sound)
|
|
|
ffd6ed |
(String.concat "\n" (List.map string_of_source_disk s.s_disks))
|
|
|
ffd6ed |
(String.concat "\n" (List.map string_of_source_removable s.s_removables))
|
|
|
ffd6ed |
(String.concat "\n" (List.map string_of_source_nic s.s_nics))
|
|
|
ffd6ed |
@@ -135,6 +146,22 @@ and string_of_source_display { s_display_type = typ;
|
|
|
ffd6ed |
| LNetwork n -> sprintf " listening on network %s" n
|
|
|
ffd6ed |
)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
+and string_of_source_sound { s_sound_model = model } =
|
|
|
ffd6ed |
+ string_of_source_sound_model model
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
+(* NB: This function must produce names compatible with libvirt. The
|
|
|
ffd6ed |
+ * documentation for libvirt is incomplete, look instead at the
|
|
|
ffd6ed |
+ * sources.
|
|
|
ffd6ed |
+ *)
|
|
|
ffd6ed |
+and string_of_source_sound_model = function
|
|
|
ffd6ed |
+ | AC97 -> "ac97"
|
|
|
ffd6ed |
+ | ES1370 -> "es1370"
|
|
|
ffd6ed |
+ | ICH6 -> "ich6"
|
|
|
ffd6ed |
+ | ICH9 -> "ich9"
|
|
|
ffd6ed |
+ | PCSpeaker -> "pcspk"
|
|
|
ffd6ed |
+ | SB16 -> "sb16"
|
|
|
ffd6ed |
+ | USBAudio -> "usb"
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
type overlay = {
|
|
|
ffd6ed |
ov_overlay_file : string;
|
|
|
ffd6ed |
ov_sd : string;
|
|
|
ffd6ed |
diff --git a/v2v/types.mli b/v2v/types.mli
|
|
|
ffd6ed |
index 5925c97..1b3a9cf 100644
|
|
|
ffd6ed |
--- a/v2v/types.mli
|
|
|
ffd6ed |
+++ b/v2v/types.mli
|
|
|
ffd6ed |
@@ -28,6 +28,7 @@ type source = {
|
|
|
ffd6ed |
s_vcpu : int; (** Number of CPUs. *)
|
|
|
ffd6ed |
s_features : string list; (** Machine features. *)
|
|
|
ffd6ed |
s_display : source_display option; (** Guest display. *)
|
|
|
ffd6ed |
+ s_sound : source_sound option; (** Sound card. *)
|
|
|
ffd6ed |
s_disks : source_disk list; (** Disk images. *)
|
|
|
ffd6ed |
s_removables : source_removable list; (** CDROMs etc. *)
|
|
|
ffd6ed |
s_nics : source_nic list; (** NICs. *)
|
|
|
ffd6ed |
@@ -80,9 +81,17 @@ and s_display_listen =
|
|
|
ffd6ed |
| LAddress of string (** Listen address. *)
|
|
|
ffd6ed |
| LNetwork of string (** Listen network. *)
|
|
|
ffd6ed |
|
|
|
ffd6ed |
+and source_sound = {
|
|
|
ffd6ed |
+ s_sound_model : source_sound_model; (** Sound model. *)
|
|
|
ffd6ed |
+}
|
|
|
ffd6ed |
+and source_sound_model =
|
|
|
ffd6ed |
+ AC97 | ES1370 | ICH6 | ICH9 | PCSpeaker | SB16 | USBAudio
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
val string_of_source : source -> string
|
|
|
ffd6ed |
val string_of_source_disk : source_disk -> string
|
|
|
ffd6ed |
|
|
|
ffd6ed |
+val string_of_source_sound_model : source_sound_model -> string
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
type overlay = {
|
|
|
ffd6ed |
ov_overlay_file : string; (** Local overlay file (qcow2 format). *)
|
|
|
ffd6ed |
ov_sd : string; (** "sda", "sdb" etc - canonical device name. *)
|
|
|
ffd6ed |
diff --git a/v2v/utils.ml b/v2v/utils.ml
|
|
|
ffd6ed |
index 7757be5..26a3976 100644
|
|
|
ffd6ed |
--- a/v2v/utils.ml
|
|
|
ffd6ed |
+++ b/v2v/utils.ml
|
|
|
ffd6ed |
@@ -72,6 +72,17 @@ let kvm_arch = function
|
|
|
ffd6ed |
| "unknown" -> "x86_64" (* most likely *)
|
|
|
ffd6ed |
| arch -> arch
|
|
|
ffd6ed |
|
|
|
ffd6ed |
+(* Does qemu support the given sound card? *)
|
|
|
ffd6ed |
+let qemu_supports_sound_card = function
|
|
|
ffd6ed |
+ | AC97
|
|
|
ffd6ed |
+ | ES1370
|
|
|
ffd6ed |
+ | ICH6
|
|
|
ffd6ed |
+ | ICH9
|
|
|
ffd6ed |
+ | PCSpeaker
|
|
|
ffd6ed |
+ | SB16
|
|
|
ffd6ed |
+ | USBAudio
|
|
|
ffd6ed |
+ -> true
|
|
|
ffd6ed |
+
|
|
|
ffd6ed |
let compare_app2_versions app1 app2 =
|
|
|
ffd6ed |
let i = compare app1.Guestfs.app2_epoch app2.Guestfs.app2_epoch in
|
|
|
ffd6ed |
if i <> 0 then i
|
|
|
ffd6ed |
--
|
|
|
ffd6ed |
1.8.3.1
|
|
|
ffd6ed |
|