Skip to contentSkip to conversation

libxl: update check-xl-disk-parse

PATCH Superseded Wei Liu 2 participants 5 messages Dec 8, 2015 – Dec 9, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 libxl: update check-xl-disk-parse

The block-attach command now returns 1 when fails. Update first test case to expect return value 1 instead of 255.

The parser now doesn't generate output for default values. Remove them from expected output.

The "discard=" variant is never not supported, so delete two test cases with that variant.

---
Cc: Jim Fehlig <[email protected]>
Cc: Ian Campbell <[email protected]>
Cc: Ian Jackson <[email protected]>

---
 tools/libxl/check-xl-disk-parse | 100 ++++------------------------------------
 1 file changed, 8 insertions(+), 92 deletions(-)
tools/libxl/check-xl-disk-parse +8 -92
index 1bec4ca..03572e4 100755
@@ -40,7 +40,7 @@ complete () {
     fi
 }
 
-e=255
+e=1
 
 
 #---------- test data ----------
@@ -52,18 +52,10 @@ one $e foo
 
 expected <<END
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "/dev/vg/guest-volume",
     "vdev": "hda",
-    "backend": "unknown",
     "format": "raw",
-    "script": null,
-    "removable": 0,
-    "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
-    "discard_enable": "True"
+    "readwrite": 1
 }
 
 END
@@ -75,18 +67,11 @@ one 0 raw:/dev/vg/guest-volume,hda,w
 
 expected <<END
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "/root/image.iso",
     "vdev": "hdc",
-    "backend": "unknown",
     "format": "raw",
-    "script": null,
     "removable": 1,
-    "readwrite": 0,
-    "is_cdrom": 1,
-    "direct_io_safe": false,
-    "discard_enable": "False"
+    "is_cdrom": 1
 }
 
 END
@@ -99,18 +84,11 @@ one 0 raw:/root/image.iso,hdc:cdrom,ro
 
 expected <<EOF
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "/dev/vg/guest-volume",
     "vdev": "xvdb",
     "backend": "phy",
     "format": "raw",
-    "script": null,
-    "removable": 0,
-    "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
-    "discard_enable": "True"
+    "readwrite": 1
 }
 
 EOF
@@ -118,18 +96,11 @@ one 0 backendtype=phy,vdev=xvdb,access=w,target=/dev/vg/guest-volume
 
 expected <<EOF
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "",
     "vdev": "hdc",
-    "backend": "unknown",
     "format": "empty",
-    "script": null,
     "removable": 1,
-    "readwrite": 0,
-    "is_cdrom": 1,
-    "direct_io_safe": false,
-    "discard_enable": "False"
+    "is_cdrom": 1
 }
 
 EOF
@@ -141,18 +112,10 @@ one 0 ,empty,hdc:cdrom,r
 
 expected <<EOF
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
-    "pdev_path": null,
     "vdev": "hdc",
-    "backend": "unknown",
     "format": "empty",
-    "script": null,
     "removable": 1,
-    "readwrite": 0,
-    "is_cdrom": 1,
-    "direct_io_safe": false,
-    "discard_enable": "False"
+    "is_cdrom": 1
 }
 
 EOF
@@ -161,18 +124,11 @@ one 0 vdev=hdc,access=r,devtype=cdrom
 
 expected <<EOF
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "iqn.2001-05.com.equallogic:0-8a0906-23fe93404-c82797962054a96d-examplehost",
     "vdev": "xvda",
-    "backend": "unknown",
     "format": "raw",
     "script": "block-iscsi",
-    "removable": 0,
-    "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
-    "discard_enable": "True"
+    "readwrite": 1
 }
 
 EOF
@@ -183,18 +139,11 @@ one 0 vdev=xvda,access=w,script=block-iscsi,target=iqn.2001-05.com.equallogic:0-
 
 expected <<EOF
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "app01",
     "vdev": "hda",
-    "backend": "unknown",
     "format": "raw",
     "script": "block-drbd",
-    "removable": 0,
-    "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
-    "discard_enable": "True"
+    "readwrite": 1
 }
 
 EOF
@@ -205,57 +154,24 @@ one 0 drbd:app01,hda,w
 
 expected <<END
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "/some/disk/image.raw",
     "vdev": "hda",
-    "backend": "unknown",
     "format": "raw",
-    "script": null,
-    "removable": 0,
     "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
     "discard_enable": "True"
 }
 
 END
-one 0  discard=on  vdev=hda target=/some/disk/image.raw
-one 0  discard=1   vdev=hda target=/some/disk/image.raw
-
-expected <<END
-disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
-    "pdev_path": "/some/disk/image.raw",
-    "vdev": "hda",
-    "backend": "unknown",
-    "format": "raw",
-    "script": null,
-    "removable": 0,
-    "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
-    "discard_enable": "False"
-}
-
-END
 one 0  discard vdev=hda target=/some/disk/image.raw
 one 0  discard vdev=hda target=/some/disk/image.raw
 
 expected <<END
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "/some/disk/image.iso",
     "vdev": "hda",
