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

Compare commits

...

14 Commits

Author SHA1 Message Date
Jarrod Johnson 59def49e2a Remove stray incorrect python script from tree 2022-05-04 08:30:02 -04:00
Jarrod Johnson b40eef252a Remove stale TODO file 2022-05-03 08:17:29 -04:00
Jarrod Johnson 5daf0b231e Also register to run before coreos-ignition-setup-user
For coreos, make sure we preempt either name.
2022-02-22 14:39:17 -05:00
Jarrod Johnson 896fc09ad8 Fix deb build of vtbuffered 2022-02-04 16:03:02 -05:00
Jarrod Johnson 6769c171c1 Fix confignet for python2 2022-02-03 11:58:44 -05:00
Jarrod Johnson 700fe1bc3b Fix for EL7 compatibility
Some python 3 exclusive assumptions were made.
Unfortunately, EL7 is python2
centric.
2022-02-03 10:10:10 -05:00
Jarrod Johnson bc7d480a17 Use more widely known paths for libcrypt 2022-02-02 11:03:44 -05:00
Jarrod Johnson 92dea32dd4 Change to python 2/3 agnostic syntax 2022-02-02 11:03:12 -05:00
Jarrod Johnson 0186f002e0 Have configbmc stall on TSM
TSM will stall out for an extended
period of time after a network change.

