2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-29 08:41:00 +00:00

Compare commits

..

30 Commits

Author SHA1 Message Date
Jarrod Johnson e40c362743 Fix network configuration changes through collective 2021-03-16 14:54:26 -04:00
Jarrod Johnson cafbc1d1c2 Have tty2 also run a shell
Some may find switching VTs to be more intuitive
than tmux session management. Provide one extra
on tty2 for such a scenario.
2021-03-13 12:50:44 -05:00
Jarrod Johnson 797e197bc7 Have tmux keep reattaching
If someone accidentally detaches, then intervene and
reattach.
2021-03-13 12:50:37 -05:00
Jarrod Johnson 19d4a3a83f Have autocons attempt sizing of serial console
If a terminal is open during autocons, that terminal
will be the size of the console.

Otherwise, fallback to 100x31.
2021-03-13 12:50:21 -05:00
Jarrod Johnson 874947076d Fix local console behavior in genesis
This will have the vga console be less concerning.
2021-03-12 13:55:33 -05:00
Jarrod Johnson ffe0754dd9 Fix typo in confluent profile.yaml
The quiet argument was missed due to typo in parameter name.
2021-03-12 12:44:19 -05:00
Jarrod Johnson bbb8e50c3e Fix configbmc gateway check
It erroneously linked to prefix to check gateway or not.
2021-03-11 16:28:01 -05:00
Jarrod Johnson 4f246e6a41 Fix compatibility with some switch configurations
While some implementations mess up portid and need portdescr instead, others are
just the opposite.

Tolerate match either by description or name.
2021-03-10 13:41:59 -05:00
Jarrod Johnson c53e758170 Workaround non-cisco switch crash
Querying Cisco MIB on certain
firmware levels of non-cisco switches
causes a crash.  Tolerate and
wait a bit to give SNMP a chance to restart.
2021-03-10 13:41:52 -05:00
Jarrod Johnson 1a7c238b54 Handle malformed json data more gracefully 2021-03-10 13:41:45 -05:00
Jarrod Johnson 94a4a7e20b Fix missing exit code in nomededia
nodemedia was not setting return code on exit properly.
2021-03-08 08:01:30 -05:00
Jarrod Johnson c9157b90eb Close other places that may be false negative
Have checks for neightable be preceeded by an attempt to refresh,
to mitigate false negatives.
2021-03-05 13:15:37 -05:00
Jarrod Johnson 5d0423c38b Attempt refresh of neigh table on miss
When an address is new it may not be in the last
captured neighbor table. Induce refresh before deciding
that neighbor is unavailable.
2021-03-05 13:09:54 -05:00
Jarrod Johnson e583d34555 Fix nic index map with bonding
The assumption that /sys/class/net is interfaces is incorrect,
when encountering entries that are not interfaces, do not
mess up the call.
2021-03-04 10:49:23 -05:00
Jarrod Johnson 95466392f9 Fix typo in confluentdbutil
The restore function would fail
to chown directories due to typo
2021-03-01 10:32:13 -05:00
Jarrod Johnson b3857f8d33 Fix chained discovery of DWC SMMv2
SMMv2 for DWC has more ports. Make the code
not care about which port is which for checking
for matching smm fingerprints.
2021-03-01 10:32:05 -05:00
Jarrod Johnson 7eb06f2722 Improve concurrency of SLP
During a scan, unicast TCP
interrogation of candidates
was done serially. Do this
concurrently so that poorly
behaving targets do not prolong
a scan.
2021-02-26 13:31:07 -05:00
Jarrod Johnson 8cf264602d Update status at end of esxi install 2021-02-05 14:02:28 -05:00
Jarrod Johnson a2f5b11185 Add Usb to nodesetboot
Particularly for redfish, this is a more specific target
2021-02-01 08:43:47 -05:00
Jarrod Johnson a9e39eab96 Fix path mistake in mofed.post script
mofed.post had incorrect path to mofed.tgz after
fetch. Correct the path mistake.
2021-01-28 16:50:50 -05:00
Jarrod Johnson d29d2bf683 Implement workaround for install over infiniband
8.3 implemented networkmanager to manage the install time
networking, but didn't correctly generate infiniband
network manager configuration.

