diff mbox

[v2,4/4] qemu-iotests: Check common namespace for id and node-name

Message ID 1397749715-15701-5-git-send-email-kwolf@redhat.com
State New
Headers show

Commit Message

Kevin Wolf April 17, 2014, 3:48 p.m. UTC
A name that is taken by an ID can't be taken by a node-name at the same
time. Check that conflicts are correctly detected.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/087     | 52 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/087.out |  5 +++++
 2 files changed, 57 insertions(+)

Comments

Fam Zheng April 21, 2014, 7:01 a.m. UTC | #1
On Thu, 04/17 17:48, Kevin Wolf wrote:
> A name that is taken by an ID can't be taken by a node-name at the same
> time. Check that conflicts are correctly detected.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/qemu-iotests/087     | 52 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/qemu-iotests/087.out |  5 +++++
>  2 files changed, 57 insertions(+)
> 
>  
> diff --git a/tests/qemu-iotests/087.out b/tests/qemu-iotests/087.out
> index 479bf86..7fbee3f 100644
> --- a/tests/qemu-iotests/087.out
> +++ b/tests/qemu-iotests/087.out
> @@ -20,6 +20,11 @@ QMP_VERSION
>  {"return": {}}
>  {"return": {}}
>  {"error": {"class": "GenericError", "desc": "Device with id 'disk' already exists"}}
> +{"error": {"class": "GenericError", "desc": "Device with node-name 'test-node' already exists"}}
> +main-loop: WARNING: I/O thread spun for 1000 iterations

Is this warning message deterministic? I think we could avoid the guest code by
'-machine accel=qtest'.

BTW I intended to write a patch for this but it would have some overlap with
Jeff's qemu-iotests common.qemu series:

https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg01733.html

Fam

> +{"error": {"class": "GenericError", "desc": "could not open disk image disk2: node-name=disk is conflicting with a device id"}}
> +{"error": {"class": "GenericError", "desc": "could not open disk image disk2: Duplicate node name"}}
> +{"error": {"class": "GenericError", "desc": "could not open disk image disk3: node-name=disk3 is conflicting with a device id"}}
>  {"return": {}}
>  {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN"}
>  {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}}
> -- 
> 1.8.3.1
> 
>
Kevin Wolf April 22, 2014, 10:04 a.m. UTC | #2
Am 21.04.2014 um 09:01 hat Fam Zheng geschrieben:
> On Thu, 04/17 17:48, Kevin Wolf wrote:
> > A name that is taken by an ID can't be taken by a node-name at the same
> > time. Check that conflicts are correctly detected.
> > 
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > ---
> >  tests/qemu-iotests/087     | 52 ++++++++++++++++++++++++++++++++++++++++++++++
> >  tests/qemu-iotests/087.out |  5 +++++
> >  2 files changed, 57 insertions(+)
> > 
> >  
> > diff --git a/tests/qemu-iotests/087.out b/tests/qemu-iotests/087.out
> > index 479bf86..7fbee3f 100644
> > --- a/tests/qemu-iotests/087.out
> > +++ b/tests/qemu-iotests/087.out
> > @@ -20,6 +20,11 @@ QMP_VERSION
> >  {"return": {}}
> >  {"return": {}}
> >  {"error": {"class": "GenericError", "desc": "Device with id 'disk' already exists"}}
> > +{"error": {"class": "GenericError", "desc": "Device with node-name 'test-node' already exists"}}
> > +main-loop: WARNING: I/O thread spun for 1000 iterations
> 
> Is this warning message deterministic? I think we could avoid the guest code by
> '-machine accel=qtest'.

At least it's deterministic enough that the test case never failed for
me in multiple runs on two different machines with different OS versions
(RHEL 6 and 7).

> BTW I intended to write a patch for this but it would have some overlap with
> Jeff's qemu-iotests common.qemu series:

Then let's commit this as it is and once Jeff's series is in, you can
fix up everything at once?

