diff mbox

[for-4.7] hotplug/Linux: fix same_vm check in block script

Message ID 1460566956-29790-1-git-send-email-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu April 13, 2016, 5:02 p.m. UTC
The original same_vm check has two bugs. When stubdom is in use because
it relies on numeric domid to check if two domains are in fact the same
one.  Another one is that the check would fail when two stubdoms are
checked against each other.

The first bug is fixed by using uuid to identify a domain. The second
bug is fixed by comparing the domains two stubdoms serve.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>

This should fix osstest stubdom local migration test. Local migration
without stubdom is also tested and passed.
---
 tools/hotplug/Linux/block-common.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Ian Jackson April 14, 2016, 6:13 p.m. UTC | #1
Wei Liu writes ("[PATCH for-4.7] hotplug/Linux: fix same_vm check in block script"):
> The original same_vm check has two bugs. When stubdom is in use because
> it relies on numeric domid to check if two domains are in fact the same
> one.  Another one is that the check would fail when two stubdoms are
> checked against each other.
> 
> The first bug is fixed by using uuid to identify a domain. The second
> bug is fixed by comparing the domains two stubdoms serve.
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> 
> This should fix osstest stubdom local migration test. Local migration
> without stubdom is also tested and passed.

This looks plausible to me.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Thanks,
Ian.
Wei Liu April 15, 2016, 9:55 a.m. UTC | #2
On Thu, Apr 14, 2016 at 07:13:29PM +0100, Ian Jackson wrote:
> Wei Liu writes ("[PATCH for-4.7] hotplug/Linux: fix same_vm check in block script"):
> > The original same_vm check has two bugs. When stubdom is in use because
> > it relies on numeric domid to check if two domains are in fact the same
> > one.  Another one is that the check would fail when two stubdoms are
> > checked against each other.
> > 
> > The first bug is fixed by using uuid to identify a domain. The second
> > bug is fixed by comparing the domains two stubdoms serve.
> > 
> > Signed-off-by: Wei Liu <wei.liu2@citrix.com>
> > ---
> > Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> > 
> > This should fix osstest stubdom local migration test. Local migration
> > without stubdom is also tested and passed.
> 
> This looks plausible to me.
> 
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 

FAOD:

Release-acked-by: Wei Liu <wei.liu2@citrix.com>

> Thanks,
> Ian.
Ian Jackson April 15, 2016, 11:02 a.m. UTC | #3
Wei Liu writes ("Re: [PATCH for-4.7] hotplug/Linux: fix same_vm check in block script"):
> Release-acked-by: Wei Liu <wei.liu2@citrix.com>

Queued, thanks.

Ian.
diff mbox

Patch

diff --git a/tools/hotplug/Linux/block-common.sh b/tools/hotplug/Linux/block-common.sh
index 35110b4..f86a88c 100644
--- a/tools/hotplug/Linux/block-common.sh
+++ b/tools/hotplug/Linux/block-common.sh
@@ -112,14 +112,17 @@  same_vm()
                   "$FRONTEND_UUID")
   local target=$(xenstore_read_default  "/local/domain/$FRONTEND_ID/target"   \
                  "-1")
+  local targetvm=$(xenstore_read_default "/local/domain/$target/vm" "-1")
   local otarget=$(xenstore_read_default  "/local/domain/$otherdom/target"   \
                  "-1")
   local otvm=$(xenstore_read_default  "/local/domain/$otarget/vm"   \
                  "-1")
   otvm=${otvm%-1}
   othervm=${othervm%-1}
+  targetvm=${targetvm%-1}
   local frontend_uuid=${FRONTEND_UUID%-1}
   
-  [ "$frontend_uuid" = "$othervm" -o "$target" = "$otherdom" -o "$frontend_uuid" = "$otvm" ]
+  [ "$frontend_uuid" = "$othervm" -o "$targetvm" = "$othervm" -o \
+    "$frontend_uuid" = "$otvm" -o "$targetvm" = "$otvm" ]
 }