- Update to version 1.19.49

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libguestfs?expand=0&rev=130
This commit is contained in:
Olaf Hering 2012-10-10 15:23:26 +00:00 committed by Git OBS Bridge
parent 3117b71d50
commit 41a4fef07e
5 changed files with 31 additions and 123 deletions

View File

@ -1,4 +1,4 @@
From 6d90239469c6de90c8a3fcb885ad2be30bf364f9 Mon Sep 17 00:00:00 2001
From 9bf2971806fede091c53dd3526dacdb3698a3739 Mon Sep 17 00:00:00 2001
From: Olaf Hering <olaf@aepfle.de>
Date: Mon, 3 Sep 2012 19:50:44 +0200
Subject: [PATCH] force virtio_blk in old guest kernel
@ -11,12 +11,12 @@ Signed-off-by: Olaf Hering <olaf@aepfle.de>
src/guestfs.c | 16 ++++++++++++++++
src/inspect-fs-unix.c | 4 ++--
src/launch-appliance.c | 3 +++
src/launch-libvirt.c | 36 +++++++++++++++++++++++++++++++-----
src/launch-libvirt.c | 7 +++++++
test-tool/test-tool.c | 16 +++++++++++++---
8 files changed, 83 insertions(+), 15 deletions(-)
8 files changed, 59 insertions(+), 10 deletions(-)
diff --git a/df/output.c b/df/output.c
index 5729dd4..f1713bb 100644
index 5729dd4..fb33ca1 100644
--- a/df/output.c
+++ b/df/output.c
@@ -42,6 +42,7 @@
@ -61,7 +61,7 @@ index 5729dd4..f1713bb 100644
}
- strcpy (ret, "/dev/sd");
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
+ use_virtio_blk = 1;
+#endif
+ strcpy (ret, use_virtio_blk ? "/dev/vd" : "/dev/sd");
@ -69,7 +69,7 @@ index 5729dd4..f1713bb 100644
len = strlen (ret);
if (part_num > 0)
diff --git a/fish/options.c b/fish/options.c
index 0db790e..8f9aada 100644
index 0db790e..54190bc 100644
--- a/fish/options.c
+++ b/fish/options.c
@@ -27,6 +27,8 @@
@ -85,7 +85,7 @@ index 0db790e..8f9aada 100644
exit (EXIT_FAILURE);
}
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
+ use_virtio_blk = 1;
+#endif
+
@ -101,10 +101,10 @@ index 0db790e..8f9aada 100644
exit (EXIT_FAILURE);
}
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index afc3be4..3ecc821 100644
index 273900e..e9f978b 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -289,6 +289,8 @@ struct guestfs_h
@@ -314,6 +314,8 @@ struct guestfs_h
void *connv; /* libvirt connection (really virConnectPtr) */
void *domv; /* libvirt domain (really virDomainPtr) */
} virt;
@ -114,7 +114,7 @@ index afc3be4..3ecc821 100644
/* Per-filesystem data stored for inspect_os. */
diff --git a/src/guestfs.c b/src/guestfs.c
index cb9ee6b..be6d849 100644
index ee523eb..f768c56 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -170,6 +170,22 @@ guestfs_create (void)
@ -141,10 +141,10 @@ index cb9ee6b..be6d849 100644
* inside the protocol.
*/
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index 2152484..593e265 100644
index 33c5ee9..c7d5398 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -1420,7 +1420,7 @@ resolve_fstab_device_diskbyid (guestfs_h *g, const char *part,
@@ -1412,7 +1412,7 @@ resolve_fstab_device_diskbyid (guestfs_h *g, const char *part,
return 0;
/* Make the partition name and check it exists. */
@ -153,7 +153,7 @@ index 2152484..593e265 100644
if (!is_partition (g, device)) {
free (device);
return 0;
@@ -1497,7 +1497,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map)
@@ -1489,7 +1489,7 @@ resolve_fstab_device (guestfs_h *g, const char *spec, Hash_table *md_map)
if (disk_i != -1 && disk_i <= 26 &&
slice_i > 0 && slice_i <= 1 /* > 4 .. see comment above */ &&
part_i >= 0 && part_i < 26) {
@ -163,7 +163,7 @@ index 2152484..593e265 100644
}
else if ((part = match1 (g, spec, re_diskbyid)) != NULL) {
diff --git a/src/launch-appliance.c b/src/launch-appliance.c
index e353e05..1a1ddef 100644
index 378f121..1f13929 100644
--- a/src/launch-appliance.c
+++ b/src/launch-appliance.c
@@ -891,6 +891,9 @@ qemu_supports_virtio_scsi (guestfs_h *g)
@ -177,12 +177,12 @@ index e353e05..1a1ddef 100644
}
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
index d678266..1b3b681 100644
index 183008e..6a1cef3 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
@@ -117,6 +117,12 @@ launch_libvirt (guestfs_h *g, const char *libvirt_uri)
void *buf = NULL;
int disable_svirt = is_custom_qemu (g);
@@ -150,6 +150,13 @@ launch_libvirt (guestfs_h *g, const char *libvirt_uri)
return -1;
}
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
+ if (g->use_virtio_blk) {
@ -190,109 +190,12 @@ index d678266..1b3b681 100644
+ return -1;
+ }
+#endif
/* At present you must add drives before starting the appliance. In
* future when we enable hotplugging you won't need to do this.
*/
@@ -612,11 +618,12 @@ construct_libvirt_xml_boot (guestfs_h *g, xmlTextWriterPtr xo,
snprintf (buf, sizeof buf,
LINUX_CMDLINE
- "root=/dev/sd%s " /* (root) */
+ "root=/dev/%s%s " /* (root) */
"%s " /* (selinux) */
"%s " /* (verbose) */
"TERM=%s " /* (TERM environment variable) */
"%s", /* (append) */
+ g->use_virtio_blk ? "vd" : "sd",
appliance_root,
g->selinux ? "selinux=1 enforcing=0" : "selinux=0",
g->verbose ? "guestfs_verbose=1" : "",
@@ -700,8 +707,17 @@ construct_libvirt_xml_devices (guestfs_h *g, xmlTextWriterPtr xo,
XMLERROR (-1, xmlTextWriterEndElement (xo));
}
- /* virtio-scsi controller. */
XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "controller"));
+ if (g->use_virtio_blk) {
+ /* virtio-blk controller. */
+ XMLERROR (-1,
+ xmlTextWriterWriteAttribute (xo, BAD_CAST "type",
+ BAD_CAST "ide"));
+ XMLERROR (-1,
+ xmlTextWriterWriteAttribute (xo, BAD_CAST "index",
+ BAD_CAST "0"));
+ } else {
+ /* virtio-scsi controller. */
XMLERROR (-1,
xmlTextWriterWriteAttribute (xo, BAD_CAST "type",
BAD_CAST "scsi"));
@@ -711,6 +727,7 @@ construct_libvirt_xml_devices (guestfs_h *g, xmlTextWriterPtr xo,
XMLERROR (-1,
xmlTextWriterWriteAttribute (xo, BAD_CAST "model",
BAD_CAST "virtio-scsi"));
+ }
XMLERROR (-1, xmlTextWriterEndElement (xo));
/* Disks. */
@@ -784,6 +801,7 @@ construct_libvirt_xml_disk (guestfs_h *g, xmlTextWriterPtr xo,
char scsi_target[64];
char *path = NULL;
char *format = NULL;
+ char *bus = "scsi";
int is_host_device;
/* XXX We probably could support this if we thought about it some more. */
@@ -792,6 +810,11 @@ construct_libvirt_xml_disk (guestfs_h *g, xmlTextWriterPtr xo,
goto err;
}
+ if (g->use_virtio_blk) {
+ drive_name[0] = 'v';
+ bus = "virtio";
+ }
+
guestfs___drive_name (drv_index, &drive_name[2]);
snprintf (scsi_target, sizeof scsi_target, "%zu", drv_index);
guestfs___launch_send_progress (g, 0);
TRACE0 (launch_libvirt_start);
@@ -844,7 +867,7 @@ construct_libvirt_xml_disk (guestfs_h *g, xmlTextWriterPtr xo,
BAD_CAST drive_name));
XMLERROR (-1,
xmlTextWriterWriteAttribute (xo, BAD_CAST "bus",
- BAD_CAST "scsi"));
+ BAD_CAST bus));
XMLERROR (-1, xmlTextWriterEndElement (xo));
XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "driver"));
@@ -1018,6 +1041,9 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g, xmlTextWriterPtr xo)
char attr[256];
struct qemu_param *qp;
char *p;
+ char *bus = "scsi";
+
+ bus = g->use_virtio_blk ? "ide" : "scsi";
XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "qemu:commandline"));
@@ -1028,7 +1054,7 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g, xmlTextWriterPtr xo)
for (drv = g->drives, drv_index = 0; drv; drv = drv->next, drv_index++) {
if (drv->readonly) {
snprintf (attr, sizeof attr,
- "drive.drive-scsi0-0-%zu-0.snapshot=on", drv_index);
+ "drive.drive-%s0-0-%zu-0.snapshot=on", bus, drv_index);
XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "qemu:arg"));
XMLERROR (-1,
@@ -1045,7 +1071,7 @@ construct_libvirt_xml_qemu_cmdline (guestfs_h *g, xmlTextWriterPtr xo)
}
snprintf (attr, sizeof attr,
- "drive.drive-scsi0-0-%zu-0.snapshot=on", drv_index);
+ "drive.drive-%s0-0-%zu-0.snapshot=on", bus, drv_index);
XMLERROR (-1, xmlTextWriterStartElement (xo, BAD_CAST "qemu:arg"));
XMLERROR (-1,
diff --git a/test-tool/test-tool.c b/test-tool/test-tool.c
index 6f26e33..56523b3 100644
index 6f26e33..754f09d 100644
--- a/test-tool/test-tool.c
+++ b/test-tool/test-tool.c
@@ -35,6 +35,7 @@
@ -309,7 +212,7 @@ index 6f26e33..56523b3 100644
char *p;
+ char *disk_name, *partition_name;
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
+#ifdef GUESTFS_QEMU_NO_VIRTIO_BLK
+ use_virtio_blk = 1;
+#endif
/* Everyone ignores the documentation, so ... */

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4c5f66d2f3029bdb7d60af994457f802749af12863ee1d5cdd439e88c91e16a9
size 8442198

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9411da58509e39745c757b3ad4fc0ffdaef238556d13eac6285b5e1c976e6441
size 8506655

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Oct 10 17:23:15 CEST 2012 - ohering@suse.de
- Update to version 1.19.49
-------------------------------------------------------------------
Wed Oct 10 16:51:32 CEST 2012 - ohering@suse.de

View File

@ -77,7 +77,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: Compatibility package for guestfs-tools
License: LGPL-2.1
Group: System/Filesystems
Version: 1.19.48
Version: 1.19.49
Release: 0
Patch0: 0001-launch-appliance-is-optional.patch
Patch5: libguestfs-1.13.14-ruby.patch