集中式支持vip本地化安装
Match-id-c7906104d5bcad5351beb7863fb3c72c990f7c25
This commit is contained in:
@ -66,6 +66,56 @@ class DssInstAttr():
|
||||
' ', '').replace('{', '"').replace('}', '"').replace(';', ' ')
|
||||
|
||||
|
||||
class VipResAttr():
|
||||
"""
|
||||
VIP resource attribute
|
||||
"""
|
||||
def __init__(self, float_ip):
|
||||
self.resources_type = "VIP"
|
||||
self.float_ip = float_ip
|
||||
|
||||
def __str__(self):
|
||||
return str(vars(self)).replace(':', '=').replace('\'', '').replace(
|
||||
' ', '').replace('{', '"').replace('}', '"').replace(';', ' ')
|
||||
|
||||
|
||||
class VipInstAttr():
|
||||
"""
|
||||
VIP instance attribute
|
||||
"""
|
||||
def __init__(self, base_ip):
|
||||
self.base_ip = base_ip
|
||||
|
||||
def __str__(self):
|
||||
return str(vars(self)).replace(':', '=').replace('\'', '').replace(
|
||||
' ', '').replace('{', '"').replace('}', '"').replace(';', ' ')
|
||||
|
||||
|
||||
class VipAddInst():
|
||||
"""
|
||||
VIP add instance attribute
|
||||
"""
|
||||
def __init__(self, res_instance_id, node_id):
|
||||
self.node_id = node_id
|
||||
self.res_instance_id = res_instance_id
|
||||
|
||||
def __str__(self):
|
||||
return str(vars(self)).replace(':', '=').replace('\'', '').replace(
|
||||
' ', '').replace('{', '"').replace('}', '"').replace(';', ' ')
|
||||
|
||||
|
||||
class VipDelInst():
|
||||
"""
|
||||
VIP del instance attribute
|
||||
"""
|
||||
def __init__(self, res_instance_id):
|
||||
self.res_instance_id = res_instance_id
|
||||
|
||||
def __str__(self):
|
||||
return str(vars(self)).replace(':', '=').replace('\'', '').replace(
|
||||
' ', '').replace('{', '"').replace('}', '"').replace(';', ' ')
|
||||
|
||||
|
||||
class CmResCtrlCmd():
|
||||
|
||||
def __init__(self, action='add', name='', attr=''):
|
||||
@ -77,8 +127,34 @@ class CmResCtrlCmd():
|
||||
cmd = ''
|
||||
if self.action == 'add':
|
||||
cmd = 'cm_ctl res --add --res_name {} --res_attr={}'.format(
|
||||
self.attr_name, self.attr)
|
||||
self.attr_name, self.attr)
|
||||
elif self.action == 'edit':
|
||||
cmd = 'cm_ctl res --edit --res_name {} --add_inst={}'.format(
|
||||
self.attr_name, self.attr)
|
||||
self.attr_name, self.attr)
|
||||
return cmd
|
||||
|
||||
|
||||
class VipCmResCtrlCmd():
|
||||
"""
|
||||
VipCmResCtrlCmd
|
||||
"""
|
||||
def __init__(self, action, name, inst="", attr=""):
|
||||
self.action = action
|
||||
self.name = name
|
||||
self.inst = inst
|
||||
self.attr = attr
|
||||
|
||||
def __str__(self):
|
||||
cmd = ""
|
||||
if self.action == "add_res":
|
||||
cmd = "cm_ctl res --add --res_name=\"%s\" --res_attr=%s" % \
|
||||
(self.name, self.attr)
|
||||
elif self.action == "del_res":
|
||||
cmd = "cm_ctl res --del --res_name=\"%s\"" % self.name
|
||||
elif self.action == "add_inst":
|
||||
cmd = "cm_ctl res --edit --res_name=\"%s\" --add_inst=%s --inst_attr=%s" % \
|
||||
(self.name, self.inst, self.attr)
|
||||
elif self.action == "del_inst":
|
||||
cmd = "cm_ctl res --edit --res_name=\"%s\" --del_inst=%s" % \
|
||||
(self.name, self.inst)
|
||||
return cmd
|
||||
|
||||
Reference in New Issue
Block a user