From 69eeb5a35db243d90e03248e4d84ad5e25ed08f1 Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Wed, 18 Oct 2017 15:17:01 +0800 Subject: Skip recreate Daisy server VM if it exists in python Do not recreate daisy server if it exists. Reference to the bash code in patch [1]. [1] https://gerrit.opnfv.org/gerrit/#/c/40337/ Change-Id: If472c59ea180e550f358af4a3a9c7b42e575eddc Signed-off-by: Alex Yang --- deploy/deploy.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'deploy/deploy.py') diff --git a/deploy/deploy.py b/deploy/deploy.py index 245776fb..192b4ee4 100644 --- a/deploy/deploy.py +++ b/deploy/deploy.py @@ -181,16 +181,24 @@ class DaisyDeployment(object): return final_deploy_file, final_deploy_file_name def run(self): - self.daisy_env.delete_old_environment() + self.daisy_env.delete_old_environment(skip_daisy=self.skip_daisy) if self.cleanup_only: return - self.daisy_env.create_daisy_server() + + if self.skip_daisy: + self.daisy_env.connect_daisy_server(self.remote_dir, self.bin_file, + self.deploy_file_name, self.net_file_name) + else: + self.daisy_env.create_daisy_server() + self.daisy_env.connect_daisy_server(self.remote_dir, self.bin_file, + self.deploy_file_name, self.net_file_name) + self.daisy_env.install_daisy() + if self.daisy_only: log_bar('Create Daisy Server successfully !') return - self.daisy_env.install_daisy(self.remote_dir, self.bin_file, - self.deploy_file_name, self.net_file_name) - self.daisy_env.deploy(self.deploy_file, self.net_file) + + self.daisy_env.deploy(self.deploy_file, self.net_file, skip_preparation=self.skip_daisy) log_bar('Daisy deploy successfully !') @@ -214,6 +222,10 @@ def config_arg_parser(): default=path_join(WORKSPACE, 'opnfv.bin'), help='OPNFV Daisy BIN File') + parser.add_argument('-S', dest='skip_daisy', action='store_true', + default=False, + help='DO NOT install Daisy Server again') + parser.add_argument('-do', dest='daisy_only', action='store_true', default=False, help='Install Daisy Server only') @@ -273,6 +285,7 @@ def parse_arguments(): 'src_deploy_file': deploy_file, 'net_file': net_file, 'bin_file': args.bin_file, + 'skip_daisy': args.skip_daisy, 'daisy_only': args.daisy_only, 'cleanup_only': args.cleanup_only, 'remote_dir': args.remote_dir, -- cgit 1.2.3-korg