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 3a20385406ea0fa6a1994b439d5193d742c3ba83..f0217cdaad7feb462016b5202c88635415194a5a 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 9b1d76ae18bc9a57e0050f028ab5c916ba92e743..94b5972d13fa0219191a605c1bf1268fa6f20fec 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 480f9a9c42f84d8b1dda96e3d2f6a5707e380707..b1014a711a8ec0f3e262c152287359539f826acb 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