Accomodate by forcing a pause
on detection of TSM.
2022-01-10 12:02:46 -05:00
Jarrod Johnson 8d80efec64 Correct configbmc misidentification of lan chan
The lan channel get mac address was incorrect, change
to correctly request.
2022-01-10 12:02:14 -05:00
Jarrod Johnson 978b52dbb6 Fix selection of suboptimal alias
When picking deploy server, stop on a close match if net.ipv4_address suggests
a same-subnet match rather than adding the last alias.
2021-12-28 09:47:47 -05:00
Jarrod Johnson d47b088753 Fix mistake in error output 2021-12-22 23:29:21 -05:00
Jarrod Johnson 47a83f4628 Do not trace out if a packet can't be replied to 2021-12-20 12:37:18 -05:00
Jarrod Johnson abec8c498c Break netlink address fetch on invalid rta_len
It is considered valid for kernel to return a null rta_len
in the midst of data and expect the caller to terminate.
2021-12-20 12:28:35 -05:00
13 changed files with 69 additions and 121 deletions
-65
View File
@@ -1,65 +0,0 @@
-other auth
-pam if user exists but has no passphrase
-keystone?
-ad? (specialized to the AD case)
-expressionkeys never gets smaller - perf impact
-When a user account is changed, have httpapi and sockapi notified of changes
to kill off related sessions. password changes are given a pass, but user
deletion will result in immediate session termination
-When the time comes to dole out configuration/discovery, take page from xCAT
'flexdiscover' command, if possible bring an ipmi device under management
by way of ipv6 to eliminate requirement for ip to be specified.
Requires the polling event support (which is required for security anyway)
-this stack trace (happened with method was set to ""):
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/eventlet/wsgi.py", line 402, in handle_one_response
for data in result:
File "/home/jbjohnso/Development/confluent/confluent/httpapi.py", line 301, in resourcehandler
cfgmgr, querydict)
File "/home/jbjohnso/Development/confluent/confluent/pluginapi.py", line 273, in handle_path
passvalue = pluginmap[plugpath].__dict__[operation](
KeyError: ''
-have pyghmi and friends do multiprocessing pools
-investigate console behavior when target off (causing disconnects/reconnects
on input)
-test to make sure that 'Session Disconnected' is working
-confetty to do right thing with respect to status updates when run right on a
console. It currently clutters up the screen with data that would land in
a titlebar
-audit log did not show confetty activity for starting console
-read exclusive and full exclusive console access modes
-remove the socket ignore code from pyghmi and repeat tests to understand
why python 2.7 with excessive select() would transpose typing so badly...
while the problem cannot be reproduced without that problem fixed, the
problem should only cause poor performance, not induce transpose of data...
-test out bg_sync in cfg to make sure if it runs just before a change it doesn't cause loss
-set boot/nextdevice=cd after exiting console did:
/nodes/n3/ -> set boot/nextdevice=cd
Traceback (most recent call last):
File "/usr/bin/confetty", line 561, in <module>
do_command(currcommand, netserver)
File "/usr/bin/confetty", line 300, in do_command
setvalues(argv[1:])
File "/usr/bin/confetty", line 369, in setvalues
print_result(res)
File "/usr/bin/confetty", line 211, in print_result
for key in res.iterkeys():
AttributeError: 'str' object has no attribute 'iterkeys'
-/detected/ collection
-SLP snooping: snoop for srvrequests, likel
-Config backup/restore
-seal to password
-Scenario was somehow solconnection object is 'broken' (broken=True) but the supervising console manager
never notices. The 'write()' doesn't raise an exception, just returns.
-pyghmi should except on attempt to write to broken console I think...
-need to investigate what path does not end up getting immediate notification
for disconnection
-last observed when a switch between confluent and imm was resetting in a loop
while it was trying to keep console open as much as possibl
-cs._handled_consoles[('n4', None)]._console.handle_data({'error':1}) is how I was able to
kick the session state back to working order after whatever event that was missed above
occurred.
-save and restore the terminal title on startup/exit respectively
@@ -20,9 +20,9 @@ class InvalidApiKey(Exception):
cryptname = ctypes.util.find_library('crypt')
if not cryptname:
if os.path.exists('/usr/lib64/libcrypt.so.1'):
if os.path.exists('/lib64/libcrypt.so.1'):
cryptname = 'libcrypt.so.1'
elif os.path.exists('/usr/lib64/libcrypt.so.2'):
elif os.path.exists('/lib64/libcrypt.so.2'):
cryptname = 'libcrypt.so.2'
c_libcrypt = ctypes.CDLL(cryptname)
c_crypt = c_libcrypt.crypt
@@ -55,10 +55,10 @@ def get_my_addresses():
rta = v[nlhdrsz+ifaddrsz:length]
while len(rta):
rtalen, rtatyp = struct.unpack('HH', rta[:4])
if rtalen < 4:
break
if rtatyp == 1:
addrs.append((fam, rta[4:rtalen], plen, ridx))
if not rtalen:
break
rta = rta[rtalen:]
v = v[length:]
return addrs
@@ -93,14 +93,20 @@ def scan_confluents():
if addr[0] == socket.AF_INET6:
if addr[-1] in doneidxs:
continue
s6.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, addr[-1])
try:
s6.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, addr[-1])
except TypeError:
s6.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_IF, addr[-1].tobytes())
try:
s6.sendto(msg, ('ff02::c', 1900))
except OSError:
pass
doneidxs.add(addr[-1])
elif addr[0] == socket.AF_INET:
s4.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, addr[1])
try:
s4.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, addr[1])
except TypeError:
s4.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_IF, addr[1].tobytes())
try:
s4.sendto(msg, ('239.255.255.250', 1900))
except OSError:
@@ -138,7 +144,7 @@ def get_net_apikey(nodename, mgr):
newpass = newpass.encode('utf8')
salt = salt.encode('utf8')
crypted = c_crypt(newpass, salt)
for addrinfo in socket.getaddrinfo(mgr, 13001, type=socket.SOCK_STREAM):
for addrinfo in socket.getaddrinfo(mgr, 13001, 0, socket.SOCK_STREAM):
try:
clisock = socket.socket(addrinfo[0], addrinfo[1])
clisock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
@@ -8,11 +8,17 @@ import sys
import time
import shlex
import subprocess
from importlib.machinery import SourceFileLoader
try:
apiclient = SourceFileLoader('apiclient', '/opt/confluent/bin/apiclient').load_module()
except FileNotFoundError:
apiclient = SourceFileLoader('apiclient', '/etc/confluent/apiclient').load_module()
from importlib.machinery import SourceFileLoader
def load_source(mod, path):
return SourceFileLoader(mod, path).load_module()
except ImportError:
from imp import load_source
try:
apiclient = load_source('apiclient', '/opt/confluent/bin/apiclient')
except IOError:
apiclient = load_source('apiclient', '/etc/confluent/apiclient')
def add_lla(iface, mac):
pieces = mac.split(':')
@@ -311,7 +317,7 @@ if __name__ == '__main__':
myname = myname[0]
myname = socket.inet_pton(socket.AF_INET, myname)
for addr in myaddrs:
if myname == bytes(addr[1]):
if myname == addr[1].tobytes():
curridx = addr[-1]
if curridx in doneidxs:
continue
@@ -6,6 +6,7 @@ After=basic.target
# Network is enabled here
After=dracut-initqueue.service
Before=ignition-setup-user.service
Before=coreos-ignition-setup-user.service
Before=coreos-livepxe-rootfs.service
@@ -267,7 +267,7 @@ def get_lan_channel(s):
medtype = int(rsp[1]) & 0b1111111
if medtype not in (4, 6):
continue
rsp = s.raw_command(0xc, 2, bytearray([2, chan, 5, 0, 0]))
rsp = s.raw_command(0xc, 2, bytearray([chan, 5, 0, 0]))
if rsp.get('code', 1) == 0:
return chan
return 1
@@ -267,7 +267,7 @@ def get_lan_channel(s):
medtype = int(rsp[1]) & 0b1111111
if medtype not in (4, 6):
continue
rsp = s.raw_command(0xc, 2, bytearray([2, chan, 5, 0, 0]))
rsp = s.raw_command(0xc, 2, bytearray([chan, 5, 0, 0]))
if rsp.get('code', 1) == 0:
return chan
return 1
@@ -165,9 +165,18 @@ def set_port(s, port, vendor, model):
return 1
def get_remote_config_mod(vendor, model):
def get_remote_config_mod(vendor, model, waiters):
if vendor in ('IBM', 'Lenovo'):
if _is_tsm(model):
for waiter in waiters:
if waiter:
sys.stdout.write('Waiting for TSM network to activate')
for x in range(0, 90):
sys.stdout.write('.')
sys.stdout.flush()
time.sleep(1)
sys.stdout.write('Complete\n')
break
return 'tsm'
else:
return 'xcc'
@@ -275,7 +284,7 @@ def get_lan_channel(s):
medtype = int(rsp[1]) & 0b1111111
if medtype not in (4, 6):
continue
rsp = s.raw_command(0xc, 2, bytearray([2, chan, 5, 0, 0]))
rsp = s.raw_command(0xc, 2, bytearray([chan, 5, 0, 0]))
if rsp.get('code', 1) == 0:
return chan
return 1
@@ -415,7 +424,7 @@ def main():
dotwait()
sys.stdout.write('done\n')
sys.stdout.flush()
cfgmod = get_remote_config_mod(vendor, model)
cfgmod = get_remote_config_mod(vendor, model, (awaitip, awaitvlan, awaitprefix, awaitgw))
if cfgmod:
with open('configbmc.configmod', 'w+') as cm:
cm.write('configmod: {0}\n'.format(cfgmod))
+2 -2
View File
@@ -364,7 +364,7 @@ def oslist():
print("Distributions:")
for rsp in c.read('/deployment/distributions'):
if 'error' in rsp:
sys.stderr.write(res['error'] + '\n')
sys.stderr.write(rsp['error'] + '\n')
exitcode = 1
else:
print(" " + rsp['item']['href'].replace('/', ''))
@@ -373,7 +373,7 @@ def oslist():
print("Profiles:")
for rsp in c.read('/deployment/profiles'):
if 'error' in rsp:
sys.stderr.write(res['error'] + '\n')
sys.stderr.write(rsp['error'] + '\n')
exitcode = 1
else:
print(" " + rsp['item']['href'].replace('/', ''))
@@ -112,7 +112,10 @@ def _parse_slp_packet(packet, peer, rsps, xidmap, defer=None, sock=None):
identifier = addr
else:
probepeer = (peer[0], struct.unpack('H', os.urandom(2))[0] | 1025) + peer[2:]
sock.sendto(b'\x00', probepeer)
try:
sock.sendto(b'\x00', probepeer)
except Exception:
return
defer.append((packet, peer))
return
if (identifier, parsed['xid']) in rsps:
@@ -487,7 +490,10 @@ def snoop(handler, protocol=None):
mac = neighutil.get_hwaddr(peer[0])
if not mac:
probepeer = (peer[0], struct.unpack('H', os.urandom(2))[0] | 1025) + peer[2:]
s.sendto(b'\x00', probepeer)
try:
s.sendto(b'\x00', probepeer)
except Exception:
continue
deferpeers.append(peer)
continue
process_peer(newmacs, known_peers, peerbymacaddress, peer)
@@ -167,7 +167,10 @@ def snoop(handler, byehandler=None, protocol=None, uuidlookup=None):
continue
mac = neighutil.get_hwaddr(peer[0])
if not mac:
s.sendto(b'\x00', peer)
try:
s.sendto(b'\x00', peer)
except Exception:
continue
deferrednotifies.append((peer, rsp))
continue
_process_snoop(peer, rsp, mac, known_peers, newmacs, peerbymacaddress, byehandler, machandlers)
@@ -311,8 +314,11 @@ def _find_service(service, target):
for s in r:
(rsp, peer) = s.recvfrom(9000)
if not neighutil.get_hwaddr(peer[0]):
try:
s.sendto(b'\x00', peer)
except Exception:
continue
deferparse.append((rsp, peer))
s.sendto(b'\x00', peer)
continue
_parse_ssdp(peer, rsp, peerdata)
timeout = deadline - util.monotonic_time()
+10 -4
View File
@@ -398,15 +398,18 @@ def get_nic_config(configmanager, node, ip=None, mac=None, ifidx=None,
foundaddr = False
candgws = []
candsrvs = []
bestsrvbyfam = {}
for myaddr in myaddrs:
fam, svrip, prefix = myaddr[:3]
candsrvs.append((fam, svrip, prefix))
if fam == socket.AF_INET:
cfgdata['deploy_server'] = socket.inet_ntop(socket.AF_INET, svrip)
nver = '4'
srvkey = 'deploy_server'
elif fam == socket.AF_INET6:
cfgdata['deploy_server_v6'] = socket.inet_ntop(socket.AF_INET6, svrip)
nver = '6'
srvkey = 'deploy_server_v6'
if fam not in bestsrvbyfam:
cfgdata[srvkey] = socket.inet_ntop(fam, svrip)
for candidate in cfgbyname:
ipmethod = cfgbyname[candidate].get('ipv{}_method'.format(nver), 'static')
if ipmethod == 'dhcp':
@@ -425,6 +428,7 @@ def get_nic_config(configmanager, node, ip=None, mac=None, ifidx=None,
for inf in socket.getaddrinfo(candip, 0, fam, socket.SOCK_STREAM):
candipn = socket.inet_pton(fam, inf[-1][0])
if ipn_on_same_subnet(fam, svrip, candipn, prefix):
bestsrvbyfam[fam] = svrip
cfgdata['ipv{}_address'.format(nver)] = candip
cfgdata['ipv{}_method'.format(nver)] = ipmethod
cfgdata['ipv{}_gateway'.format(nver)] = cfgbyname[candidate].get(
@@ -563,6 +567,8 @@ def get_my_addresses(idx=0, family=0, matchlla=None):
rta = v[nlhdrsz+ifaddrsz:length]
while len(rta):
rtalen, rtatyp = struct.unpack('HH', rta[:4])
if rtalen < 4:
break
if rta[4:rtalen].tobytes() == matchlla:
return get_my_addresses(idx=ridx)
rta = rta[rtalen:]
@@ -570,10 +576,10 @@ def get_my_addresses(idx=0, family=0, matchlla=None):
rta = v[nlhdrsz+ifaddrsz:length]
while len(rta):
rtalen, rtatyp = struct.unpack('HH', rta[:4])
if rtalen < 4:
break
if rtatyp == 1:
addrs.append((fam, rta[4:rtalen].tobytes(), plen, ridx))
if not rtalen:
break
rta = rta[rtalen:]
v = v[length:]
return addrs
-27
View File
@@ -1,27 +0,0 @@
#!/usr/bin/python2
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 IBM Corporation
# Copyright 2015-2016 Lenovo
#
# 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.
import readline
import socket
connection = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.connection.connect('/var/run/confluent/dbg.sock')
readline.parse_and_bind("tab: complete")
readline.parse_and_bind("set bell-style none")
+2 -2
View File
@@ -19,8 +19,8 @@ mv $PKGNAME $DPKGNAME-${VERSION}
sed -i s/%%VERSION%%/$VERSION/ $DPKGNAME-${VERSION}/debian/changelog
tar cvzf ${DPKGNAME}_${VERSION}.orig.tar.gz $DPKGNAME-${VERSION}
cd $DPKGNAME-${VERSION}
debuild -us -uc
debuild --no-lintian -us -uc
if [ ! -z "$1" ]; then
mv /tmp/confluent/$DPKGNAME_${VERSION}*.deb $1/
mv /tmp/confluent/$DPKGNAME-${VERSION}*.deb $1/
fi
exit 0