mirror of
https://github.com/xcat2/confluent.git
synced 2026-09-29 00:31:09 +00:00
Fix mistakes in the discovery code to date
This commit is contained in:
@@ -65,8 +65,8 @@ import confluent.config.configmanager as cfm
|
||||
#import confluent.discovery.pxe as pxe
|
||||
#import confluent.discovery.ssdp as ssdp
|
||||
import confluent.discovery.slp as slp
|
||||
import confluent.handlers.xcc as xcc
|
||||
import confluent.handlers.bmchandler as bmc
|
||||
import confluent.discovery.handlers.xcc as xcc
|
||||
import confluent.discovery.handlers.bmchandler as bmc
|
||||
import confluent.networking.macmap as macmap
|
||||
|
||||
import eventlet
|
||||
@@ -193,7 +193,7 @@ def detected(info):
|
||||
return
|
||||
handler = None
|
||||
for service in info['services']:
|
||||
if nodehandlers[service]:
|
||||
if nodehandlers.get(service, None):
|
||||
handler = nodehandlers[service]
|
||||
break
|
||||
else: # no nodehandler, ignore for now
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
import confluent.discovery.handlers.bmchandler as bmchandler
|
||||
import pyghmi.exceptions as pygexc
|
||||
|
||||
|
||||
class NodeHandler(bmchandler.NodeHandler):
|
||||
@@ -20,15 +21,20 @@ class NodeHandler(bmchandler.NodeHandler):
|
||||
def preconfig(self):
|
||||
self.discoverable = True
|
||||
# attempt to enable SMM
|
||||
ipmicmd = self._get_ipmicmd()
|
||||
ipmicmd = None
|
||||
try:
|
||||
ipmicmd = self._get_ipmicmd()
|
||||
ipmicmd.xraw_command(netfn=0x3a, command=0xf1, data=(1,))
|
||||
self.discoverable = False
|
||||
except pygexc.IpmiException:
|
||||
except pygexc.IpmiException as e:
|
||||
# If the XCC can't do it, that's fine, it wasn't stark
|
||||
print('TODO: MUST DISTINGUISH BETWEEN LOGIN FAILURE')
|
||||
# if login failure, discoverable should alse be false
|
||||
print(repr(e))
|
||||
print(repr(e.ipmicode))
|
||||
pass
|
||||
ipmicmd.ipmi_session.logout()
|
||||
icmd.logout()
|
||||
if ipmicmd:
|
||||
ipmicmd.ipmi_session.logout()
|
||||
|
||||
@property
|
||||
def discoverable_by_switch(self):
|
||||
|
||||
@@ -195,7 +195,7 @@ def _map_switch_backend(args):
|
||||
|
||||
|
||||
def find_node_by_mac(mac, configmanager):
|
||||
if util.monotonic_time() - vintage < 90 and mac in _nodesbymac:
|
||||
if vintage and util.monotonic_time() - vintage < 90 and mac in _nodesbymac:
|
||||
return _nodesbymac[mac]
|
||||
for _ in update_macmap(configmanager):
|
||||
if mac in _nodesbymac:
|
||||
|
||||
Reference in New Issue
Block a user