-    "backend": "unknown",
     "format": "raw",
-    "script": null,
     "removable": 1,
-    "readwrite": 0,
     "is_cdrom": 1,
-    "direct_io_safe": false,
     "discard_enable": "False"
 }
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 5 lines · Wei Liu

The block-attach command now returns 1 when fails. Update first test case to expect return value 1 instead of 255.

The parser now doesn't generate output for default values. Remove them from expected output.

This it looks good.

Quoted 2 lines

The "discard=" variant is never not supported, so delete two test cases with that variant.

I don't follow (the double negative "never not" doesn't help).

However, assuming you are saying that discard= is always supported, I don't then see the rationale for removing the test. Of course we do want to test things which are supported.

Quoted 218 lines

---
Cc: Jim Fehlig <[email protected]>
Cc: Ian Campbell <[email protected]>
Cc: Ian Jackson <[email protected]>
---
 tools/libxl/check-xl-disk-parse | 100 ++++----------------------------
--------

 1 file changed, 8 insertions(+), 92 deletions(-)
tools/libxl/check-xl-disk- renamed from tools/libxl/check-xl-disk-parse +0 -0

parse
index 1bec4ca..03572e4 100755

tools/libxl/check-xl-disk-parse +0 -0
@@ -40,7 +40,7 @@ complete () {

     fi
 }

tools/libxl/check-xl-disk-parse +1 -1
-e=255
+e=1



 #---------- test data ----------

tools/libxl/check-xl-disk-parse +0 -0
@@ -52,18 +52,10 @@ one $e foo


 expected <<END
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "/dev/vg/guest-volume",
     "vdev": "hda",
-    "backend": "unknown",
     "format": "raw",
-    "script": null,
-    "removable": 0,
-    "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
-    "discard_enable": "True"
+    "readwrite": 1
 }

 END

tools/libxl/check-xl-disk-parse +0 -0
@@ -75,18 +67,11 @@ one 0 raw:/dev/vg/guest-volume,hda,w


 expected <<END
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "/root/image.iso",
     "vdev": "hdc",
-    "backend": "unknown",
     "format": "raw",
-    "script": null,
     "removable": 1,
-    "readwrite": 0,
-    "is_cdrom": 1,
-    "direct_io_safe": false,
-    "discard_enable": "False"
+    "is_cdrom": 1
 }

 END

tools/libxl/check-xl-disk-parse +0 -0
@@ -99,18 +84,11 @@ one 0 raw:/root/image.iso,hdc:cdrom,ro


 expected <<EOF
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "/dev/vg/guest-volume",
     "vdev": "xvdb",
     "backend": "phy",
     "format": "raw",
-    "script": null,
-    "removable": 0,
-    "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
-    "discard_enable": "True"
+    "readwrite": 1
 }

 EOF

tools/libxl/check-xl-disk-parse +0 -0
@@ -118,18 +96,11 @@ one 0

backendtype=phy,vdev=xvdb,access=w,target=/dev/vg/guest-volume
 expected <<EOF
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "",
     "vdev": "hdc",
-    "backend": "unknown",
     "format": "empty",
-    "script": null,
     "removable": 1,
-    "readwrite": 0,
-    "is_cdrom": 1,
-    "direct_io_safe": false,
-    "discard_enable": "False"
+    "is_cdrom": 1
 }

 EOF

tools/libxl/check-xl-disk-parse +0 -0
@@ -141,18 +112,10 @@ one 0 ,empty,hdc:cdrom,r


 expected <<EOF
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
-    "pdev_path": null,
     "vdev": "hdc",
-    "backend": "unknown",
     "format": "empty",
-    "script": null,
     "removable": 1,
-    "readwrite": 0,
-    "is_cdrom": 1,
-    "direct_io_safe": false,
-    "discard_enable": "False"
+    "is_cdrom": 1
 }

 EOF

tools/libxl/check-xl-disk-parse +0 -0
@@ -161,18 +124,11 @@ one 0 vdev=hdc,access=r,devtype=cdrom


 expected <<EOF
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "iqn.2001-05.com.equallogic:0-8a0906-23fe93404- c82797962054a96d-examplehost",
     "vdev": "xvda",
-    "backend": "unknown",
     "format": "raw",
     "script": "block-iscsi",
-    "removable": 0,
-    "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
-    "discard_enable": "True"
+    "readwrite": 1
 }

 EOF

tools/libxl/check-xl-disk-parse +0 -0
@@ -183,18 +139,11 @@ one 0 vdev=xvda,access=w,script=block-

iscsi,target=iqn.2001-05.com.equallogic:0-

 expected <<EOF
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "app01",
     "vdev": "hda",
-    "backend": "unknown",
     "format": "raw",
     "script": "block-drbd",
