WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 5 of 6] libxlu: correctly parse disk "backendtype" fi

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 5 of 6] libxlu: correctly parse disk "backendtype" field
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Thu, 29 Sep 2011 17:20:32 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Thu, 29 Sep 2011 09:26:29 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1317313227@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1317313227@xxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.6.4
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1317313034 -3600
# Node ID 50cd0fd187b39a263680d8a4b4f1a8511c7c04ee
# Parent  6056b382a44fd94ead9523a098855830c400ee54
libxlu: correctly parse disk "backendtype" field

Currently it tries to parse the value from the full "backendtype=FOO" string
but really it needs to parse from the equals.

Before:
# xl -N block-attach d32-1 
backendtype=phy,vdev=xvdb,access=w,target=/dev/VG/debian-x86_32-1b
command line: config parsing error in disk specification: unknown value for 
backendtype: near `backendtype=phy' in 
`backendtype=phy,vdev=xvdb,access=w,target=/dev/VG/debian-x86_32-1b'

After:
# xl -N block-attach d32-1 
backendtype=phy,vdev=xvdb,access=w,target=/dev/VG/debian-x86_32-1b
disk: {
    "backend_domid": 0,
    "pdev_path": "/dev/VG/debian-x86_32-1b",
    "vdev": "xvdb",
    "backend": "phy",
    "format": "raw",
    "script": null,
    "removable": 0,
    "readwrite": 1,
    "is_cdrom": 0
}

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 6056b382a44f -r 50cd0fd187b3 tools/libxl/check-xl-disk-parse
--- a/tools/libxl/check-xl-disk-parse   Thu Sep 29 17:15:32 2011 +0100
+++ b/tools/libxl/check-xl-disk-parse   Thu Sep 29 17:17:14 2011 +0100
@@ -91,4 +91,20 @@ one 0 "format=raw, vdev=hdc, access=ro, 
 one 0  format=raw  vdev=hdc  access=ro  devtype=cdrom  target=/root/image.iso
 one 0 raw:/root/image.iso,hdc:cdrom,ro
 
+expected <<EOF
+disk: {
+    "backend_domid": 0,
+    "pdev_path": "/dev/vg/guest-volume",
+    "vdev": "xvdb",
+    "backend": "phy",
+    "format": "raw",
+    "script": null,
+    "removable": 0,
+    "readwrite": 1,
+    "is_cdrom": 0
+}
+
+EOF
+one 0 backendtype=phy,vdev=xvdb,access=w,target=/dev/vg/guest-volume
+
 complete
diff -r 6056b382a44f -r 50cd0fd187b3 tools/libxl/libxlu_disk_l.c
--- a/tools/libxl/libxlu_disk_l.c       Thu Sep 29 17:15:32 2011 +0100
+++ b/tools/libxl/libxlu_disk_l.c       Thu Sep 29 17:17:14 2011 +0100
@@ -1261,7 +1261,7 @@ case 8:
 /* rule 8 can match eol */
 YY_RULE_SETUP
 #line 142 "libxlu_disk_l.l"
-{ STRIP(','); setbackendtype(DPC,yytext); }
+{ STRIP(','); setbackendtype(DPC,FROMEQUALS); }
        YY_BREAK
 case 9:
 /* rule 9 can match eol */
diff -r 6056b382a44f -r 50cd0fd187b3 tools/libxl/libxlu_disk_l.l
--- a/tools/libxl/libxlu_disk_l.l       Thu Sep 29 17:15:32 2011 +0100
+++ b/tools/libxl/libxlu_disk_l.l       Thu Sep 29 17:17:14 2011 +0100
@@ -139,7 +139,7 @@ devtype=disk,?      { DPC->disk->is_cdrom = 0
 devtype=[^,]*,?        { xlu__disk_err(DPC,yytext,"unknown value for type"); }
 
 access=[^,]*,? { STRIP(','); setaccess(DPC, FROMEQUALS); }
-backendtype=[^,]*? { STRIP(','); setbackendtype(DPC,yytext); }
+backendtype=[^,]*? { STRIP(','); setbackendtype(DPC,FROMEQUALS); }
 
 vdev=[^,]*,?   { STRIP(','); SAVESTRING("vdev", vdev, FROMEQUALS); }
 script=[^,]*,? { STRIP(','); SAVESTRING("script", script, FROMEQUALS); }

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel