本文整理汇总了Python中utils.DebugLog类的典型用法代码示例。如果您正苦于以下问题:Python DebugLog类的具体用法?Python DebugLog怎么用?Python DebugLog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DebugLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: 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)
示例2: 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)
示例3: check_server_in_fsm_manager
def check_server_in_fsm_manager(self):
for server_manager_indx in range(len(self.fsm_manager)):
phase, state = self.dataentity.get_data_status_key(server_manager_indx)
fsm_manager = self.fsm_manager[server_manager_indx]
DebugLog.debug_print_level1('state name : %s' % state)
#if not fsm_manager.inprogress:
fsm_manager.setTaskState(phase, state, first=True)
示例4: 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)
示例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: create_vios_lpar
def create_vios_lpar(self, params_list):
'''create vios lpar'''
params = params_list
if not isinstance(params_list, list):
params = eval(params_list)
server_name, server_sn, server_slots = params
_name = server_sn
_profile_name = '%sprf' % server_sn
self.chk_and_shutdown_remv_lpar(server_name, server_sn)
time.sleep(1)
cmd = 'mksyscfg -r lpar -m %s -i "name=%s,\
profile_name=%s,lpar_env=vioserver,auto_start=1,\
boot_mode=norm,mem_mode=ded,min_mem=2048,\
desired_mem=4096,max_mem=8192,\
proc_mode=shared,min_procs=2,desired_procs=4,\
max_procs=8,min_proc_units=0.5,desired_proc_units=1,\
max_proc_units=2,\
sharing_mode=cap,max_virtual_slots=200,\
\\"io_slots=%s//0\\""' % (server_name,
_name,
_profile_name,
server_slots)
DebugLog.info_print("create vios lpar for %s " % server_name)
self.remote_session.interactive_cmds(cmd, "~> ~>", False)
示例7: get_server_slots
def get_server_slots(self, server_name):
'''get slots info from hmc'''
cmd = "lshwres -r io --rsubtype slot -m %s -F drc_index" % server_name
DebugLog.info_print("get slots %s " % server_name)
server_slots = self.remote_session.interactive_cmds(cmd, "~> ~>", True)
return server_slots
示例8: login
def login(self, driver, username, password):
'''
Use default configurations in shared_config file to login PD
'''
pd_browser_client = driver
DebugLog.info_print("Login PowerDirector")
assert "PowerDirector" in pd_browser_client.title
DebugLog.info_print("Page title: " + pd_browser_client.title)
pd_browser_client.implicitly_wait(30)
uid_input = pd_browser_client.find_element_by_id("uid")
uid_input.send_keys(username)
p_input = pd_browser_client.find_element_by_id("pword")
p_input.send_keys(password)
login_button = pd_browser_client.find_element_by_xpath("/html/body/div/form/div/p[4]/input")
login_button.click()
expect_welcome_panel = pd_browser_client.find_element_by_id("user_panel")
welcome_text = "PowerDirector"
try:
if welcome_text in expect_welcome_panel.text:
print( expect_welcome_panel.text)
except:
raise Login_Error("Login fails")
pd_browser_client.quit()
return pd_browser_client
示例9: 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)
示例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_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)
示例13: 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)
示例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: __init__
def __init__(self):
'''
Constructor
'''
self.data_created = False
self.data_empty = False
self.file_name = "ippool.dat"
records_dir_name = "records"
if not os.path.exists(records_dir_name):
os.mkdir(records_dir_name)
self.file_name = os.path.join(records_dir_name, self.file_name)
DebugLog.info_print("The ip pool file path: %s." % os.path.abspath(self.file_name))
file_mode = "r+"
if os.path.isfile(self.file_name):
self.data_created = True
file_mode = "r+"
else:
file_mode = "w+"
self.file_handler = open(self.file_name, file_mode)
if self.data_created:
self.read_data(self.file_handler)
else:
self.init_data(self.file_handler)