[PATCH 1/2] v2v: Fix conversion of floppy removable devices (RHBZ#1309706).
by Richard W.M. Jones
The previous code treated floppy disks and CD-ROMs as the same kind of
thing, resulting in malformed libvirt XML. You would see the
following error when importing a guest into libvirt:
error: Failed to define domain from /tmp/v2vlibvirt063486.xml
error: internal error: Invalid floppy device name: hdb
because we incorrectly generated this bogus libvirt XML fragment:
<disk device='floppy' type='file'>
<driver name='qemu' type='raw'/>
<target dev='hdb' bus='ide'/>
</disk>
This commit models floppy devices as a distinct type, occupying their
own bus ("/dev/fdX"). When writing to libvirt, we generate correct
XML fragments, looking like this:
<disk device='floppy' type='file'>
<driver name='qemu' type='raw'/>
<target dev='fda'/>
</disk>
Miscellaneous other changes were required in the code. There is also
a regression test (see following commit).
Note this ignores floppy disks in '-o qemu' mode.
---
v2v/input_libvirtxml.ml | 1 +
v2v/output_libvirt.ml | 6 ++++--
v2v/output_qemu.ml | 4 ++++
v2v/target_bus_assignment.ml | 20 ++++++++++++--------
v2v/test-v2v-i-ova.xml | 2 +-
v2v/types.ml | 1 +
v2v/types.mli | 10 +++++++---
7 files changed, 30 insertions(+), 14 deletions(-)
diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml
index 24e3b74..552bd9f 100644
--- a/v2v/input_libvirtxml.ml
+++ b/v2v/input_libvirtxml.ml
@@ -319,6 +319,7 @@ let parse_libvirt_xml ?conn xml =
| Some s when String.is_prefix s "sd" -> get_drive_slot s 2
| Some s when String.is_prefix s "vd" -> get_drive_slot s 2
| Some s when String.is_prefix s "xvd" -> get_drive_slot s 3
+ | Some s when String.is_prefix s "fd" -> get_drive_slot s 2
| Some s ->
warning (f_"<target dev='%s'> was ignored because the device name could not be recognized") s;
None in
diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index d56a852..e7067d7 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -171,7 +171,6 @@ let create_libvirt_xml ?pool source target_buses guestcaps
e "driver" [ "name", "qemu"; "type", "raw" ] [];
e "target" [
"dev", drive_prefix ^ drive_name i;
- "bus", bus_name
] []
]
in
@@ -185,7 +184,10 @@ let create_libvirt_xml ?pool source target_buses guestcaps
target_buses.target_ide_bus);
Array.to_list
(Array.mapi (make_disk "scsi" "sd")
- target_buses.target_scsi_bus)
+ target_buses.target_scsi_bus);
+ Array.to_list
+ (Array.mapi (make_disk "floppy" "fd")
+ target_buses.target_floppy_bus)
] in
let nics =
diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml
index f1d3c5f..b6093be 100644
--- a/v2v/output_qemu.ml
+++ b/v2v/output_qemu.ml
@@ -137,6 +137,10 @@ object
in
Array.iteri make_scsi target_buses.target_scsi_bus;
+ (* XXX Highly unlikely that anyone cares, but the current
+ * code ignores target_buses.target_floppy_bus.
+ *)
+
let net_bus =
match guestcaps.gcaps_net_bus with
| Virtio_net -> "virtio-net-pci"
diff --git a/v2v/target_bus_assignment.ml b/v2v/target_bus_assignment.ml
index ceb0550..d3444bc 100644
--- a/v2v/target_bus_assignment.ml
+++ b/v2v/target_bus_assignment.ml
@@ -21,11 +21,11 @@ open Common_gettext.Gettext
open Types
-(* XXX This doesn't do the right thing for PC legacy floppy devices. *)
let rec target_bus_assignment source targets guestcaps =
let virtio_blk_bus = ref [| |]
and ide_bus = ref [| |]
- and scsi_bus = ref [| |] in
+ and scsi_bus = ref [| |]
+ and floppy_bus = ref [| |] in
(* Add the fixed disks (targets) to either the virtio-blk or IDE bus,
* depending on whether the guest has virtio drivers or not.
@@ -66,11 +66,14 @@ let rec target_bus_assignment source targets guestcaps =
fun r ->
let t = BusSlotRemovable r in
let bus =
- match r.s_removable_controller with
- | None -> ide_bus (* Wild guess, but should be safe. *)
- | Some Source_virtio_blk -> virtio_blk_bus
- | Some Source_IDE -> ide_bus
- | Some Source_virtio_SCSI | Some Source_SCSI -> scsi_bus in
+ match r.s_removable_type with
+ | CDROM ->
+ (match r.s_removable_controller with
+ | None -> ide_bus (* Wild guess, but should be safe. *)
+ | Some Source_virtio_blk -> virtio_blk_bus
+ | Some Source_IDE -> ide_bus
+ | Some Source_virtio_SCSI | Some Source_SCSI -> scsi_bus)
+ | Floppy -> floppy_bus in
match r.s_removable_slot with
| None ->
@@ -89,7 +92,8 @@ let rec target_bus_assignment source targets guestcaps =
{ target_virtio_blk_bus = !virtio_blk_bus;
target_ide_bus = !ide_bus;
- target_scsi_bus = !scsi_bus }
+ target_scsi_bus = !scsi_bus;
+ target_floppy_bus = !floppy_bus }
(* Insert a slot into the bus array, making the array bigger if necessary. *)
and insert bus i slot =
diff --git a/v2v/test-v2v-i-ova.xml b/v2v/test-v2v-i-ova.xml
index bb765e3..6dcfc31 100644
--- a/v2v/test-v2v-i-ova.xml
+++ b/v2v/test-v2v-i-ova.xml
@@ -27,7 +27,7 @@
</disk>
<disk device='floppy' type='file'>
<driver name='qemu' type='raw'/>
- <target dev='hdb' bus='ide'/>
+ <target dev='fda'/>
</disk>
<interface type='network'>
<source network='Ethernet 1'/>
diff --git a/v2v/types.ml b/v2v/types.ml
index bff03a2..c43db24 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -425,6 +425,7 @@ type target_buses = {
target_virtio_blk_bus : target_bus_slot array;
target_ide_bus : target_bus_slot array;
target_scsi_bus : target_bus_slot array;
+ target_floppy_bus : target_bus_slot array;
}
and target_bus_slot =
diff --git a/v2v/types.mli b/v2v/types.mli
index 25420df..2727383 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -278,10 +278,11 @@ type target_buses = {
target_virtio_blk_bus : target_bus_slot array;
target_ide_bus : target_bus_slot array;
target_scsi_bus : target_bus_slot array;
+ target_floppy_bus : target_bus_slot array;
}
(** Mapping of fixed and removable disks to buses.
- As shown in the diagram below, there are (currently) three buses
+ As shown in the diagram below, there are (currently) four buses
attached to the target VM. Each contains a chain of fixed or
removable disks. Slots can also be empty.
@@ -300,8 +301,11 @@ type target_buses = {
├────┤ hda ├───┤ hdb ├───┤ hdc ├───┤ hdd │ IDE bus
│ └─────┘ └─────┘ └─────┘ └─────┘
│ ┌─────┐ ┌─────┐
- └────┤ - ├───┤ vdb │ Virtio-blk bus
- └─────┘ └─────┘
+ ├────┤ - ├───┤ vdb │ Virtio-blk bus
+ │ └─────┘ └─────┘
+ │ ┌─────┐
+ └────┤ fda │ Floppy disks
+ └─────┘
v}
*)
--
2.7.4
8 years, 3 months
[PATCH v3 0/4] virt-p2v support for openSUSE / SLES
by Cédric Bosdonnat
Diff to v2:
* remove leftover variable declaration in gui.c
Cédric Bosdonnat (4):
p2v: use yast2 lan on SUSE distros rather than NM
p2v: fix dependencies for SLES / openSUSE
p2v: add virt-p2v-make-kiwi to generate kiwi config
p2v: add -x option to nm-online
.gitignore | 3 +
configure.ac | 2 +
p2v/Makefile.am | 31 +++++-
p2v/dependencies.m4 | 19 ++--
p2v/gui.c | 5 +-
p2v/kiwi-config.sh | 73 +++++++++++++++
p2v/kiwi-config.xml.in | 92 ++++++++++++++++++
p2v/launch-virt-p2v.in | 17 +++-
p2v/utils.c | 2 +-
p2v/virt-p2v-make-disk.pod | 1 +
p2v/virt-p2v-make-kiwi.in | 228 +++++++++++++++++++++++++++++++++++++++++++++
p2v/virt-p2v-make-kiwi.pod | 184 ++++++++++++++++++++++++++++++++++++
p2v/virt-p2v.pod | 1 +
13 files changed, 640 insertions(+), 18 deletions(-)
create mode 100755 p2v/kiwi-config.sh
create mode 100644 p2v/kiwi-config.xml.in
create mode 100644 p2v/virt-p2v-make-kiwi.in
create mode 100644 p2v/virt-p2v-make-kiwi.pod
--
2.6.6
8 years, 3 months
[PATCH v2 0/4] virt-p2v support for openSUSE / SLES
by Cédric Bosdonnat
Diff to v1:
* Use access rather than stat in gui.c
* Remove now uneeded and missplaced include for stat.h
Cédric Bosdonnat (4):
p2v: use yast2 lan on SUSE distros rather than NM
p2v: fix dependencies for SLES / openSUSE
p2v: add virt-p2v-make-kiwi to generate kiwi config
p2v: add -x option to nm-online
.gitignore | 3 +
configure.ac | 2 +
p2v/Makefile.am | 31 +++++-
p2v/dependencies.m4 | 19 ++--
p2v/gui.c | 6 +-
p2v/kiwi-config.sh | 73 +++++++++++++++
p2v/kiwi-config.xml.in | 92 ++++++++++++++++++
p2v/launch-virt-p2v.in | 17 +++-
p2v/utils.c | 2 +-
p2v/virt-p2v-make-disk.pod | 1 +
p2v/virt-p2v-make-kiwi.in | 228 +++++++++++++++++++++++++++++++++++++++++++++
p2v/virt-p2v-make-kiwi.pod | 184 ++++++++++++++++++++++++++++++++++++
p2v/virt-p2v.pod | 1 +
13 files changed, 641 insertions(+), 18 deletions(-)
create mode 100755 p2v/kiwi-config.sh
create mode 100644 p2v/kiwi-config.xml.in
create mode 100644 p2v/virt-p2v-make-kiwi.in
create mode 100644 p2v/virt-p2v-make-kiwi.pod
--
2.6.6
8 years, 3 months
libguestfs can't communicate over network while creating VM
by Mensik, Petr
Hello guys,
we use libguests for dynamic creation of our VM and we do various modifications of those VMs in the process. One with I am struggling with is to signing keys of our custom repository - "
vm.sh("wget -O - " + key_address + " | apt-key add -")" where "vm" is a GuestFS object. So I have set "vm.set_network(True)" and I have installed "dhcpcd5" package
(that's whats on Debian Jessie) on both Host OS with KVM running and VM template (because we always copy Debian template we have in order to create new VM). However according to the log libvirt is still complaining that dhcpcd is missing (line 371 in the log). I ran dhcpcd command on both machines and I've even restarted networking service - unfortunately nothing helps. So I'd like to ask you for help or at least any hints. Thanks a lot.
http://pastebin.com/d6zZG1BK
P.S. I already wrote to the #libvirt channel on IRC but nobody replied so I am trying my luck here :)
Best regards
Petr Mensík
8 years, 3 months
[PATCH 0/7] p2v: Multiple improvements to the look of virt-p2v.
by Richard W.M. Jones
In the run dialog, I have implemented an ANSI colour escape sequence
interpreter, so that colours displayed by the remote virt-v2v are now
shown to the user.
(https://bugzilla.redhat.com/show_bug.cgi?id=1314244)
This requires virt-v2v to send colours. It wasn't doing that because
the output was a pipe (as we capture the output into the log file).
So I added a global --colours option to make the tools show ANSI
escape sequences even if the output is not a tty.
We don't want to show debug messages to the user during conversion.
This was tricky: I solved it by only sending back stdout from virt-v2v
to virt-p2v. However that doesn't show error messages, so if an error
is encountered, a virt-v2v wrapper script shows the last few lines of
the complete log file (in which the error appears).
Various font fixes.
Rich.
8 years, 3 months
[PATCH v2] rescue: add --autosysroot option RHBZ#1183493
by Maros Zatko
--autosysroot option uses suggestions to user on how to mount filesystems
and change root suggested by --suggest option in virt-rescue.
Commands are passed on kernel command line in format
guestfs_command=command;. Command ends with a semicolon and there can be
multiple commands specified. These are executed just before bash starts.
On successfull run user is presented directly with bash in chroot
environment.
Resolves RFE: RHBZ#1183493
Maros Zatko (1):
rescue: add --autosysroot option RHBZ#1183493
appliance/init | 5 ++
rescue/rescue.c | 169 +++++++++++++++++++++++++++++++++++++++++++++-----------
2 files changed, 143 insertions(+), 31 deletions(-)
--
2.5.5
8 years, 3 months
[PATCH] builder: Fix description for --long option
by Andrea Bolognani
---
builder/cmdline.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builder/cmdline.ml b/builder/cmdline.ml
index 7b33013..eee8367 100644
--- a/builder/cmdline.ml
+++ b/builder/cmdline.ml
@@ -148,7 +148,7 @@ let parse_cmdline () =
"--gpg", Arg.Set_string gpg, "gpg" ^ " " ^ s_"Set GPG binary/command";
"-l", Arg.Unit list_mode, " " ^ s_"List available templates";
"--list", Arg.Unit list_mode, " " ^ s_"List available templates";
- "--long", Arg.Unit list_set_long, " " ^ s_"Shortcut for --list-format short";
+ "--long", Arg.Unit list_set_long, " " ^ s_"Shortcut for --list-format long";
"--list-format", Arg.String list_set_format,
"short|long|json" ^ " " ^ s_"Set the format for --list (default: short)";
"--machine-readable", Arg.Set machine_readable, " " ^ s_"Make output machine readable";
--
2.5.5
8 years, 3 months
[PATCH v9 0/3] New API: filesystem_walk
by Matteo Cafasso
v9:
- add missing files: java/Makefile.inc,
java/com/redhat/et/libguestfs/.gitignore,
gobject/Makefile.inc
- reserve space in tsk_dirent struct for future usage
- use int instead of bool_t type
- improve API documentation
Matteo Cafasso (3):
New API: internal_filesystem_walk
New API: filesystem_walk
lib: Added filesystem_walk command tests
daemon/Makefile.am | 4 +-
daemon/tsk.c | 251 +++++++++++++++++++++++++++++++
docs/guestfs-building.pod | 4 +
generator/actions.ml | 123 +++++++++++++++
generator/structs.ml | 18 +++
gobject/Makefile.inc | 2 +
java/Makefile.inc | 1 +
java/com/redhat/et/libguestfs/.gitignore | 1 +
m4/guestfs_daemon.m4 | 8 +
src/MAX_PROC_NR | 2 +-
src/Makefile.am | 1 +
src/tsk.c | 128 ++++++++++++++++
tests/tsk/Makefile.am | 3 +-
tests/tsk/test-filesystem-walk.sh | 82 ++++++++++
14 files changed, 625 insertions(+), 3 deletions(-)
create mode 100644 daemon/tsk.c
create mode 100644 src/tsk.c
create mode 100755 tests/tsk/test-filesystem-walk.sh
--
2.8.1
8 years, 3 months
[PATCH v8 0/3] New API: filesystem_walk
by Matteo Cafasso
v8:
- rebase on master
- bump version to 1.33.37
- squash commits 1, 2, 3
Kept original commits messages when squashing them.
Matteo Cafasso (3):
New API: internal_filesystem_walk
New API: filesystem_walk
lib: Added filesystem_walk command tests
daemon/Makefile.am | 4 +-
daemon/tsk.c | 249 ++++++++++++++++++++++++++++++++++++++
docs/guestfs-building.pod | 4 +
generator/actions.ml | 117 ++++++++++++++++++
generator/structs.ml | 13 ++
m4/guestfs_daemon.m4 | 8 ++
src/MAX_PROC_NR | 2 +-
src/Makefile.am | 1 +
src/tsk.c | 129 ++++++++++++++++++++
tests/tsk/Makefile.am | 3 +-
tests/tsk/test-filesystem-walk.sh | 64 ++++++++++
11 files changed, 591 insertions(+), 3 deletions(-)
create mode 100644 daemon/tsk.c
create mode 100644 src/tsk.c
create mode 100755 tests/tsk/test-filesystem-walk.sh
--
2.8.1
8 years, 3 months