Skip to contentSkip to conversation

hotplug/Linux: fix same_vm check in block script

PATCH Applied Wei Liu 2 participants 4 messages Apr 13, 2016 – Apr 15, 2016

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 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.

---
Cc: Ian Jackson <[email protected]>

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(-)
tools/hotplug/Linux/block-common.sh +4 -1
index 35110b4..f86a88c 100644
@@ -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" ]
 }
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Acked-by on v1 1/1
#1 lore raw

Wei Liu writes ("[PATCH for-4.7] hotplug/Linux: fix same_vm check in block script"):

Quoted 8 lines

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.

Quoted 6 lines

---
Cc: Ian Jackson <[email protected]>

This should fix osstest stubdom local migration test. Local migration without stubdom is also tested and passed.

This looks plausible to me.

Thanks,
Ian.

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

author
#2 lore raw
Quoted 13 lines · Ian Jackson

Wei Liu writes ("[PATCH for-4.7] hotplug/Linux: fix same_vm check in block script"):

Quoted 12 lines

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.

---
Cc: Ian Jackson <[email protected]>

Quoted 7 lines
Quoted 2 lines

This should fix osstest stubdom local migration test. Local migration without stubdom is also tested and passed.

This looks plausible to me.

FAOD:

Quoted 2 lines

Thanks,
Ian.

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