本文整理汇总了Python中base.cmdmsg.CMDMsg类的典型用法代码示例。如果您正苦于以下问题:Python CMDMsg类的具体用法?Python CMDMsg怎么用?Python CMDMsg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMDMsg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove_server_from_hmc
def remove_server_from_hmc(self, server_id, data):
'''
remove server profile for the vios machine which is from data list
@data: list type which contains server's name
'''
DebugLog.debug_print_level1("Connect hmc client session, remove_server_from_hmc")
resp_state = [StateBase.get_state_const(REMVSERVER_STAT),
StateBase.get_state_progress_const_name(PRGRS_INPROGRESS)]
msg = self.msg_decoder.encodeMsg(CMDMsg.getCMD(REMVSERVER),
server_id,
resp_state)
DebugLog.debug_print_level1(msg)
self.vd_comm_cnt.postMessage(msg)
# hmc_cli = HMC_CLI(self.hmc_ip, self.hmc_passwd)
# data_list = eval(data)
# loop_cnt = len(data_list)
# for loop_idx in range(loop_cnt):
# hmc_cli.remove_hmc_connection(data_list[loop_idx])
self._deal_with_data(server_id,
data,
"remove_hmc_connection",
with_params=True,
post_cmd=None)
resp_state = [StateBase.get_state_const(REMVSERVER_STAT),
StateBase.get_state_progress_const_name(PRGRS_FINISHED)]
msg = self.msg_decoder.encodeMsg(CMDMsg.getCMD(REMVSERVER),
server_id,
resp_state)
DebugLog.debug_print_level1(msg)
self.vd_comm_cnt.postMessage(msg)
示例2: setServerTaskState
def setServerTaskState(self, _cmd_key, _server_id, data):
if CMDMsg.getCMD(SAVESELECTION) == _cmd_key:
pass
elif CMDMsg.getCMD(SERVERSCAN) == _cmd_key:
DebugLog.info_print("in setServerTaskState function: SERVERSCAN branch")
self.check_server_in_fsm_manager()
else:
fsm_manager = self.fsm_manager[int(_server_id)]
_data = eval(data)
phase = _data[0]
state = _data[1]
fsm_manager.setTaskState(phase, state)
示例3: check_poweroff_status
def check_poweroff_status(self, server_id, data):
hmc_cli = HMC_CLI(self.hmc_ip, self.hmc_passwd)
data = eval(data)
_server_name = data[0]
status_ret = hmc_cli.get_server_status(_server_name)
poweroff_status_list = [StateBase.get_state_const(POWEROFF_STAT),
]
poweroff_val = False
if status_ret[0] in poweroff_status_list:
poweroff_val = True
if poweroff_val:
resp_state = [StateBase.get_state_const(POWEROFFSERVER_STAT),
StateBase.get_state_progress_const_name(PRGRS_FINISHED)]
else:
resp_state = [StateBase.get_state_const(POWEROFFSERVER_STAT),
StateBase.get_state_progress_const_name(PRGRS_INPROGRESS)]
msg = self.msg_decoder.encodeMsg(CMDMsg.getCMD(POWEROFFSERVER),
server_id,
resp_state)
DebugLog.debug_print_level1(msg)
self.vd_comm_cnt.postMessage(msg)
示例4: check_recover_profile_status
def check_recover_profile_status(self, _server_id, data):
hmc_cli = HMC_CLI(self.hmc_ip, self.hmc_passwd)
data = eval(data)
_server_name = data[0]
status_ret = hmc_cli.get_server_status(_server_name)
recoverprofile_check_status_list = [
StateBase.get_state_const(POWEROFF_STAT),
StateBase.get_state_const(OPERATING_STAT),
StateBase.get_state_const(STANDBY_STAT),
]
recover_profile_finished = False
if status_ret[0] in recoverprofile_check_status_list:
recover_profile_finished = True
if recover_profile_finished:
resp_state = [StateBase.get_state_const(RECOVERPROFILE_STAT),
StateBase.get_state_progress_const_name(PRGRS_FINISHED)]
else:
resp_state = [StateBase.get_state_const(RECOVERPROFILE_STAT),
StateBase.get_state_progress_const_name(PRGRS_INPROGRESS)]
#count = (count + 1) % 4
msg = self.msg_decoder.encodeMsg(CMDMsg.getCMD(RECOVERPROFILE),
_server_id,
resp_state)
DebugLog.debug_print_level1(msg)
self.vd_comm_cnt.postMessage(msg)
if recover_profile_finished:
self.get_server_hmc_status(_server_id, _server_name)
示例5: get_asm_poweron_status
def get_asm_poweron_status(self, server_id):
DebugLog.debug_print_level1("in server controller get_vios_installation_status")
server_data = self.getServerData(server_id)
params = [server_data[IP_FOR_NIMINSTALL]]
msg = self.msg_coder.encodeMsg(CMDMsg.getCMD(CHECKASM_POWERON), server_data[IDX_ID], params) #"UPDATE_PASSWD"
self._sendMsg2CommCnt(msg)
示例6: check_poweron_status
def check_poweron_status(self, server_id, data):
hmc_cli = HMC_CLI(self.hmc_ip, self.hmc_passwd)
data = eval(data)
_server_name = data[0]
status_ret = hmc_cli.get_server_status(_server_name)
poweron_status_list = [StateBase.get_state_const(PASSWORD_REQUIRED_STAT),
StateBase.get_state_const(FAILED_AUTH_STAT),
StateBase.get_state_const(UPDATEPASSWD_STAT),
StateBase.get_state_const(RECOVERY_STAT),
StateBase.get_state_const(OPERATING_STAT),
StateBase.get_state_const(STANDBY_STAT),
]
poweron_val = False
if status_ret[0] in poweron_status_list:
poweron_val = True
if poweron_val:
resp_state = [StateBase.get_state_const(POWERONSERVER_STAT),
StateBase.get_state_progress_const_name(PRGRS_FINISHED)]
else:
resp_state = [StateBase.get_state_const(POWERONSERVER_STAT),
StateBase.get_state_progress_const_name(PRGRS_INPROGRESS)]
msg = self.msg_decoder.encodeMsg(CMDMsg.getCMD(POWERONSERVER),
server_id,
resp_state)
DebugLog.debug_print_level1(msg)
self.vd_comm_cnt.postMessage(msg)
if poweron_val:
self.get_server_hmc_status(server_id, _server_name)
示例7: get_nimserver_hosts_current_status
def get_nimserver_hosts_current_status(self, server_id):
DebugLog.debug_print_level1("in server controller get_lpar_current_status")
server_data = self.getServerData(server_id)
params = [server_data[IP_FOR_NIMINSTALL], server_data[SN_ID]]
msg = self.msg_coder.encodeMsg(CMDMsg.getCMD(CHECKHOSTSFILE), server_data[IDX_ID], params) #"UPDATE_PASSWD"
self._sendMsg2CommCnt(msg)
示例8: sendMsg
def sendMsg(self, server_id, msg_type_id, bStop=False):
DebugLog.info_print("Send Msg via button click with server_id: %d" % server_id)
#server_data = self.getServerData(server_id)
params = [server_id, bStop]
msg = self.msgcoder.encodeMsg(CMDMsg.getCMD(msg_type_id), server_id, params)
self.controller._sendMsg2CommCnt(msg)
示例9: server_task_start
def server_task_start(self, msg):
'''
For one click button to server installation task
'''
_cmd, _idx, _data = self.msg_coder.decodeMsg(msg)
tmp = eval(_data)
server_id = tmp[0]
_bPause = tmp[1]
server_details_info = self.getServerData(server_id)
_server_cur_phase_str = server_details_info[PHASE]
fsm_manager = self.fsm_manager[int(server_details_info[IDX_ID])]
if _bPause:
fsm_manager.auto_mode = False
return
else:
fsm_manager.auto_mode = True
if CMDMsg.getCMD(INSTALL_VIOS_ONLY) == _cmd:
fsm_manager.update_states_order()
DebugLog.info_print("install vios only update states order")
phase_state = fsm_manager.get_cur_state(_server_cur_phase_str)
#phase = StateBase.get_state_const(PASSWORD_REQUIRED_STAT)
phase = phase_state.get_next_state().get_state_name()
progress = StateBase.get_state_progress_const_name(PRGRS_READY)
DebugLog.info_print("Set Task %d as %s %s" % (server_id, phase, progress))
#fsm_manager.setTaskState(phase, progress)
self.start_server_in_fsm_manager(server_id, phase, progress)
示例10: get_lpar_current_status
def get_lpar_current_status(self, server_id):
DebugLog.debug_print_level1("in server controller get_lpar_current_status")
server_data = self.getServerData(server_id)
params = [server_data[NAME_ID], server_data[SN_ID]]
msg = self.msg_coder.encodeMsg(CMDMsg.getCMD(CHECKCREATEVIOSLPAR), server_data[IDX_ID], params) #"UPDATE_PASSWD"
self._sendMsg2CommCnt(msg)
示例11: check_if_create_vios_lpar_state
def check_if_create_vios_lpar_state(self, server_id, server_name, server_sn):
'''
'''
hmc_cli = HMC_CLI(self.hmc_ip, self.hmc_passwd)
ret = hmc_cli.check_if_create_vios_lpar_finished(server_name,
server_sn)
resp_state = None
count = 1
# while not ret:
#
if ret:
resp_state = [StateBase.get_state_const(CREATEVIOSLPAR_STAT),
StateBase.get_state_progress_const_name(PRGRS_FINISHED)]
else:
resp_state = [StateBase.get_state_const(CREATEVIOSLPAR_STAT),
StateBase.get_state_progress_const_name(PRGRS_INPROGRESS)]
#count = (count + 1) % 4
msg = self.msg_decoder.encodeMsg(CMDMsg.getCMD(CHECKCREATEVIOSLPAR),
server_id,
resp_state)
DebugLog.debug_print_level1(msg)
self.vd_comm_cnt.postMessage(msg)
示例12: check_nim_resource_clean
def check_nim_resource_clean(self, server_id):
DebugLog.debug_print_level1("in server controller check_nim_resource_clean")
server_data = self.getServerData(server_id)
params = [server_data[SN_ID]]
msg = self.msg_coder.encodeMsg(CMDMsg.getCMD(CHECKCLEANSTATUS), server_data[IDX_ID], params)
self._sendMsg2CommCnt(msg)
示例13: createvioslpar
def createvioslpar(self, server_id, data):
''' create vios lpar on the server using the server's name which in the data list'''
DebugLog.debug_print_level1("Connect hmc client session")
resp_state = [StateBase.get_state_const(CREATEVIOSLPAR_STAT),
StateBase.get_state_progress_const_name(PRGRS_INPROGRESS)]
msg = self.msg_decoder.encodeMsg(CMDMsg.getCMD(CREATEVIOSLPAR),
server_id,
resp_state)
DebugLog.debug_print_level1(msg)
self.vd_comm_cnt.postMessage(msg)
hmc_cli = HMC_CLI(self.hmc_ip, self.hmc_passwd)
data = eval(data)
server_slots = hmc_cli.get_server_slots(data[0])
server_slots = '//0,'.join(server_slots)
DebugLog.debug_print_level1("Get server slots %s" % server_slots)
data_params = []
data_params.append(data[0])
data_params.append(data[1])
data_params.append(server_slots)
data = []
data.append(data_params)
self._deal_with_data(server_id, str(data), "create_vios_lpar")
示例14: get_nimserver_assigned_resource_status
def get_nimserver_assigned_resource_status(self, server_id):
DebugLog.debug_print_level1("in server controller get_nimserver_assigned_resource_status")
server_data = self.getServerData(server_id)
params = [server_data[SN_ID]]
msg = self.msg_coder.encodeMsg(CMDMsg.getCMD(CHECKASSIGNEDRESOURCE), server_data[IDX_ID], params) #"UPDATE_PASSWD"
self._sendMsg2CommCnt(msg)
示例15: updateData
def updateData(self, msg):
DebugLog.debug_print_level1("in updateData function in controller")
self.dataentity.savedata(msg)
_cmd_key, _server_id, data = self.msg_coder.decodeMsg(msg)
if CMDMsg.getCMD(UPDATEPASSWD) == _cmd_key:
self.b_server_removed_frm_hmc_flg = True
self.setServerTaskState(_cmd_key, _server_id, data)