[pve-devel] [PATCH kvm] vma: better driver guessing for bdrv_open

Wolfgang Bumiller w.bumiller at proxmox.com
Tue Feb 23 16:16:16 CET 2016


---
This should fix the problem reported in forum thread 26108.
(`Unknown driver 'keyring'`)

See the patch commit message below for details.

 ...-vma-better-driver-guessing-for-bdrv_open.patch | 40 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch

diff --git a/debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch b/debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch
new file mode 100644
index 0000000..73e7ad3
--- /dev/null
+++ b/debian/patches/pve/0043-vma-better-driver-guessing-for-bdrv_open.patch
@@ -0,0 +1,40 @@
+From dfcf4c6da567aedfc0ebebf95f1d069187a9e8ed Mon Sep 17 00:00:00 2001
+From: Wolfgang Bumiller <w.bumiller at proxmox.com>
+Date: Tue, 23 Feb 2016 15:48:41 +0100
+Subject: [PATCH] vma: better driver guessing for bdrv_open
+
+Only use 'raw' when the file actually ends with .raw and
+no protocol has been specified similar to how it happens
+in bdrv_fill_options() called by bdrv_options().
+Other formats are recognized fine by filename (including
+qcow2 and "rbd:..." strings).
+---
+ vma.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/vma.c b/vma.c
+index cc48013..1db9bc7 100644
+--- a/vma.c
++++ b/vma.c
+@@ -301,10 +301,14 @@ static int extract_content(int argc, char **argv)
+ 
+             BlockDriverState *bs = bdrv_new();
+ 
+-	    const char *tmp = g_strrstr(devfn, ".");
+-	    const char *format = (tmp == NULL) ? "raw" : ++tmp;
+-	    QDict *options = qdict_new();
+-	    qdict_put(options, "driver", qstring_from_str(format));
++	    size_t devlen = strlen(devfn);
++	    QDict *options = NULL;
++	    if (devlen > 4 && strcmp(devfn+devlen-4, ".raw") == 0 &&
++		!path_has_protocol(devfn))
++	    {
++		options = qdict_new();
++		qdict_put(options, "driver", qstring_from_str("raw"));
++	    }
+ 
+ 	    if (errp || bdrv_open(&bs, devfn, NULL, options, flags, &errp)) {
+                 g_error("can't open file %s - %s", devfn,
+-- 
+2.1.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 8a61d6b..379f0d1 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -40,6 +40,7 @@ pve/0039-qapi-qmp_mashal_-renames-for-get_link_status.patch
 pve/0040-vnc-make-x509-imply-tls-again.patch
 pve/0041-PVE-VNC-authentication.patch
 pve/0042-vma-writer-don-t-bail-out-on-zero-length-files.patch
+pve/0043-vma-better-driver-guessing-for-bdrv_open.patch
 extra/CVE-2015-8558-ehci_make_idt_processing_more_robust.patch
 extra/CVE-2015-8613-scsi-initialize-info-object.patch
 extra/CVE-2015-8701-net-rocker-off-by-one.patch
-- 
2.1.4





More information about the pve-devel mailing list