Workaround by checking for infiniband install, and
then checking if the configuration is wrong, and
adding an infiniband section if missing.
2021-01-28 13:49:10 -05:00
Jarrod Johnson 6458eac93b Tolerate multiple forms of 'stringy'
The fromstring needs to accept either, so
amend it to do so.
2021-01-22 12:43:15 -05:00
Jarrod Johnson 8df15b3a54 Tolerate different SR635/SR655 response
Some SR635/SR655 behave differently.  Adjust by adapting as possible,
but never making an assumption about data being present.
2021-01-22 10:30:19 -05:00
Jarrod Johnson b4f9bb78ae Address irrelavent call to yaml.load 2021-01-21 17:48:56 -05:00
Jarrod Johnson c8e1efecdb Mitigate XML parse risks
The intended xml never has !entity tags and
thus we can reject any such XML outright and
avoid billion laughs and similar abuses.
2021-01-21 17:46:21 -05:00
Jarrod Johnson 22dc852277 Remove now redundent errors
printerror now searches for deeper errors,
no longer need to call it as much.
2021-01-21 16:38:35 -05:00
Jarrod Johnson 784ac5ecba Fix gitignore to track ronn files 2021-01-21 11:52:22 -05:00
Jarrod Johnson 66c9777b3c Add man page for stats command 2021-01-21 11:36:08 -05:00
Jarrod Johnson dba4c40f0e Fix collective join with empty config
Collective join without a key set would fail on
first try.
2021-01-21 11:19:13 -05:00
Jarrod Johnson 6997508a0c Fallback to forced utf8 on unicodeerror
If LC_ALL is set to C, then unicode can be a problem.
2021-01-21 08:41:35 -05:00
28 changed files with 214 additions and 48 deletions
-1
View File
@@ -1,7 +1,6 @@
*.pyc
.*.
confluent_client/man/man*
confluent_client/doc/man
.vscode
.*.sw*
.sw*
+2
View File
@@ -948,6 +948,8 @@ def main():
clearpowermessage = False
try:
sys.stdout.write(data)
except UnicodeEncodeError:
sys.stdout.buffer.write(data.encode('utf8'))
except IOError: # Some times circumstances are bad
# resort to byte at a time...
for d in data:
-1
View File
@@ -278,7 +278,6 @@ if setmode:
rcode |= client.printerror(fr)
for node in fr.get('databynode', []):
r = fr['databynode'][node]
rcode |= client.printerror(r, node)
if 'value' not in r:
continue
keyval = r['value']
-1
View File
@@ -149,7 +149,6 @@ def show_firmware(session):
if 'databynode' not in res:
continue
for node in res['databynode']:
exitcode |= client.printerror(res['databynode'][node], node)
if 'firmware' not in res['databynode'][node]:
continue
for inv in res['databynode'][node]['firmware']:
+2
View File
@@ -187,5 +187,7 @@ def main():
argparser.print_help()
sys.exit(1)
handler(noderange, media)
if __name__ == '__main__':
main()
sys.exit(exitcode)
+1 -1
View File
@@ -32,7 +32,7 @@ if path.startswith('/opt'):
import confluent.client as client
argparser = optparse.OptionParser(
usage='Usage: %prog [options] noderange [default|cd|network|setup|hd|floppy]')
usage='Usage: %prog [options] noderange [default|cd|network|setup|hd|usb|floppy]')
argparser.add_option('-b', '--bios', dest='biosmode',
action='store_true', default=False,
help='Request BIOS style boot (rather than UEFI)')
+1 -1
View File
@@ -91,7 +91,7 @@ _confluent_nodeidentify_completion()
_confluent_nodesetboot_completion()
{
COMP_CANDIDATES=("default,cd,network,setup,hd,floppy -h -b -p")
COMP_CANDIDATES=("default,cd,network,setup,hd,floppy,usb -h -b -p")
_confluent_generic_completion
}
+5 -1
View File
@@ -4,7 +4,7 @@ nodesetboot(8) -- Check or set next boot device for noderange
## SYNOPSIS
`nodesetboot <noderange>`
`nodesetboot [options] <noderange> [default|cd|network|setup|hd|floppy]`
`nodesetboot [options] <noderange> [default|cd|network|setup|hd|usb|floppy]`
## DESCRIPTION
@@ -46,6 +46,10 @@ control.
Request boot from floppy. Generally speaking firmware uses this to mean a USB
flash drive or similar (whether virtual or physical).
* `usb`:
Request boot from usb. Generally speaking firmware uses this to mean a USB
flash drive or similar (whether virtual or physical).
* `network`:
Request boot to network
+49
View File
@@ -0,0 +1,49 @@
stats(8) -- Common basic statistics on typical numeric data in output
==============================
## SYNOPSIS
`<other command> | stats [-c N] [-d D] [-x|-g|-t|-o image.png] [-s N] [-v] [-b N]
## DESCRIPTION
The **stats** command helps analyze common numerical data such as performance numbers
or temperatures or any other numerical value.
By default it looks for the last numerical output on the first line to identify the numerical column
and analyze that number. This can be overriden by **-c COLUMN** to indicate a column. By default,
whitespace and commas are treated to delimit columns, and **-d DELIMITER** can be used to override.
By default it outputs basic statistics, but a histogram is available either text or through X11 output
or sixel or output to an image file depending on whether **-x**, **-g**, **-t*, or **-o image.png** is
used.
## OPTIONS
* `-c N`:
Select column number. Defaults to last column that appears numeric
* `-d D`:
Specify a custom column delimiter
* `-x`:
Output in Sixel format (supported by mlterm and PuTTY, among others)
* `-g`:
Try to open histogram as an X window
* `-t`:
Output histogram as bars rendered by =
* `-o image.png`:
Write graphical histogram to image.png.
* `-s N`:
Ignore specified number of lines as header content before processing numbers
* `-v`:
Treat value before : on each line as a label, and show which labels belong to which histogram buckets.
* `-b N`:
Specify a custom number of buckets for histogram. The default is 10.
@@ -11,7 +11,7 @@ if lspci -d 15b3:: -n |grep 15b3 > /dev/null; then
#mkdir MLNX_OFED
#mount -o loop ofed.iso MLNX_OFED
fetch_remote infiniband/mofed.tgz
tar xf mofed.tgz
tar xf infiniband/mofed.tgz
# The rest is common between tar and iso
cd MLNX_OFED*
mount -o loop ofed
@@ -109,5 +109,13 @@ done < /etc/confluent/confluent.deploycfg
if [ -e /lib/nm-lib.sh ]; then
. /lib/nm-lib.sh
nm_generate_connections
if [[ "$ifname" == ib* ]]; then
sed -i s/type=ethernet/type=infiniband/ /run/NetworkManager/system-connections/$ifname.nmconnection
if ! grep '\[infiniband\]' /run/NetworkManager/system-connections/$ifname.nmconnection > /dev/null; then
echo >> /run/NetworkManager/system-connections/$ifname.nmconnection
echo '[infiniband]' >> /run/NetworkManager/system-connections/$ifname.nmconnection
echo transport-mode=datagram >> /run/NetworkManager/system-connections/$ifname.nmconnection
fi
fi
fi
@@ -11,7 +11,7 @@ if lspci -d 15b3:: -n |grep 15b3 > /dev/null; then
#mkdir MLNX_OFED
#mount -o loop ofed.iso MLNX_OFED
fetch_remote infiniband/mofed.tgz
tar xf mofed.tgz
tar xf infiniband/mofed.tgz
# The rest is common between tar and iso
cd MLNX_OFED*
mount -o loop ofed
@@ -4,3 +4,8 @@ install --firstdisk --overwritevmfs
%include /tmp/ksnet
%include /tmp/rootpw
reboot
%post
localcli network firewall unload
STATUP=$(mktemp)
echo '{"status": "complete"}' > $STATUP
/opt/confluent/bin/apiclient /confluent-api/self/updatestatus $STATUP
@@ -8,14 +8,16 @@ if ! grep console= /proc/cmdline >& /dev/null; then
echo $autocons > /tmp/01-autocons.devnode
if [ ! -z "$autocons" ]; then
echo "Using $(cat /tmp/01-autocons.conf)"
tmux a <> $autocons >&0 2>&1 &
(while :; do tmux a <> $autocons >&0 2>&1; done) &
(while :; do TERM=linux tmux a <> /dev/tty1 >&0 2>&1; done) &
else
tmux a <> /dev/console >&0 2>&1 &
(while :; do tmux a <> /dev/console >&0 2>&1; done) &
fi
else
tmux a <> /dev/console >&0 2>&1 &
tmux a <> /dev/tty1 >&0 2>&1 &
(while :; do tmux a <> /dev/console >&0 2>&1; done) &
(while :; do TERM=linux tmux a <> /dev/tty1 >&0 2>&1; done) &
fi
(while :; do TERM=linux tmux <> /dev/tty2 >&0 2>&1; done) &
echo -n "udevd: "
/usr/lib/systemd/systemd-udevd --daemon
echo -n "Loading drivers..."
@@ -1,2 +1,2 @@
label: Genesis
kernelarags: quiet
kernelargs: quiet
@@ -411,7 +411,7 @@ def main():
dotwait()
while awaitprefix and not check_subnet(s, bmccfg['prefixv4'], channel):
dotwait()
while awaitprefix and not check_gateway(s, bmccfg['bmcgw'], channel):
while awaitgw and not check_gateway(s, bmccfg['bmcgw'], channel):
dotwait()
sys.stdout.write('done\n')
sys.stdout.flush()
+55 -8
View File
@@ -1,3 +1,4 @@
#include <errno.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <fcntl.h>
@@ -20,20 +21,29 @@
int main(int argc, char* argv[]) {
struct termios tty;
struct termios tty2;
struct winsize ws;
unsigned width, height;
int ttyf;
int spcr;
int tmpi;
int currspeed;
int flags;
speed_t cspeed;
char buff[128];
int bufflen;
fd_set set;
struct timeval timeout;
char* offset;
uint64_t address;
spcr = open("/sys/firmware/acpi/tables/SPCR", O_RDONLY);
if (spcr < 0) {
bufflen = 0;
tmpi = open("/sys/firmware/acpi/tables/SPCR", O_RDONLY);
if (tmpi < 0) {
exit(0);
}
if (read(spcr, buff, 80) < 80) {
if (read(tmpi, buff, 80) < 80) {
exit(0);
}
close(tmpi);
if (buff[8] != 2) exit(0); //revision 2
if (buff[36] != 0) exit(0); //16550 only
if (buff[40] != 1) exit(0); //IO only
@@ -69,12 +79,49 @@ int main(int argc, char* argv[]) {
}
tcgetattr(ttyf, &tty);
if (cspeed) {
cfsetospeed(&tty, B115200);
cfsetispeed(&tty, B115200);
cfsetospeed(&tty, cspeed);
cfsetispeed(&tty, cspeed);
}
printf("%s\n", buff);
tcgetattr(ttyf, &tty2);
cfmakeraw(&tty2);
tcsetattr(ttyf, TCSANOW, &tty2);
flags = fcntl(ttyf, F_GETFL, 0);
fcntl(ttyf, F_SETFL, flags | O_NONBLOCK);
while (read(ttyf, buff, 64) > 0) {
// Drain any pending reads
}
timeout.tv_sec = 0;
timeout.tv_usec = 500000;
FD_ZERO(&set);
FD_SET(ttyf, &set);
write(ttyf, "\0337\033[999;999H\033[6n\0338", 18);
while (select(ttyf + 1, &set, NULL, NULL, &timeout) > 0) {
if ((tmpi = read(ttyf, buff + bufflen, 127 - bufflen)) < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
continue;
} else {
break;
}
}
bufflen += tmpi;
buff[bufflen] = 0;
if (strchr(buff, 'R')) {
break;
}
}
fcntl(ttyf, F_SETFL, flags);
ws.ws_xpixel = 0;
ws.ws_ypixel = 0;
if (sscanf(buff, "\033[%u;%uR", &height, &width) == 2) {
ws.ws_col = width;
ws.ws_row = height;
} else {
ws.ws_col = 100;
ws.ws_row = 31;
}
ioctl(ttyf, TIOCSWINSZ, &ws);
tcsetattr(ttyf, TCSANOW, &tty);
ioctl(ttyf, TIOCCONS, 0);
printf("%s\n", buff);
}
+1 -1
View File
@@ -74,7 +74,7 @@ if args[0] == 'restore':
for targdir in os.walk('/etc/confluent'):
os.chown(targdir[0], owner, group)
for f in targdir[2]:
os.chown(os.patht.join(targdir[0], f), owner, group)
os.chown(os.path.join(targdir[0], f), owner, group)
except Exception as e:
print(str(e))
sys.exit(1)
@@ -785,7 +785,7 @@ def commit_clear():
# currently defined as local to each collective member
# currently just 'autosense' which is intended to be active
# per collective member
for globvar in _oldcfgstore['globals']:
for globvar in _oldcfgstore.get('globals', ()):
if globvar.endswith('_key'):
continue
_cfgstore['globals'][globvar] = _oldcfgstore['globals'][globvar]
+8 -4
View File
@@ -811,13 +811,17 @@ def get_smm_neighbor_fingerprints(smmaddr, cv):
if ':' in smmaddr:
smmaddr = '[{0}]'.format(smmaddr)
wc = webclient.SecureHTTPConnection(smmaddr, verifycallback=cv)
neighs = wc.grab_json_response('/scripts/neighdata.json')
try:
neighs = wc.grab_json_response('/scripts/neighdata.json')
except Exception:
log.log({'error': 'Failure getting LLDP information from {}'.format(smmaddr)})
return
if not neighs:
return
for idx in (4, 5):
if 'sha256' not in neighs[idx]:
for neigh in neighs:
if 'sha256' not in neigh:
continue
yield 'sha256$' + b64tohex(neighs[idx]['sha256'])
yield 'sha256$' + b64tohex(neigh['sha256'])
def get_nodename(cfg, handler, info):
@@ -27,7 +27,16 @@ import confluent.netutil as netutil
import confluent.util as util
getaddrinfo = eventlet.support.greendns.getaddrinfo
from xml.etree.ElementTree import fromstring
from xml.etree.ElementTree import fromstring as rfromstring
def fromstring(inputdata):
if isinstance(inputdata, bytes):
cmpstr = b'!entity'
else:
cmpstr = '!entity'
if cmpstr in inputdata.lower():
raise Exception('!ENTITY not supported in this interface')
return rfromstring(inputdata)
def fixuuid(baduuid):
# SMM dumps it out in hex
@@ -19,6 +19,7 @@ import confluent.util as util
import confluent.log as log
import os
import random
import eventlet.greenpool
import eventlet.green.select as select
import eventlet.green.socket as socket
import struct
@@ -106,6 +107,8 @@ def _parse_slp_packet(packet, peer, rsps, xidmap):
if '%' in addr:
addr = addr[:addr.index('%')]
mac = None
if addr not in neighutil.neightable:
neighutil.update_neigh()
if addr in neighutil.neightable:
identifier = neighutil.neightable[addr]
mac = identifier
@@ -532,6 +535,8 @@ def active_scan(handler, protocol=None):
for scanned in scan():
for addr in scanned['addresses']:
ip = addr[0].partition('%')[0] # discard scope if present
if ip not in neighutil.neightable:
neighutil.update_neigh()
if ip not in neighutil.neightable:
continue
if addr in known_peers:
@@ -583,6 +588,8 @@ def scan(srvtypes=_slp_services, addresses=None, localonly=False):
# reduced chance of many responses overwhelming receive buffer.
_grab_rsps((net, net4), rsps, 1, xidmap)
# now to analyze and flesh out the responses
handleids = set([])
gp = eventlet.greenpool.GreenPool(128)
for id in rsps:
for srvurl in rsps[id].get('urls', ()):
if len(srvurl) > 4:
@@ -597,14 +604,22 @@ def scan(srvtypes=_slp_services, addresses=None, localonly=False):
break
else:
continue
_add_attributes(rsps[id])
gp.spawn_n(_add_attributes, rsps[id])
handleids.add(id)
gp.waitall()
for id in handleids:
if 'service:lighttpd' in rsps[id]['services']:
currinf = rsps[id]
curratt = currinf.get('attributes', {})
if curratt.get('System-Manufacturing', [None])[0] == 'Lenovo' and curratt.get('type', [None])[0] == 'LenovoThinkServer':
currinf['services'] = ['service:lenovo-tsm']
curratt['enclosure-serial-number'] = curratt['Product-Serial']
curratt['enclosure-machinetype-model'] = curratt['Machine-Type']
serialnumber = curratt.get('Product-Serial', curratt.get('SerialNumber', None))
if serialnumber:
curratt['enclosure-serial-number'] = serialnumber
mtm = curratt.get('Machine-Type', curratt.get('Product-Name', None))
if mtm:
mtm[0] = mtm[0].rstrip()
curratt['enclosure-machinetype-model'] = mtm
else:
continue
del rsps[id]['payload']
@@ -62,6 +62,8 @@ def active_scan(handler, protocol=None):
for scanned in scan(['urn:dmtf-org:service:redfish-rest:1']):
for addr in scanned['addresses']:
ip = addr[0].partition('%')[0] # discard scope if present
if ip not in neighutil.neightable:
neighutil.update_neigh()
if ip not in neighutil.neightable:
continue
if addr in known_peers:
@@ -311,6 +313,8 @@ def _parse_ssdp(peer, rsp, peerdata):
ip = peer[0].partition('%')[0]
nid = ip
mac = None
if ip not in neighutil.neightable:
neighutil.update_neigh()
if ip in neighutil.neightable:
nid = neighutil.neightable[ip]
mac = nid
+2 -1
View File
@@ -1054,7 +1054,7 @@ class InputNetworkConfiguration(ConfluentInputMessage):
if 'ipv4_gateway' not in inputdata:
inputdata['ipv4_gateway'] = None
if 'ipv4_configuration' in inputdata:
if 'ipv4_configuration' in inputdata and inputdata['ipv4_configuration']:
if inputdata['ipv4_configuration'].lower() not in ['dhcp','static']:
raise exc.InvalidArgumentException(
'Unrecognized ipv4_configuration')
@@ -1147,6 +1147,7 @@ class BootDevice(ConfluentChoiceMessage):
'default',
'cd',
'floppy',
'usb',
])
valid_bootmodes = set([
+5 -2
View File
@@ -82,8 +82,11 @@ _idxtoifnamemap = {}
def _rebuildidxmap():
_idxtoifnamemap.clear()
for iname in os.listdir('/sys/class/net'):
ci = int(open('/sys/class/net/{0}/ifindex'.format(iname)).read())
_idxtoifnamemap[ci] = iname
try:
ci = int(open('/sys/class/net/{0}/ifindex'.format(iname)).read())
_idxtoifnamemap[ci] = iname
except Exception: # there may be non interface in /sys/class/net
pass
def myiptonets(svrip):
+12 -5
View File
@@ -139,7 +139,10 @@ def get_fingerprint(switch, port, configmanager, portmatch):
continue
if info.get('switch', None) != switch:
continue
if portmatch(info.get('port'), port):
if portmatch(info.get('portid', None), port):
return ('sha256$' + b64tohex(info['peersha256fingerprint']),
info.get('verified', False))
elif portmatch(info.get('port', None), port):
return ('sha256$' + b64tohex(info['peersha256fingerprint']),
info.get('verified', False))
return None, False
@@ -235,19 +238,23 @@ def _extract_neighbor_data_b(args):
idx = oidindex[0][-1]
idxtoifname[idx] = _lldpdesc_to_ifname(sid, idx, str(oidindex[1]))
for remotedesc in conn.walk('1.0.8802.1.1.2.1.4.1.1.10'):
iname = idxtoifname[remotedesc[0][-2]]
iname = idxtoifname.get(remotedesc[0][-2],
idxtoportid[remotedesc[0][-2]])
_init_lldp(lldpdata, iname, remotedesc[0][-2], idxtoportid, switch)
_extract_extended_desc(lldpdata[iname], remotedesc[1], user)
for remotename in conn.walk('1.0.8802.1.1.2.1.4.1.1.9'):
iname = idxtoifname[remotename[0][-2]]
iname = idxtoifname.get(remotename[0][-2],
idxtoportid[remotename[0][-2]])
_init_lldp(lldpdata, iname, remotename[0][-2], idxtoportid, switch)
lldpdata[iname]['peername'] = str(remotename[1])
for remotename in conn.walk('1.0.8802.1.1.2.1.4.1.1.7'):
iname = idxtoifname[remotename[0][-2]]
iname = idxtoifname.get(remotename[0][-2],
idxtoportid[remotename[0][-2]])
_init_lldp(lldpdata, iname, remotename[0][-2], idxtoportid, switch)
lldpdata[iname]['peerportid'] = sanitize(remotename[1])
for remoteid in conn.walk('1.0.8802.1.1.2.1.4.1.1.5'):
iname = idxtoifname[remoteid[0][-2]]
iname = idxtoifname.get(remoteid[0][-2],
idxtoportid[remoteid[0][-2]])
_init_lldp(lldpdata, iname, remoteid[0][-2], idxtoportid, switch)
lldpdata[iname]['peerchassisid'] = sanitize(remoteid[1])
for entry in lldpdata:
@@ -82,6 +82,8 @@ _blacklistnames = (
def _namesmatch(switchdesc, userdesc):
if switchdesc is None:
return False
if switchdesc == userdesc:
return True
try:
@@ -217,13 +219,18 @@ def _map_switch_backend(args):
*([int(x) for x in oid[-6:]])
)
mactobridge[macaddr] = int(bridgeport)
#ciscoiftovlanmap = {}
vlanstocheck = set([])
for vb in conn.walk('.1.3.6.1.4.1.9.9.68.1.2.2.1.2'):
vlanstocheck.add(vb[1])
#ciscotrunktovlanmap = {}
for vb in conn.walk('.1.3.6.1.4.1.9.9.46.1.6.1.1.5'):
vlanstocheck.add(vb[1])
try:
#ciscoiftovlanmap = {}
for vb in conn.walk('.1.3.6.1.4.1.9.9.68.1.2.2.1.2'):
vlanstocheck.add(vb[1])
#ciscotrunktovlanmap = {}
for vb in conn.walk('.1.3.6.1.4.1.9.9.46.1.6.1.1.5'):
vlanstocheck.add(vb[1])
except Exception:
# We might have crashed snmp on a non-cisco switch
# in such a case, delay 8 seconds to allow recovery to complete
eventlet.sleep(8)
if not vlanstocheck:
vlanstocheck.add(None)
bridgetoifmap = {}
+2 -2
View File
@@ -39,7 +39,7 @@ def makeboot_tree(distribution, profiledir):
os.link('/var/lib/confluent/public/site/site-initramfs.gz', trginitramfs)
profileinfo = os.path.join(profiledir, 'profile.yaml')
with open(profileinfo) as info:
profile = yaml.load(info)
profile = yaml.safe_load(info)
cfgfile = os.path.join(efidir, 'grub.cfg')
with open(cfgfile, 'w') as grubcfg:
grubcfg.write('set timeout=5\n')
@@ -57,4 +57,4 @@ def makeboot_tree(distribution, profiledir):
if __name__ == '__main__':
makeboot_tree(sys.argv[1], sys.argv[2])
makeboot_tree(sys.argv[1], sys.argv[2])