While your patch did work, it removed some default functionality from the script while running in dom0.  I wrote up the following and have patched it into my scripts on both my dom0 and driver domu.

It just checks to see if /proc/xen/capabilities exists and is empty, if so it only creates the domid and mac external-ids.

If it's not empty, it then reverts to its normal behavior adding the mac, vm-uuid and vm-name external-ids.

This way, the same script can operate on both dom0 and driver domu without any changes.


Thanks for pointing me in the right direction!

Mike


On 12/4/2017 9:50 AM, George Dunlap wrote:
On Mon, Dec 4, 2017 at 3:40 AM, m...@ark-net.org <m...@ark-net.org> wrote:
So I figured out that I don't need a running instance of xenstored on the
driver domain, since xenstore-read works for the driver domains own trees in
xenstore.  Are the xenstore-read errors in vif-openvswitch because that
script is written to be run on dom0 only?  Do I need to create a new vif
script that is specific to driver domains?
It sounds like that's a bug in the vif-openvswitch script -- it
shouldn't rely on reading data from the domain's "private" xenstore
area (available to domain 0 but not to a driver domain).

Can you try the attached patch and see if it helps?

  -George

diff --git a/tools/hotplug/Linux/vif-openvswitch 
b/tools/hotplug/Linux/vif-openvswitch
index 18bfb6cefb..ae3399bd1d 100644
--- a/tools/hotplug/Linux/vif-openvswitch
+++ b/tools/hotplug/Linux/vif-openvswitch
@@ -46,14 +46,22 @@ openvswitch_external_id() {

 openvswitch_external_id_all() {
     local dev=$1
-    local frontend_id=$(xenstore_read "$XENBUS_PATH/frontend-id")
-    local vm_path=$(xenstore_read "/local/domain/${frontend_id}/vm")
-    local name=$(xenstore_read "${vm_path}/name")
-    openvswitch_external_id $dev "xen-vm-name" "$name"
-    local uuid=$(xenstore_read "${vm_path}/uuid")
-    openvswitch_external_id $dev "xen-vm-uuid" "$uuid"
-    local mac=$(xenstore_read "$XENBUS_PATH/mac")
-    openvswitch_external_id $dev "attached-mac" "$mac"
+    if [ -f /proc/xen/capabilities ]; then
+        local frontend_id=$(xenstore_read "$XENBUS_PATH/frontend-id")
+        local mac=$(xenstore_read "$XENBUS_PATH/mac")
+        openvswitch_external_id $dev "attached-mac" "$mac"
+        if [ "$(cat /proc/xen/capabilities)x" == "x" ]; then
+            # We're running in a driver domain, so don't try to get any
+            # privileged data from domu xenstore path.
+            openvswitch_external_id $dev "xen-vm-domid" "$frontend_id"
+        else
+            local vm_path=$(xenstore_read "/local/domain/${frontend_id}/vm")
+            local name=$(xenstore_read "${vm_path}/name")
+            openvswitch_external_id $dev "xen-vm-name" "$name"
+            local uuid=$(xenstore_read "${vm_path}/uuid")
+            openvswitch_external_id $dev "xen-vm-uuid" "$uuid"
+        fi
+    fi
 }

 add_to_openvswitch () {
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to