# 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
|