diff options
author | Greg Rose <gvrose8192@gmail.com> | 2022-08-08 13:36:02 -0700 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2022-08-15 13:07:13 +0200 |
commit | 83c9518e7c67fb73ab17f6db50f398dc78403814 (patch) | |
tree | 7290abe2d043c4f30d55975f6f2d25608a9feadc /vswitchd | |
parent | ac1332216eb3a1857b942457e1b44a22512b092d (diff) | |
download | openvswitch-83c9518e7c67fb73ab17f6db50f398dc78403814.tar.gz |
xenserver: Remove xenserver.
Remove the current xenserver implementation - it is obsolete and
since 3.0 we do not support kernel module builds [1].
1. https://mail.openvswitch.org/pipermail/ovs-dev/2022-July/395789.html
[i.maximets]
Can be added back if people willing to maintain it will be found.
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'vswitchd')
-rw-r--r-- | vswitchd/automake.mk | 4 | ||||
-rw-r--r-- | vswitchd/bridge.c | 52 | ||||
-rw-r--r-- | vswitchd/xenserver.c | 79 | ||||
-rw-r--r-- | vswitchd/xenserver.h | 21 |
4 files changed, 5 insertions, 151 deletions
diff --git a/vswitchd/automake.mk b/vswitchd/automake.mk index 595d1e46a..830c9a188 100644 --- a/vswitchd/automake.mk +++ b/vswitchd/automake.mk @@ -8,9 +8,7 @@ vswitchd_ovs_vswitchd_SOURCES = \ vswitchd/bridge.h \ vswitchd/ovs-vswitchd.c \ vswitchd/system-stats.c \ - vswitchd/system-stats.h \ - vswitchd/xenserver.c \ - vswitchd/xenserver.h + vswitchd/system-stats.h vswitchd_ovs_vswitchd_LDADD = \ ofproto/libofproto.la \ lib/libsflow.la \ diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 1db74de9d..25ce45e3d 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -70,7 +70,6 @@ #include "util.h" #include "unixctl.h" #include "lib/vswitch-idl.h" -#include "xenserver.h" #include "vlan-bitmap.h" VLOG_DEFINE_THIS_MODULE(bridge); @@ -299,9 +298,7 @@ static void bridge_configure_remotes(struct bridge *, static void bridge_pick_local_hw_addr(struct bridge *, struct eth_addr *ea, struct iface **hw_addr_iface); static uint64_t bridge_pick_datapath_id(struct bridge *, - const struct eth_addr bridge_ea, - struct iface *hw_addr_iface); -static uint64_t dpid_from_hash(const void *, size_t nbytes); + const struct eth_addr bridge_ea); static bool bridge_has_bond_fake_iface(const struct bridge *, const char *name); static bool port_is_bond_fake_iface(const struct port *); @@ -1329,7 +1326,7 @@ bridge_configure_datapath_id(struct bridge *br) } br->ea = ea; - dpid = bridge_pick_datapath_id(br, ea, hw_addr_iface); + dpid = bridge_pick_datapath_id(br, ea); if (dpid != ofproto_get_datapath_id(br->ofproto)) { VLOG_INFO("bridge %s: using datapath ID %016"PRIx64, br->name, dpid); ofproto_set_datapath_id(br->ofproto, dpid); @@ -2362,14 +2359,10 @@ bridge_pick_local_hw_addr(struct bridge *br, struct eth_addr *ea, } /* Choose and returns the datapath ID for bridge 'br' given that the bridge - * Ethernet address is 'bridge_ea'. If 'bridge_ea' is the Ethernet address of - * an interface on 'br', then that interface must be passed in as - * 'hw_addr_iface'; if 'bridge_ea' was derived some other way, then - * 'hw_addr_iface' must be passed in as a null pointer. */ + * Ethernet address is 'bridge_ea'. */ static uint64_t bridge_pick_datapath_id(struct bridge *br, - const struct eth_addr bridge_ea, - struct iface *hw_addr_iface) + const struct eth_addr bridge_ea) { /* * The procedure for choosing a bridge MAC address will, in the most @@ -2391,46 +2384,9 @@ bridge_pick_datapath_id(struct bridge *br, return dpid; } - if (!hw_addr_iface) { - /* - * A purely internal bridge, that is, one that has no non-virtual - * network devices on it at all, is difficult because it has no - * natural unique identifier at all. - * - * When the host is a XenServer, we handle this case by hashing the - * host's UUID with the name of the bridge. Names of bridges are - * persistent across XenServer reboots, although they can be reused if - * an internal network is destroyed and then a new one is later - * created, so this is fairly effective. - * - * When the host is not a XenServer, we punt by using a random MAC - * address on each run. - */ - const char *host_uuid = xenserver_get_host_uuid(); - if (host_uuid) { - char *combined = xasprintf("%s,%s", host_uuid, br->name); - dpid = dpid_from_hash(combined, strlen(combined)); - free(combined); - return dpid; - } - } - return eth_addr_to_uint64(bridge_ea); } -static uint64_t -dpid_from_hash(const void *data, size_t n) -{ - union { - uint8_t bytes[SHA1_DIGEST_SIZE]; - struct eth_addr ea; - } hash; - - sha1_bytes(data, n, hash.bytes); - eth_addr_mark_random(&hash.ea); - return eth_addr_to_uint64(hash.ea); -} - static void iface_refresh_netdev_status(struct iface *iface) { diff --git a/vswitchd/xenserver.c b/vswitchd/xenserver.c deleted file mode 100644 index 9a0afea98..000000000 --- a/vswitchd/xenserver.c +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright (c) 2009, 2010, 2013 Nicira, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <config.h> -#include "xenserver.h" -#include <ctype.h> -#include <errno.h> -#include <pthread.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include "openvswitch/dynamic-string.h" -#include "process.h" -#include "util.h" -#include "openvswitch/vlog.h" - -VLOG_DEFINE_THIS_MODULE(xenserver); - -/* If running on a XenServer, the XenServer host UUID as a 36-character string, - * otherwise null. */ -static char *host_uuid; - -static void -read_host_uuid(void) -{ - static const char filename[] = "/etc/xensource-inventory"; - char line[128]; - FILE *file; - - file = fopen(filename, "r"); - if (!file) { - if (errno == ENOENT) { - VLOG_DBG("not running on a XenServer"); - } else { - VLOG_INFO("%s: open: %s", filename, ovs_strerror(errno)); - } - return; - } - - while (fgets(line, sizeof line, file)) { - static const char leader[] = "INSTALLATION_UUID='"; - const int leader_len = strlen(leader); - const int uuid_len = 36; - static const char trailer[] = "'\n"; - const int trailer_len = strlen(trailer); - - if (strlen(line) == leader_len + uuid_len + trailer_len - && !memcmp(line, leader, leader_len) - && !memcmp(line + leader_len + uuid_len, trailer, trailer_len)) { - host_uuid = xmemdup0(line + leader_len, uuid_len); - VLOG_INFO("running on XenServer, host-uuid %s", host_uuid); - fclose(file); - return; - } - } - fclose(file); - VLOG_ERR("%s: INSTALLATION_UUID not found", filename); -} - -const char * -xenserver_get_host_uuid(void) -{ - static pthread_once_t once = PTHREAD_ONCE_INIT; - pthread_once(&once, read_host_uuid); - return host_uuid; -} - diff --git a/vswitchd/xenserver.h b/vswitchd/xenserver.h deleted file mode 100644 index 48c7461e6..000000000 --- a/vswitchd/xenserver.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (c) 2009 Nicira, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VSWITCHD_XENSERVER_H -#define VSWITCHD_XENSERVER_H 1 - -const char *xenserver_get_host_uuid(void); - -#endif /* xenserver.h */ |