Merge "Fixed some bugs for Mgmt Driver"
This commit is contained in:
commit
0e6c4bd796
@ -783,3 +783,13 @@ class Free5gcMgmtDriverCnf(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
change_ext_conn_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_start(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_end(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
@ -2182,3 +2182,11 @@ class KubernetesFree5gcMgmtDriver(
|
||||
change_ext_conn_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
def modify_information_start(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
||||
def modify_information_end(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
@ -783,3 +783,13 @@ class Free5gcMgmtDriverCnf(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
change_ext_conn_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_start(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_end(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
@ -720,3 +720,13 @@ class Free5gcMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
change_ext_conn_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_start(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_end(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
@ -720,3 +720,13 @@ class Free5gcMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
change_ext_conn_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_start(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_end(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
@ -720,3 +720,13 @@ class Free5gcMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
change_ext_conn_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_start(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_end(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
@ -899,3 +899,13 @@ class Free5gcMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
commander.close_session()
|
||||
else:
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_start(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_end(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
@ -720,3 +720,13 @@ class Free5gcMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
change_ext_conn_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_start(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_end(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
@ -196,7 +196,7 @@ class AnsibleDriver(object):
|
||||
]
|
||||
|
||||
if action in scaling_actions:
|
||||
stack_id = kwargs["scale_stack_id"]
|
||||
stack_id = kwargs["scale_out_id_list"]
|
||||
else:
|
||||
stack_id = self._vnf_instance.instantiated_vnf_info.instance_id
|
||||
|
||||
|
@ -136,7 +136,7 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
return []
|
||||
raise exceptions.MgmtDriverRemoteCommandError(err_info=err)
|
||||
elif type == 'check_node':
|
||||
err = result.get_stderr()
|
||||
err = result.get_stderr()[0].replace('\n', '')
|
||||
if result.get_return_code() == 0:
|
||||
pass
|
||||
elif (result.get_return_code() != 0 and
|
||||
@ -477,12 +477,13 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
user=user, password=password, host=host,
|
||||
timeout=K8S_INSTALL_TIMEOUT)
|
||||
return commander
|
||||
except paramiko.SSHException as e:
|
||||
except (exceptions.NotAuthorized, paramiko.SSHException,
|
||||
paramiko.ssh_exception.NoValidConnectionsError) as e:
|
||||
LOG.debug(e)
|
||||
retry -= 1
|
||||
if retry == 0:
|
||||
LOG.error(e)
|
||||
raise paramiko.SSHException()
|
||||
raise exceptions.MgmtDriverOtherError(error_message=e)
|
||||
time.sleep(SERVER_WAIT_COMPLETE_TIME)
|
||||
|
||||
def _init_commander(self, user, password, host, retry=4):
|
||||
@ -735,9 +736,8 @@ class KubernetesMgmtDriver(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
user = vm_dict.get('ssh', {}).get('username')
|
||||
password = vm_dict.get('ssh', {}).get('password')
|
||||
host = vm_dict.get('ssh', {}).get('ipaddr')
|
||||
commander = cmd_executer.RemoteCommandExecutor(
|
||||
user=user, password=password,
|
||||
host=host, timeout=K8S_CMD_TIMEOUT)
|
||||
commander = self._init_commander_and_send_install_scripts(
|
||||
user, password, host)
|
||||
ssh_command = f"kubectl get node | grep {master_name}"
|
||||
result = self._execute_command(commander, ssh_command,
|
||||
K8S_CMD_TIMEOUT, 'check_node', 0)
|
||||
|
@ -361,3 +361,13 @@ class CnfNodePortMgmt(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
|
||||
change_ext_conn_request, grant,
|
||||
grant_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_start(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
||||
@log.log
|
||||
def modify_information_end(self, context, vnf_instance,
|
||||
modify_vnf_request, **kwargs):
|
||||
pass
|
||||
|
@ -93,14 +93,17 @@ EOF
|
||||
done
|
||||
}
|
||||
|
||||
# When executing terminate cnf, it will operate on haproxy.cfg.
|
||||
# Find two lines that exactly match the specified strings $start_str
|
||||
# and $end_str, and then delete all the content between the two lines.
|
||||
function delete_haproxy_conf {
|
||||
for(( i=0;i<${#NODEPORTS[@]};i++)); do
|
||||
split_node_port=(${NODEPORTS[i]//,/ })
|
||||
start_str=${split_node_port[0]}_${split_node_port[1]}
|
||||
end_str='default_backend kubernetes-nodeport'
|
||||
start_line_no=`grep -n "$start_str" /etc/haproxy/haproxy.cfg | \
|
||||
start_line_no=`grep -w -n "$start_str" /etc/haproxy/haproxy.cfg | \
|
||||
cut -d ":" -f 1`
|
||||
end_line_no=`grep -n "$end_str" /etc/haproxy/haproxy.cfg | head -1 |\
|
||||
end_line_no=`grep -w -n "$end_str" /etc/haproxy/haproxy.cfg | head -1 |\
|
||||
cut -d ":" -f 1`
|
||||
sudo sed -i "${start_line_no},${end_line_no}d" /etc/haproxy/haproxy.cfg
|
||||
done
|
||||
|
@ -552,6 +552,11 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
except Exception as e:
|
||||
LOG.error('Invalid format operationParams')
|
||||
raise exceptions.InvalidInput(str(e))
|
||||
# NOTE(fengyi): Please be careful not to modify the parameters
|
||||
# in kwargs, because MgmtDriver will depend on the
|
||||
# parameters here, you can add parameters, but do not
|
||||
# modify the original, unless you know that your
|
||||
# modification has no effect on other MgmtDrivers.
|
||||
kwargs = {"old_vnf_package_path": old_vnf_package_path,
|
||||
"configmap_secret_paths": cm_secret_paths}
|
||||
|
||||
@ -625,6 +630,12 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
#
|
||||
# NOTE(fengyi): Please be careful not to modify the parameters
|
||||
# in kwargs, because MgmtDriver will depend on the parameters
|
||||
# here, you can add parameters, but do not modify the original,
|
||||
# unless you know that your modification has no effect on
|
||||
# other MgmtDrivers.
|
||||
kwargs = {'vnf': copy.deepcopy(vnf_dict)}
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
@ -656,6 +667,12 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant and grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
#
|
||||
# NOTE(fengyi): Please be careful not to modify the parameters
|
||||
# in kwargs, because MgmtDriver will depend on the
|
||||
# parameters here, you can add parameters, but do not
|
||||
# modify the original, unless you know that your
|
||||
# modification has no effect on other MgmtDrivers.
|
||||
kwargs = {'vnf': copy.deepcopy(vnf_dict)}
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
@ -933,6 +950,12 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
# passed from conductor to vnflcm_driver, thus we put Null
|
||||
# value to grant and grant_reqeust temporary.
|
||||
# This part will be updated in next release.
|
||||
#
|
||||
# NOTE(fengyi): Please be careful not to modify the parameters
|
||||
# in kwargs, because MgmtDriver will depend on the
|
||||
# parameters here, you can add parameters, but do not
|
||||
# modify the original, unless you know that your
|
||||
# modification has no effect on other MgmtDrivers.
|
||||
kwargs = {'vnf': copy.deepcopy(vnf_dict)}
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
@ -983,8 +1006,13 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
# This part will be updated in next release.
|
||||
if len(scale_id_list) != 0 or \
|
||||
vim_connection_info.vim_type == 'kubernetes':
|
||||
# NOTE(fengyi): Please be careful not to modify the
|
||||
# parameters in kwargs, because MgmtDriver will depend
|
||||
# on the parameters here, you can add parameters, but
|
||||
# do not modify the original, unless you know that your
|
||||
# modification has no effect on other MgmtDrivers.
|
||||
kwargs = {'scale_name_list': scale_name_list,
|
||||
'scale_stack_id': scale_id_list,
|
||||
'scale_out_id_list': scale_id_list,
|
||||
'vnf': copy.deepcopy(vnf_info)}
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
@ -1052,7 +1080,12 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
# This part will be updated in next release.
|
||||
if len(id_list) != 0 or \
|
||||
vim_connection_info.vim_type == 'kubernetes':
|
||||
kwargs = {'scale_stack_id': id_list,
|
||||
# NOTE(fengyi): Please be careful not to modify the
|
||||
# parameters in kwargs, because MgmtDriver will depend
|
||||
# on the parameters here, you can add parameters, but
|
||||
# do not modify the original, unless you know that your
|
||||
# modification has no effect on other MgmtDrivers.
|
||||
kwargs = {'scale_out_id_list': id_list,
|
||||
'vnf': copy.deepcopy(vnf_info)}
|
||||
self._mgmt_manager.invoke(
|
||||
self._load_vnf_interface(
|
||||
@ -1595,6 +1628,11 @@ class VnfLcmDriver(abstract_driver.VnfInstanceAbstractDriver):
|
||||
vnf_instance.instantiated_vnf_info.flavour_id)
|
||||
vnf_info['action'] = 'in'
|
||||
if len(scale_id_list) != 0:
|
||||
# NOTE(fengyi): Please be careful not to modify the
|
||||
# parameters in kwargs, because MgmtDriver will depend
|
||||
# on the parameters here, you can add parameters, but
|
||||
# do not modify the original, unless you know that your
|
||||
# modification has no effect on other MgmtDrivers.
|
||||
kwargs = {'scale_name_list': scale_name_list}
|
||||
# TODO(LiangLu): grant_request here is planned to pass
|
||||
# as a parameter, however due to grant_request are not
|
||||
|
@ -17,7 +17,7 @@
|
||||
# key
|
||||
KEY_ACTION = 'action'
|
||||
KEY_KWARGS = 'kwargs'
|
||||
KEY_SCALE = 'scale_stack_id'
|
||||
KEY_SCALE = 'scale_out_id_list'
|
||||
|
||||
# ACTION type
|
||||
ACTION_CREATE_VNF = 'create_vnf'
|
||||
|
Loading…
Reference in New Issue
Block a user