-    "removable": 0,
-    "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
-    "discard_enable": "True"
+    "readwrite": 1
 }

 EOF

tools/libxl/check-xl-disk-parse +0 -0
@@ -205,57 +154,24 @@ one 0 drbd:app01,hda,w


 expected <<END
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "/some/disk/image.raw",
     "vdev": "hda",
-    "backend": "unknown",
     "format": "raw",
-    "script": null,
-    "removable": 0,
     "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
     "discard_enable": "True"
 }

 END

tools/libxl/check-xl-disk-parse +0 -20
-one 0  discard=on  vdev=hda target=/some/disk/image.raw
-one 0  discard=1   vdev=hda target=/some/disk/image.raw
-
-expected <<END
-disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
-    "pdev_path": "/some/disk/image.raw",
-    "vdev": "hda",
-    "backend": "unknown",
-    "format": "raw",
-    "script": null,
-    "removable": 0,
-    "readwrite": 1,
-    "is_cdrom": 0,
-    "direct_io_safe": false,
-    "discard_enable": "False"
-}
-
-END

 one 0  discard vdev=hda target=/some/disk/image.raw one 0  discard vdev=hda target=/some/disk/image.raw
 expected <<END
 disk: {
-    "backend_domid": 0,
-    "backend_domname": null,
     "pdev_path": "/some/disk/image.iso", "vdev": "hda",
-    "backend": "unknown",
     "format": "raw",

Quoted 8 lines

-    "script": null,
     "removable": 1,
-    "readwrite": 0,
     "is_cdrom": 1,
-    "direct_io_safe": false,
     "discard_enable": "False"
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#2 lore raw
Quoted 7 lines · Ian Campbell
Quoted 5 lines · Wei Liu

The block-attach command now returns 1 when fails. Update first test case to expect return value 1 instead of 255.

The parser now doesn't generate output for default values. Remove them from expected output.

Quoted 7 lines

This it looks good.

Quoted 2 lines

The "discard=" variant is never not supported, so delete two test cases with that variant.

I don't follow (the double negative "never not" doesn't help).

Duh, I didn't intend to use double negation.

Quoted 4 lines

However, assuming you are saying that discard= is always supported, I don't then see the rationale for removing the test. Of course we do want to test things which are supported.

No, it is not supported. I dug into mailing list archive last night and confirmed that Ian J asked Olaf to remove such variant. Those test cases were residual from a previous version Olaf failed to remove.

Wei.

author
#3 lore raw
Quoted 18 lines · Wei Liu
Quoted 7 lines · Ian Campbell
Quoted 5 lines · Wei Liu

The block-attach command now returns 1 when fails. Update first test case to expect return value 1 instead of 255.

The parser now doesn't generate output for default values. Remove them from expected output.

Quoted 7 lines

This it looks good.

Quoted 2 lines

The "discard=" variant is never not supported, so delete two test cases with that variant.

I don't follow (the double negative "never not" doesn't help).

Duh, I didn't intend to use double negation.

Quoted 9 lines
Quoted 4 lines

However, assuming you are saying that discard= is always supported, I don't then see the rationale for removing the test. Of course we do want to test things which are supported.

No, it is not supported. I dug into mailing list archive last night and confirmed that Ian J asked Olaf to remove such variant. Those test cases were residual from a previous version Olaf failed to remove.

Forgot to paste in the references:

commit 417e6b70d73ffe8f8d3938aa30a413b35098e614 in xen.git

http://lists.xen.org/archives/html/xen-devel/2014-05/msg01063.html

Quoted 1 line

Wei.

#4 lore raw
Quoted 13 lines · Wei Liu
Quoted 12 lines · Wei Liu
Quoted 11 lines · Ian Campbell
Quoted 7 lines · Wei Liu

The block-attach command now returns 1 when fails. Update first test
case to expect return value 1 instead of 255.

The parser now doesn't generate output for default values. Remove them
from expected output.

This it looks good.

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

The "discard=" variant is never not supported, so delete two test cases
with that variant.

I don't follow (the double negative "never not" doesn't help).

Duh, I didn't intend to use double negation.

You meant "...was never supported..." then I think?

Quoted 13 lines
Quoted 7 lines
Quoted 6 lines

However, assuming you are saying that discard= is always supported, I don't
then see the rationale for removing the test. Of course we do want to test
things which are supported.

Quoted 5 lines

No, it is not supported. I dug into mailing list archive last night and confirmed that Ian J asked Olaf to remove such variant. Those test cases
were residual from a previous version Olaf failed to remove.

Quoted 5 lines

Forgot to paste in the references:

commit 417e6b70d73ffe8f8d3938aa30a413b35098e614 in xen.git

http://lists.xen.org/archives/html/xen-devel/2014-05/msg01063.html

Thanks, please include the commit reference in the v2 commit for this change.

Ian.