Skip to contentSkip to conversation

better same_vm checks

PATCH New Stefano Stabellini 1 participant 1 message Aug 18, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 better same_vm checks

Hi all,
currently the function same_vm in block-common.sh is the one responsible for detecting if two block devices can be used at the same time by two VMs.
This can be allowed in few specific cases: when the two VMs are actually the same VM and when the two VMs are the guest and its stubdomain. We need to expand these exceptions to handle properly save restore
issues: this patch adds to the exceptions the case when two VMs are the same VM because of save\restore races, and when two VMs are the guest and the stubdomain of the previous guest, again during save\restore.

---

tools/hotplug/Linux/block-common.sh +9 -1
diff -r 8b0f1f37e145 tools/hotplug/Linux/block-common.sh
@@ -112,6 +112,14 @@
                   "$FRONTEND_UUID")
   local target=$(xenstore_read_default  "/local/domain/$FRONTEND_ID/target"   \
                  "-1")
-  [ "$FRONTEND_UUID" = "$othervm" -o "$target" = "$otherdom" ]
+  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}
+  local frontend_uuid=${FRONTEND_UUID%-1}
+  
+  [ "$frontend_uuid" = "$othervm" -o "$target" = "$otherdom" -o "$frontend_uuid" = "$otvm" ]
 }