From f5e7ed5d267b33712f62a61356ed5ead4f8a367c Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Fri, 5 Mar 2010 18:41:16 -0800 Subject: [PATCH] Add "external_ids" column to Open_vSwitch table, add "system-uuid" on Xen. 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 | 3 +++ vswitchd/vswitch.xml | 12 ++++++++++++ xenserver/etc_init.d_vswitch | 12 ++++++++++++ 3 files changed, 27 insertions(+) diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema index 3a203854..f0217cda 100644 --- a/vswitchd/vswitch.ovsschema +++ b/vswitchd/vswitch.ovsschema @@ -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": { diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 9b1d76ae..94b5972d 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -29,6 +29,18 @@ SSL used globally by the daemon. + + + Key-value pairs that identify this Open vSwitch's role in + external systems. The currently defined key-value pairs are: +
+
system-uuid
+
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., xe host-list.
+
+
diff --git a/xenserver/etc_init.d_vswitch b/xenserver/etc_init.d_vswitch index 480f9a9c..b1014a71 100755 --- a/xenserver/etc_init.d_vswitch +++ b/xenserver/etc_init.d_vswitch @@ -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 -- 2.30.2