mirror of
https://github.com/xcat2/confluent.git
synced 2025-08-26 05:00:46 +00:00
If a user were to try to reseat a node that isn't enclosure based or at least does not have the configuration, provide a clue as to what happened.
39 lines
1.5 KiB
Python
39 lines
1.5 KiB
Python
# Copyright 2017 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 confluent.core as core
|
|
import confluent.messages as msg
|
|
import pyghmi.exceptions as pygexc
|
|
|
|
def update(nodes, element, configmanager, inputdata):
|
|
emebs = configmanager.get_node_attributes(
|
|
nodes, (u'enclosure.manager', u'enclosure.bay'))
|
|
for node in nodes:
|
|
try:
|
|
em = emebs[node]['enclosure.manager']['value']
|
|
eb = emebs[node]['enclosure.bay']['value']
|
|
except KeyError:
|
|
yield msg.ConfluentNodeError(
|
|
node,
|
|
'Reseat is only supported on servers in an enclosure, and '
|
|
'with enclosure.manager and enclosure.bay defined')
|
|
continue
|
|
try:
|
|
for rsp in core.handle_path(
|
|
'/nodes/{0}/_enclosure/reseat_bay'.format(em),
|
|
'update', configmanager,
|
|
inputdata={'reseat': int(eb)}):
|
|
yield rsp
|
|
except pygexc.UnsupportedFunctionality as uf:
|
|
yield msg.ConfluentNodeError(node, str(uf))
|