guestfish and luks-format
by Olaf Hering
Is "luks-format" supposed to work with guestfish? Like guestfish <<EOF
luks-format /dev/sda4 0
EOF
Appearently it lacks an option to give the passphrase programmatically.
Was this option skipped on purpose?
Olaf
10 years, 10 months
mke2fs fails due to wipefs --force
by Olaf Hering
My wipefs has no --force option, as a result mke2fs command in guestfish fails.
Looks like 72dd398679cd0bb803daf306d12558369615ba70 needs an adjustment
to make use of do_wipefs?
Also str_wipefs is not used in that file.
Olaf
10 years, 10 months
[PATCH] daemon: add missing GUESTFSD_EXT_CMD usage
by Olaf Hering
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
Not even compile tested, against 1.24 branch.
daemon/btrfs.c | 2 +-
daemon/command.c | 3 ++-
daemon/debug.c | 3 ++-
daemon/ldm.c | 4 ++--
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/daemon/btrfs.c b/daemon/btrfs.c
index 0b877f8..a0c1542 100644
--- a/daemon/btrfs.c
+++ b/daemon/btrfs.c
@@ -597,7 +597,7 @@ test_btrfs_device_add_needs_force (void)
int r;
CLEANUP_FREE char *out = NULL, *err = NULL;
- r = command (&out, &err, "btrfs", "device", "add", "--help", NULL);
+ r = command (&out, &err, str_btrfs, "device", "add", "--help", NULL);
if (r == -1) {
reply_with_error ("%s: %s", "btrfs device add --help", err);
return -1;
diff --git a/daemon/command.c b/daemon/command.c
index 02e1dd4..066c773 100644
--- a/daemon/command.c
+++ b/daemon/command.c
@@ -30,6 +30,7 @@
#include "ignore-value.h"
+GUESTFSD_EXT_CMD(str_cp, cp);
GUESTFSD_EXT_CMD(str_mount, mount);
GUESTFSD_EXT_CMD(str_umount, umount);
@@ -179,7 +180,7 @@ set_up_etc_resolv_conf (struct resolver_state *rs)
/* Now that the guest's <sysroot>/etc/resolv.conf is out the way, we
* can create our own copy of the appliance /etc/resolv.conf.
*/
- ignore_value (command (NULL, NULL, "cp", "/etc/resolv.conf",
+ ignore_value (command (NULL, NULL, str_cp, "/etc/resolv.conf",
rs->sysroot_etc_resolv_conf, NULL));
rs->mounted = true;
diff --git a/daemon/debug.c b/daemon/debug.c
index 9fe57fc..b5470d7 100644
--- a/daemon/debug.c
+++ b/daemon/debug.c
@@ -41,6 +41,7 @@ GUESTFSD_EXT_CMD(str_xargs, xargs);
GUESTFSD_EXT_CMD(str_file, file);
GUESTFSD_EXT_CMD(str_grep, grep);
GUESTFSD_EXT_CMD(str_gawk, gawk);
+GUESTFSD_EXT_CMD(str_sh, sh);
/* This command exposes debugging information, internals and
* status. There is no comprehensive documentation for this
@@ -335,7 +336,7 @@ debug_binaries (const char *subcmd, size_t argc, char *const *const argv)
"| %s -F: '{print $1}'",
str_find, str_xargs, str_file, str_grep, str_gawk);
- r = command (&out, &err, "sh", "-c", cmd, NULL);
+ r = command (&out, &err, str_sh, "-c", cmd, NULL);
if (r == -1) {
reply_with_error ("find: %s", err);
free (out);
diff --git a/daemon/ldm.c b/daemon/ldm.c
index aed8a0d..e89fc90 100644
--- a/daemon/ldm.c
+++ b/daemon/ldm.c
@@ -130,7 +130,7 @@ do_ldmtool_create_all (void)
int r;
CLEANUP_FREE char *err = NULL;
- r = command (NULL, &err, "ldmtool", "create", "all", NULL);
+ r = command (NULL, &err, str_ldmtool, "create", "all", NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
@@ -144,7 +144,7 @@ do_ldmtool_remove_all (void)
int r;
CLEANUP_FREE char *err = NULL;
- r = command (NULL, &err, "ldmtool", "remove", "all", NULL);
+ r = command (NULL, &err, str_ldmtool, "remove", "all", NULL);
if (r == -1) {
reply_with_error ("%s", err);
return -1;
10 years, 10 months
Re: [Libguestfs] Double fault panic in L2 upon v2v conversion
by Richard W.M. Jones
[Please keep libguestfs mailing list in CC]
On Fri, Jan 17, 2014 at 04:14:03PM +0200, Rom Freiman wrote:
> How do you know that the problem is with KVM/QEMU and not with libguestfs?
The guestfsd daemon is simply running the regular 'mount' command.
The mount command causes the kernel to panic. There should be no
circumstances where running an ordinary command like that, albeit as
root, should cause the kernel to panic. Unless the kernel (or in this
case, something underneath the kernel) is broken.
mount -o ro /dev/sdb /sysroot/
[ 12.645305] PANIC: double fault, error_code: 0x0
[ 12.645305] CPU: 0 PID: 141 Comm: mount Not tainted
3.11.8-200.strato0002.fc19.strato.c3850ae03e9d.x86_64 #1
[ 12.645305] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 12.645305] task: ffff88001cc816e0 ti: ffff88001cde6000 task.ti:
ffff88001cde6000
[ 12.645305] RIP: 0033:[<00007fa602c5b99b>] [<00007fa602c5b99b>]
0x7fa602c5b99a
[ 12.645305] RSP: 002b:00007fff4f5884a0 EFLAGS: 00010216
[ 12.645305] RAX: 00007fa602008ff8 RBX: 00007fa601ff0000 RCX: 00007fa601ff0000
[ 12.645305] RDX: 00000000003b7068 RSI: 00007fff4f588560 RDI: 00007fa601ff3d18
[ 12.645305] RBP: 00007fff4f5885d0 R08: 00007fa60200f310 R09: 0000000000000000
[ 12.645305] R10: 0000000000000022 R11: 00007fa60200f310 R12: 00007fa60200e9b0
[ 12.645305] R13: 0000000000000000 R14: 0000000000000000 R15: 00007fa602e6e990
[ 12.645305] FS: 00007fa602e69880(0000) GS:ffff88001f000000(0000)
knlGS:0000000000000000
[ 12.645305] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 12.645305] CR2: 0000000000000000 CR3: 000000001d7fb000 CR4: 00000000000006f0
[ 12.645305]
[ 12.645305] Kernel panic - not syncing: Machine halted.
[ 12.645305] CPU: 0 PID: 141 Comm: mount Not tainted
3.11.8-200.strato0002.fc19.strato.c3850ae03e9d.x86_64 #1
[ 12.645305] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 12.645305] ffff88001f005f58 ffff88001f005e90 ffffffff8164024b
ffffffff819e89dc
[ 12.645305] ffff88001f005f08 ffffffff8163c272 0000000000000008
ffff88001f005f18
[ 12.645305] ffff88001f005eb8 ffffffff8163c8e5 0000000000000046
00000000000000b1
[ 12.645305] Call Trace:
[ 12.645305] <#DF> [<ffffffff8164024b>] dump_stack+0x45/0x56
[ 12.645305] [<ffffffff8163c272>] panic+0xc8/0x1d7
[ 12.645305] [<ffffffff8163c8e5>] ? printk+0x67/0x69
[ 12.645305] [<ffffffff81048ae1>] df_debug+0x31/0x40
[ 12.645305] [<ffffffff810132ed>] do_double_fault+0x5d/0x80
[ 12.645305] [<ffffffff81650b88>] double_fault+0x28/0x30
[ 12.645305] <<EOE>>
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
10 years, 10 months
Double fault panic in L2 upon v2v conversion
by Rom Freiman
Hi everybody,
Wanted to hear your opinion and to receive a smart advice.
I'm trying to use virt-v2v in order to convert ova image (exported from
vcenter) to run on libvirt/kvm - all this inside a VM of fedora.
The converted image is also a fedora.
During the conversion process, in some point of libguestfs activity, I get
double fault panic from L2 (printed as part of libguest output) and the
conversion process fails - no errors appear neither in L0 not in L1 message
logs.
This is more detailed explanation:
Description of problem:
During v2v conversion for ova fedora image in a VM there is double
fault panic happens and L2 crashes during libguestfs conversion.
The crash happens in different stages, but usually upon memory pressure in L0.
There are no error logs in L1 and cannot find strong correlation to
patches that were added to L0-KVM to avoid L0 crash upon nested vm
with high memory pressure -
http://git.kernel.org/cgit/virt/kvm/kvm.git/patch/arch/x86/kvm/mmu.c?id=9....
Command within L1 to perform the conversion (fedora.ova - vmdk image
of fedora - was placed in advance on the VM):
LIBGUESTFS_TRACE=1 LIBGUESTFS_DEBUG=1 /usr/bin/virt-v2v -i ova -os
default -oc qemu:///system -of qcow2 -n default
/var/tmp/fedora-v2v.ova
Version-Release number of selected component (if applicable):
L0:
Kernel: 3.11.8-200.fc19 + nested crash patches
libvritd: 1.0.5.8
qemu: 1.6.1
libguestfs-test-tool 1.22.7fedora=19,release=1.fc19,libvirt
L1:
Kernel: 3.11.8-200..fc19.x86_64
libvirtd: 1.0.5.8
qemu: 1.6.1 + v2v patch (skip vmdk version verification)
libguestfs-test-tool 1.22.7fedora=19,release=2.fc19,libvirt
virt-v2v 0.9.0
L2:
Kernel: 3.11.10-301.fc20
How reproducible:
LIBGUESTFS_TRACE=1 LIBGUESTFS_DEBUG=1 /usr/bin/virt-v2v -i ova -os
default -oc qemu:///system -of qcow2 -n default
/var/tmp/fedora-v2v.ova
Steps to Reproduce:
1. Upload ova image to VM
2. Run v2v to perform the conversion
3. Add some memory pressure on L0 (dd if=/dev/urandom of=/tmp/bigfile count=6M)
Actual results:
libguestfs: checksum of existing appliance:
63a0a4c8acb7f789c7a725bebbb16e64a3bc0999fdca61931babda50292d83b8
libguestfs: trace: get_cachedir
libguestfs: trace: get_cachedir = "/var/tmp"
libguestfs: [00337ms] begin testing qemu features
libguestfs: command: run: /usr/bin/qemu-kvm
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -help
libguestfs: command: run: /usr/bin/qemu-kvm
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -version
libguestfs: qemu version 1.6
libguestfs: command: run: /usr/bin/qemu-kvm
libguestfs: command: run: \ -nographic
libguestfs: command: run: \ -machine accel=kvm:tcg
libguestfs: command: run: \ -device ?
libguestfs: [00661ms] finished testing qemu features
[00663ms] /usr/bin/qemu-kvm \
-global virtio-blk-pci.scsi=off \
-nodefconfig \
-nodefaults \
-nographic \
-machine accel=kvm:tcg \
-m 500 \
-no-reboot \
-no-hpet \
-kernel /var/tmp/.guestfs-0/kernel.1416 \
-initrd /var/tmp/.guestfs-0/initrd.1416 \
-device virtio-scsi-pci,id=scsi \
-drive file=/var/lib/libvirt/images/fedora-v2v-disk1.vmdk,cache=none,format=qcow2,id=hd0,if=ide
\
-drive file=/tmp/3pEC1jAXQs,snapshot=on,format=raw,id=hd1,if=ide \
-drive file=/var/tmp/.guestfs-0/root.1416,snapshot=on,id=appliance,if=none,cache=unsafe
\
-device scsi-hd,drive=appliance \
-device virtio-serial \
-serial stdio \
-device sga \
-chardev socket,path=/tmp/libguestfsKr0x6j/guestfsd.sock,id=channel0 \
-device virtserialport,chardev=channel0,name=org.libguestfs.channel.0 \
-netdev user,id=usernet,net=169.254.0.0/16 \
-device virtio-net-pci,netdev=usernet \
-append 'panic=1 console=ttyS0 udevtimeout=600 no_timer_check
acpi=off printk.time=1 cgroup_disable=memory root=/dev/sdc selinux=0
guestfs_verbose=1 TERM=dumb'
\x1b[1;256r\x1b[256;256H\x1b[6n
Google, Inc.
Serial Graphics Adapter 02/18/13
SGABIOS $Id: sgabios.S 8 2010-04-22 00:03:40Z nlaredo $ (mockbuild@)
Mon Feb 18 08:29:02 UTC 2013
Term: 80x24
4 0
SeaBIOS (version ?-20131118_112708-)
iPXE (http://ipxe.org) 00:04.0 C100 PCI2.10 PnP PMM+1F3C7C60+1F327C60 C100
Booting from ROM...
Probing EDD (edd=off to disable)... ok
\x1b[2J[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version
3.11.8-200.strato0002.fc19.strato.c3850ae03e9d.x86_64
(mockbuild@ellaria) (gcc version 4.8.2 20131017 (Red Hat 4.8.2-1)
(GCC) ) #1 SMP Mon Nov 18 17:54:34 IST 2013
[ 0.000000] Command line: panic=1 console=ttyS0 udevtimeout=600
no_timer_check acpi=off printk.time=1 cgroup_disable=memory
root=/dev/sdc selinux=0 guestfs_verbose=1 TERM=dumb
[ 0.000000] e820: BIOS-provided physical RAM map:
[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
............................................
.........More logs here............
.............................................
guestfsd: main_loop: new request, len 0x3c
mount -o ro /dev/sdb /sysroot/
[ 12.645305] PANIC: double fault, error_code: 0x0
[ 12.645305] CPU: 0 PID: 141 Comm: mount Not tainted
3.11.8-200.strato0002.fc19.strato.c3850ae03e9d.x86_64 #1
[ 12.645305] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 12.645305] task: ffff88001cc816e0 ti: ffff88001cde6000 task.ti:
ffff88001cde6000
[ 12.645305] RIP: 0033:[<00007fa602c5b99b>] [<00007fa602c5b99b>]
0x7fa602c5b99a
[ 12.645305] RSP: 002b:00007fff4f5884a0 EFLAGS: 00010216
[ 12.645305] RAX: 00007fa602008ff8 RBX: 00007fa601ff0000 RCX: 00007fa601ff0000
[ 12.645305] RDX: 00000000003b7068 RSI: 00007fff4f588560 RDI: 00007fa601ff3d18
[ 12.645305] RBP: 00007fff4f5885d0 R08: 00007fa60200f310 R09: 0000000000000000
[ 12.645305] R10: 0000000000000022 R11: 00007fa60200f310 R12: 00007fa60200e9b0
[ 12.645305] R13: 0000000000000000 R14: 0000000000000000 R15: 00007fa602e6e990
[ 12.645305] FS: 00007fa602e69880(0000) GS:ffff88001f000000(0000)
knlGS:0000000000000000
[ 12.645305] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 12.645305] CR2: 0000000000000000 CR3: 000000001d7fb000 CR4: 00000000000006f0
[ 12.645305]
[ 12.645305] Kernel panic - not syncing: Machine halted.
[ 12.645305] CPU: 0 PID: 141 Comm: mount Not tainted
3.11.8-200.strato0002.fc19.strato.c3850ae03e9d.x86_64 #1
[ 12.645305] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[ 12.645305] ffff88001f005f58 ffff88001f005e90 ffffffff8164024b
ffffffff819e89dc
[ 12.645305] ffff88001f005f08 ffffffff8163c272 0000000000000008
ffff88001f005f18
[ 12.645305] ffff88001f005eb8 ffffffff8163c8e5 0000000000000046
00000000000000b1
[ 12.645305] Call Trace:
[ 12.645305] <#DF> [<ffffffff8164024b>] dump_stack+0x45/0x56
[ 12.645305] [<ffffffff8163c272>] panic+0xc8/0x1d7
[ 12.645305] [<ffffffff8163c8e5>] ? printk+0x67/0x69
[ 12.645305] [<ffffffff81048ae1>] df_debug+0x31/0x40
[ 12.645305] [<ffffffff810132ed>] do_double_fault+0x5d/0x80
[ 12.645305] [<ffffffff81650b88>] double_fault+0x28/0x30
[ 12.645305] <<EOE>>
[ 12.645305] Rebooting in 1 seconds..libguestfs: child_cleanup:
0x3a05f50: child process died
libguestfs: sending SIGTERM to process 1526
libguestfs: trace: mount_ro = -1 (error)
libguestfs: trace: vfs_type "/dev/sda1"
libguestfs: trace: vfs_type = NULL (error)
libguestfs: check_for_filesystem_on: /dev/sda1 (failed to get vfs type)
libguestfs: trace: internal_parse_mountable "/dev/sda1"
libguestfs: trace: internal_parse_mountable = NULL (error)
libguestfs: trace: inspect_os = NULL (error)
libguestfs: trace: close
Additional info:
The same crash also happens when L0 is 3.11.9 (with kvm patch to avoid
L0 crash in nested environment -
http://git.kernel.org/cgit/virt/kvm/kvm.git/patch/arch/x86/kvm/mmu.c?id=9...)
but more rarely.
Thanks a lot,
Rom
10 years, 10 months
[PATCH] hivex: ruby: Minor fix for building with Ruby 1.8
by Hilko Bengen
---
ruby/Rakefile.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ruby/Rakefile.in b/ruby/Rakefile.in
index 204e37c..5ad1502 100644
--- a/ruby/Rakefile.in
+++ b/ruby/Rakefile.in
@@ -22,7 +22,7 @@ require 'rake/testtask'
# Used to be rake/rdoctask. Now it's rdoc/task.
begin
require 'rdoc/task'
-rescue
+rescue LoadError
require 'rake/rdoctask'
end
@@ -31,7 +31,7 @@ end
begin
require 'rubygems/package_task'
gempackagetask='Gem::PackageTask'
-rescue
+rescue LoadError
require 'rake/gempackagetask'
gempackagetask='Rake::GemPackageTask'
end
--
1.8.5.2
10 years, 10 months
[PATCH INCOMPLETE] launch: libvirt: Use C macros to simplify XML generation.
by Richard W.M. Jones
This commit implements some hairy C macros to simplify
XML generation.
Given the target XML:
<cpu mode="host-passthrough">
<model fallback="allow"/>
</cpu>
The old code would have looked like this:
XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "cpu"));
XMLERROR (-1,
xmlTextWriterWriteAttribute (xo, BAD_CAST "mode",
BAD_CAST "host-passthrough"));
XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "model"));
XMLERROR (-1,
xmlTextWriterWriteAttribute (xo, BAD_CAST "fallback",
BAD_CAST "allow"));
XMLERROR (-1, xmlTextWriterEndElement (xo));
XMLERROR (-1, xmlTextWriterEndElement (xo));
The new code looks like this:
start_element ("cpu") {
attribute ("mode", "host-passthrough");
start_element ("model") {
attribute ("fallback", "allow");
} end_element ();
} end_element ();
---
src/launch-libvirt.c | 157 +++++++++++++++++++++++++++++++--------------------
1 file changed, 96 insertions(+), 61 deletions(-)
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
index f28b288..b2af881 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
@@ -801,6 +801,59 @@ static int construct_libvirt_xml_disk_source_hosts (guestfs_h *g, xmlTextWriterP
static int construct_libvirt_xml_disk_source_seclabel (guestfs_h *g, const struct backend_libvirt_data *data, xmlTextWriterPtr xo);
static int construct_libvirt_xml_appliance (guestfs_h *g, const struct libvirt_xml_params *params, xmlTextWriterPtr xo);
+/* These macros make it easier to write XML, but they also make a lot
+ * of assumptions:
+ *
+ * - The xmlTextWriterPtr is called 'xo'. It is used implicitly.
+ *
+ * - The guestfs handle is called 'g'. It is used implicitly for errors.
+ *
+ * - It is safe to 'return -1' on failure. This is OK provided you
+ * always use CLEANUP_* macros.
+ *
+ * - All the "bad" casting is hidden inside the macros.
+ */
+
+/* <element */
+#define start_element(element) \
+ if (xmlTextWriterStartElement (xo, BAD_CAST (element)) == -1) { \
+ xml_error ("xmlTextWriterStartElement"); \
+ return -1; \
+ } \
+ do
+
+/* finish current </element> */
+#define end_element() \
+ while (0); \
+ if (xmlTextWriterEndElement (xo) == -1) { \
+ xml_error ("xmlTextWriterEndElement"); \
+ return -1; \
+ }
+
+/* key=value attribute of the current element. */
+#define attribute(key,value) \
+ if (xmlTextWriterWriteAttribute (xo, BAD_CAST (key), BAD_CAST (value)) == -1) { \
+ xml_error ("xmlTextWriterWriteAttribute"); \
+ return -1; \
+ }
+
+/* attribute with namespace. */
+#define attribute_ns(prefix,key,namespace_uri,value) \
+ if (xmlTextWriterWriteAttributeNS (xo, BAD_CAST (prefix), \
+ BAD_CAST (key), BAD_CAST (namespace_uri), \
+ BAD_CAST (value)) == -1) { \
+ xml_error ("xmlTextWriterWriteAttribute"); \
+ return -1; \
+ }
+
+#define write_format_string(fs,...) \
+ if (xmlTextWriterWriteFormatString (xo, fs, ##__VA_ARGS__) == -1) { \
+ xml_error ("xmlTextWriterWriteFormatString"); \
+ return -1; \
+ }
+
+#define xml_error(fn) perrorf (g, _("%s:%d: error constructing libvirt XML near call to \"%s\""), __FILE__, __LINE__, fn);
+
/* Note this macro is rather specialized: It assumes that any local
* variables are protected by CLEANUP_* macros, so that simply
* returning will not cause any memory leaks.
@@ -848,33 +901,27 @@ construct_libvirt_xml_domain (guestfs_h *g,
XMLERROR (-1, xmlTextWriterSetIndentString (xo, BAD_CAST " "));
XMLERROR (-1, xmlTextWriterStartDocument (xo, NULL, NULL, NULL));
- XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "domain"));
- XMLERROR (-1,
- xmlTextWriterWriteAttribute (xo, BAD_CAST "type",
- params->is_kvm ? BAD_CAST "kvm" : BAD_CAST "qemu"));
- XMLERROR (-1,
- xmlTextWriterWriteAttributeNS (xo,
- BAD_CAST "xmlns",
- BAD_CAST "qemu",
- NULL,
- BAD_CAST "http://libvirt.org/schemas/domain/qemu/1.0"));
+ start_element ("domain") {
+ attribute ("type", params->is_kvm ? "kvm" : "qemu");
+ attribute_ns ("xmlns", "qemu", NULL,
+ "http://libvirt.org/schemas/domain/qemu/1.0");
- if (construct_libvirt_xml_name (g, params, xo) == -1)
- return -1;
- if (construct_libvirt_xml_cpu (g, params, xo) == -1)
- return -1;
- if (construct_libvirt_xml_boot (g, params, xo) == -1)
- return -1;
- if (construct_libvirt_xml_seclabel (g, params, xo) == -1)
- return -1;
- if (construct_libvirt_xml_lifecycle (g, params, xo) == -1)
- return -1;
- if (construct_libvirt_xml_devices (g, params, xo) == -1)
- return -1;
- if (construct_libvirt_xml_qemu_cmdline (g, params, xo) == -1)
- return -1;
+ if (construct_libvirt_xml_name (g, params, xo) == -1)
+ return -1;
+ if (construct_libvirt_xml_cpu (g, params, xo) == -1)
+ return -1;
+ if (construct_libvirt_xml_boot (g, params, xo) == -1)
+ return -1;
+ if (construct_libvirt_xml_seclabel (g, params, xo) == -1)
+ return -1;
+ if (construct_libvirt_xml_lifecycle (g, params, xo) == -1)
+ return -1;
+ if (construct_libvirt_xml_devices (g, params, xo) == -1)
+ return -1;
+ if (construct_libvirt_xml_qemu_cmdline (g, params, xo) == -1)
+ return -1;
- XMLERROR (-1, xmlTextWriterEndElement (xo));
+ } end_element ();
return 0;
}
@@ -897,17 +944,15 @@ construct_libvirt_xml_cpu (guestfs_h *g,
const struct libvirt_xml_params *params,
xmlTextWriterPtr xo)
{
- XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "memory"));
- XMLERROR (-1,
- xmlTextWriterWriteAttribute (xo, BAD_CAST "unit", BAD_CAST "MiB"));
- XMLERROR (-1, xmlTextWriterWriteFormatString (xo, "%d", g->memsize));
- XMLERROR (-1, xmlTextWriterEndElement (xo));
+ start_element ("memory") {
+ attribute ("unit", "MiB");
+ write_format_string ("%d", g->memsize);
+ } end_element ();
- XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "currentMemory"));
- XMLERROR (-1,
- xmlTextWriterWriteAttribute (xo, BAD_CAST "unit", BAD_CAST "MiB"));
- XMLERROR (-1, xmlTextWriterWriteFormatString (xo, "%d", g->memsize));
- XMLERROR (-1, xmlTextWriterEndElement (xo));
+ start_element ("currentMemory") {
+ attribute ("unit", "MiB");
+ write_format_string ("%d", g->memsize);
+ } end_element ();
#ifndef __arm__
/* It is faster to pass the CPU host model to the appliance,
@@ -916,36 +961,26 @@ construct_libvirt_xml_cpu (guestfs_h *g,
* fairly pointless anyway.
*/
if (params->is_kvm) {
- XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "cpu"));
- XMLERROR (-1,
- xmlTextWriterWriteAttribute (xo, BAD_CAST "mode",
- BAD_CAST "host-passthrough"));
- XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "model"));
- XMLERROR (-1,
- xmlTextWriterWriteAttribute (xo, BAD_CAST "fallback",
- BAD_CAST "allow"));
- XMLERROR (-1, xmlTextWriterEndElement (xo));
- XMLERROR (-1, xmlTextWriterEndElement (xo));
+ start_element ("cpu") {
+ attribute ("mode", "host-passthrough");
+ start_element ("model") {
+ attribute ("fallback", "allow");
+ } end_element ();
+ } end_element ();
}
#endif
- XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "vcpu"));
- XMLERROR (-1, xmlTextWriterWriteFormatString (xo, "%d", g->smp));
- XMLERROR (-1, xmlTextWriterEndElement (xo));
+ start_element ("vcpu") {
+ write_format_string ("%d", g->smp);
+ } end_element ();
- XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "clock"));
- XMLERROR (-1,
- xmlTextWriterWriteAttribute (xo, BAD_CAST "offset",
- BAD_CAST "utc"));
- XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "timer"));
- XMLERROR (-1,
- xmlTextWriterWriteAttribute (xo, BAD_CAST "name",
- BAD_CAST "kvmclock"));
- XMLERROR (-1,
- xmlTextWriterWriteAttribute (xo, BAD_CAST "present",
- BAD_CAST "yes"));
- XMLERROR (-1, xmlTextWriterEndElement (xo));
- XMLERROR (-1, xmlTextWriterEndElement (xo));
+ start_element ("clock") {
+ attribute ("offset", "utc");
+ start_element ("timer") {
+ attribute ("name", "kvmclock");
+ attribute ("present", "yes");
+ } end_element ();
+ } end_element ();
return 0;
}
--
1.8.4.2
10 years, 10 months
[PATCH] hivex: ruby: Support 'make INSTALLDIRS=vendor install' for Ruby
by Hilko Bengen
(This is the same change as 87c9ec881cb695724e01d9f6fc9df996d4c67cb6
in libguestfs.)
---
ruby/Makefile.am | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index e78ab59..7a5fe42 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -45,13 +45,17 @@ all:
$(RAKE) build
$(RAKE) rdoc
-RUBY_SITELIB := $(shell $(RUBY) -rrbconfig -e "puts RbConfig::CONFIG['sitelibdir']")
-RUBY_SITEARCH := $(shell $(RUBY) -rrbconfig -e "puts RbConfig::CONFIG['sitearchdir']")
+# Packagers can override this by doing: make INSTALLDIRS=vendor install
+# INSTALLDIRS also affects where Perl bindings are installed.
+INSTALLDIRS = site
+
+RUBY_LIBDIR := $(shell $(RUBY) -rrbconfig -e "puts RbConfig::CONFIG['$(INSTALLDIRS)libdir']")
+RUBY_ARCHDIR := $(shell $(RUBY) -rrbconfig -e "puts RbConfig::CONFIG['$(INSTALLDIRS)archdir']")
install:
- $(MKDIR_P) $(DESTDIR)$(RUBY_SITELIB)
- $(MKDIR_P) $(DESTDIR)$(RUBY_SITEARCH)
- $(INSTALL) -p -m 0644 ${srcdir}/lib/hivex.rb $(DESTDIR)$(RUBY_SITELIB)
- $(INSTALL) -p -m 0755 ${builddir}/ext/hivex/_hivex.so $(DESTDIR)$(RUBY_SITEARCH)
+ $(MKDIR_P) $(DESTDIR)$(RUBY_LIBDIR)
+ $(MKDIR_P) $(DESTDIR)$(RUBY_ARCHDIR)
+ $(INSTALL) -p -m 0644 $(srcdir)/lib/hivex.rb $(DESTDIR)$(RUBY_LIBDIR)
+ $(INSTALL) -p -m 0755 $(builddir)/ext/hivex/_hivex.so $(DESTDIR)$(RUBY_ARCHDIR)
endif
--
1.8.5.2
10 years, 10 months
[PATCH 0/2] Don't use snapshot=on
by Richard W.M. Jones
QEMU upstream has broken snapshot=on ... again.
These two patches stop using it entirely. Instead we run
'qemu-img create' to create overlay disks as required.
Note that the libvirt and UML backends were already doing this: The
libvirt backend because <transient/> has never worked, and the UML
backend was running uml_mkcow because the UML-equivalent syntax of
snapshot=on was broken for years. So this is a factoring out of that
logic into a central place.
Tested by:
make -j1 check check-valgrind check-direct check-valgrind-direct
I have not tested the UML backend yet.
Rich.
10 years, 10 months