Kevin
Fam Zheng April 22, 2014, 10:09 a.m. UTC | #3
On Tue, 04/22 12:04, Kevin Wolf wrote:
> Am 21.04.2014 um 09:01 hat Fam Zheng geschrieben:
> > On Thu, 04/17 17:48, Kevin Wolf wrote:
> > > A name that is taken by an ID can't be taken by a node-name at the same
> > > time. Check that conflicts are correctly detected.
> > > 
> > > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > > ---
> > >  tests/qemu-iotests/087     | 52 ++++++++++++++++++++++++++++++++++++++++++++++
> > >  tests/qemu-iotests/087.out |  5 +++++
> > >  2 files changed, 57 insertions(+)
> > > 
> > >  
> > > diff --git a/tests/qemu-iotests/087.out b/tests/qemu-iotests/087.out
> > > index 479bf86..7fbee3f 100644
> > > --- a/tests/qemu-iotests/087.out
> > > +++ b/tests/qemu-iotests/087.out
> > > @@ -20,6 +20,11 @@ QMP_VERSION
> > >  {"return": {}}
> > >  {"return": {}}
> > >  {"error": {"class": "GenericError", "desc": "Device with id 'disk' already exists"}}
> > > +{"error": {"class": "GenericError", "desc": "Device with node-name 'test-node' already exists"}}
> > > +main-loop: WARNING: I/O thread spun for 1000 iterations
> > 
> > Is this warning message deterministic? I think we could avoid the guest code by
> > '-machine accel=qtest'.
> 
> At least it's deterministic enough that the test case never failed for
> me in multiple runs on two different machines with different OS versions
> (RHEL 6 and 7).
> 
> > BTW I intended to write a patch for this but it would have some overlap with
> > Jeff's qemu-iotests common.qemu series:
> 
> Then let's commit this as it is and once Jeff's series is in, you can
> fix up everything at once?
> 

OK, works for me:

Reviewed-by: Fam Zheng <famz@redhat.com>
diff mbox

Patch

diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087
index 37d82fc..82c56b1 100755
--- a/tests/qemu-iotests/087
+++ b/tests/qemu-iotests/087
@@ -83,6 +83,7 @@  run_qemu <<EOF
       "options": {
         "driver": "$IMGFMT",
         "id": "disk",
+        "node-name": "test-node",
         "file": {
             "driver": "file",
             "filename": "$TEST_IMG"
@@ -102,6 +103,57 @@  run_qemu <<EOF
       }
     }
   }
+{ "execute": "blockdev-add",
+  "arguments": {
+      "options": {
+        "driver": "$IMGFMT",
+        "id": "test-node",
+        "file": {
+            "driver": "file",
+            "filename": "$TEST_IMG"
+        }
+      }
+    }
+  }
+{ "execute": "blockdev-add",
+  "arguments": {
+      "options": {
+        "driver": "$IMGFMT",
+        "id": "disk2",
+        "node-name": "disk",
+        "file": {
+            "driver": "file",
+            "filename": "$TEST_IMG"
+        }
+      }
+    }
+  }
+{ "execute": "blockdev-add",
+  "arguments": {
+      "options": {
+        "driver": "$IMGFMT",
+        "id": "disk2",
+        "node-name": "test-node",
+        "file": {
+            "driver": "file",
+            "filename": "$TEST_IMG"
+        }
+      }
+    }
+  }
+{ "execute": "blockdev-add",
+  "arguments": {
+      "options": {
+        "driver": "$IMGFMT",
+        "id": "disk3",
+        "node-name": "disk3",
+        "file": {
+            "driver": "file",
+            "filename": "$TEST_IMG"
+        }
+      }
+    }
+  }
 { "execute": "quit" }
 EOF
 
diff --git a/tests/qemu-iotests/087.out b/tests/qemu-iotests/087.out
index 479bf86..7fbee3f 100644
--- a/tests/qemu-iotests/087.out
+++ b/tests/qemu-iotests/087.out
@@ -20,6 +20,11 @@  QMP_VERSION
 {"return": {}}
 {"return": {}}
 {"error": {"class": "GenericError", "desc": "Device with id 'disk' already exists"}}
+{"error": {"class": "GenericError", "desc": "Device with node-name 'test-node' already exists"}}
+main-loop: WARNING: I/O thread spun for 1000 iterations
+{"error": {"class": "GenericError", "desc": "could not open disk image disk2: node-name=disk is conflicting with a device id"}}
+{"error": {"class": "GenericError", "desc": "could not open disk image disk2: Duplicate node name"}}
+{"error": {"class": "GenericError", "desc": "could not open disk image disk3: node-name=disk3 is conflicting with a device id"}}
 {"return": {}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN"}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}}