Add "external_ids" column to Open_vSwitch table, add "system-uuid" on Xen.
authorJustin Pettit <jpettit@nicira.com>
Sat, 6 Mar 2010 02:41:16 +0000 (18:41 -0800)
committerJustin Pettit <jpettit@nicira.com>
Thu, 11 Mar 2010 01:15:25 +0000 (17:15 -0800)
Software that interfaces to Open vSwitch needs a way to identify the
host that the switch is running on.  This commit adds such a way.

Cleaned up version of original implementation by Ben Pfaff.

vswitchd/vswitch.ovsschema
vswitchd/vswitch.xml
xenserver/etc_init.d_vswitch

index 3a20385..f0217cd 100644 (file)
@@ -16,6 +16,9 @@
          "type": {"key": {"type": "uuid",
                           "refTable": "SSL"},
                   "min": 0, "max": 1}},
+       "external_ids": {
+         "type": {"key": "string", "value": "string",
+                  "min": 0, "max": "unlimited"}},
        "next_cfg": {
          "type": "integer"},
        "cur_cfg": {
index 9b1d76a..94b5972 100644 (file)
       <column name="ssl">
         SSL used globally by the daemon.
       </column>
+
+      <column name="external_ids">
+        Key-value pairs that identify this Open vSwitch's role in
+        external systems.  The currently defined key-value pairs are:
+        <dl>
+          <dt><code>system-uuid</code></dt>
+          <dd>A universally unique identifier for the Open vSwitch's
+            physical host.  The form of the identifier depends on the
+            type of the host.  On a Citrix XenServer, this is the host
+            UUID displayed by, e.g., <code>xe host-list</code>.</dd>
+        </dl>
+      </column>
     </group>
 
     <group title="Status">
index 480f9a9..b1014a7 100755 (executable)
@@ -318,6 +318,16 @@ EOF
     esac
 }
 
+function set_system_uuid {
+    system_uuid=$(. /etc/xensource-inventory && echo $INSTALLATION_UUID)
+    if test -n "$system_uuid"; then
+        action "Configuring Open vSwitch system UUID" true
+        $vsctl set Open_vSwitch . external-ids:system-uuid="$system_uuid"
+    else
+        action "Configuring Open vSwitch system UUID" false
+    fi
+}
+
 function start {
     if [ "$FORCE_COREFILES" = "y" ]; then
         turn_on_corefiles
@@ -351,6 +361,8 @@ function start {
         done
     fi
 
+    set_system_uuid
+
     start_vswitchd
     start_brcompatd
     touch /var/lock/subsys/vswitch