diff options
-rwxr-xr-x | ci/deploy/deploy.sh | 17 | ||||
-rwxr-xr-x | code/install_interface_patch.sh | 2 | ||||
-rwxr-xr-x | code/makefile_patch.sh | 15 | ||||
-rwxr-xr-x | deploy/check_os_progress.sh | 7 | ||||
-rw-r--r-- | deploy/post/execute.py | 2 | ||||
-rw-r--r-- | deploy/tempest.py | 29 |
6 files changed, 46 insertions, 26 deletions
diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh index e0ee6a49..9fca1220 100755 --- a/ci/deploy/deploy.sh +++ b/ci/deploy/deploy.sh @@ -26,7 +26,7 @@ cat << EOF xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx `basename $0`: Deploys the Daisy4NFV -usage: `basename $0` -d dha_conf -n network_con -l lab_name -p pod_name +usage: `basename $0` -d dha_conf -l lab_name -p pod_name -r remote_workspace -w workdir OPTIONS: @@ -34,7 +34,6 @@ OPTIONS: -B PXE Bridge for booting Daisy Master, optional -d Configuration yaml file of DHA, optional, will be deleted later -D Dry-run, does not perform deployment, will be deleted later - -n Configuration yaml file of network, optional -l LAB name, necessary -p POD name, necessary -r Remote workspace in target server, optional @@ -48,7 +47,6 @@ Examples: sudo `basename $0` -b base_path -l zte -p pod2 -B pxebr -d ./deploy/config/vm_environment/zte-virtual1/deploy.yml - -n ./deploy/config/vm_environment/zte-virtual1/network.yml -r /opt/daisy -w /opt/daisy xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx EOF @@ -66,7 +64,6 @@ SCRIPT_PATH=$(readlink -f $(dirname $0)) WORKSPACE=$(cd ${SCRIPT_PATH}/../..; pwd) VM_STORAGE=/home/qemu/vms DHA_CONF='' -NETWORK_CONF='' LAB_NAME='' POD_NAME='' TARGET_HOSTS_NUM=0 @@ -94,9 +91,6 @@ do D) DRY_RUN=1 ;; - n) - NETWORK_CONF=${OPTARG} - ;; l) LAB_NAME=${OPTARG} ;; @@ -301,8 +295,7 @@ if [ $IS_BARE == 0 ];then echo "====== add relate config of kolla===========" ssh $SSH_PARAS $DAISY_IP "mkdir -p /etc/kolla/config/nova" ssh $SSH_PARAS $DAISY_IP "echo -e '[libvirt]\nvirt_type=qemu\ncpu_mode=none' >> /etc/kolla/config/nova/nova-compute.conf" - NETWORK_CONF="$REMOTE_SPACE/deploy/config/vm_environment/$LAB_NAME-$POD_NAME/network.yml" - ssh $SSH_PARAS $DAISY_IP "bash $REMOTE_SPACE/deploy/prepare.sh -n $NETWORK_CONF" + ssh $SSH_PARAS $DAISY_IP "bash $REMOTE_SPACE/deploy/prepare.sh -n $NETWORK" fi echo "===prepare cluster and pxe===" @@ -321,12 +314,14 @@ else fi echo "======prepare host and pxe===========" -ssh $SSH_PARAS $DAISY_IP "python ${REMOTE_SPACE}/deploy/tempest.py --dha $DHA --network $NETWORK --host 'yes' --env $IS_BARE" +ssh $SSH_PARAS $DAISY_IP "python ${REMOTE_SPACE}/deploy/tempest.py --dha $DHA --network $NETWORK --host 'yes' --isbare $IS_BARE" -echo "======daisy deploy os and openstack===========" +echo "======daisy virtual-deploy os and openstack===========" if [ $IS_BARE == 0 ];then virsh destroy all_in_one virsh start all_in_one + sleep 20 + ssh $SSH_PARAS $DAISY_IP "python ${REMOTE_SPACE}/deploy/tempest.py --install 'yes'" fi echo "===========check install progress===========" diff --git a/code/install_interface_patch.sh b/code/install_interface_patch.sh index d1806e00..1a0fa73f 100755 --- a/code/install_interface_patch.sh +++ b/code/install_interface_patch.sh @@ -22,3 +22,5 @@ if [ ! -e "$imagedir/registry-server.tar" ];then fi cp CentOS*.iso /var/lib/daisy/kolla +mkdir -p /var/lib/daisy/images/ +cp cirros*.img /var/lib/daisy/images/ diff --git a/code/makefile_patch.sh b/code/makefile_patch.sh index eeacb169..8d83f4e5 100755 --- a/code/makefile_patch.sh +++ b/code/makefile_patch.sh @@ -8,14 +8,23 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## + TOOLS_PATH=$1 CACHE_PATH=/home/cache + imagebranch="newton" imageversion="latest" imageserver="http://120.24.17.215" imagename="kolla-image-$imagebranch-$imageversion.tgz" + isoname="CentOS-7-x86_64-Minimal-1611.iso" isourl="http://buildlogs.centos.org/rolling/7/isos/x86_64/${isoname}" + +cirros_server="http://download.cirros-cloud.net" +cirros_ver="0.3.5" +cirros_filename="cirros-${cirros_ver}-x86_64-disk.img" +cirros_url=${cirros_server}/${cirros_ver}/${cirros_filename} + if [ ! -d $CACHE_PATH ]; then mkdir -p $CACHE_PATH ; fi if [ ! -f $CACHE_PATH/${isoname} ]; then wget -P $CACHE_PATH $isourl @@ -26,8 +35,14 @@ fi if [ ! -f $CACHE_PATH/registry-server.tar ]; then wget -P $CACHE_PATH "http://daisycloud.org/static/files/registry-server.tar" fi +if [ ! -f $CACHE_PATH/${cirros_filename} ]; then + wget -P $CACHE_PATH ${cirros_url} +fi + cp $CACHE_PATH/${isoname} $TOOLS_PATH/setup/bin_temp/ cp $CACHE_PATH/$imagename $TOOLS_PATH/setup/bin_temp/ cp $CACHE_PATH/registry-server.tar $TOOLS_PATH/setup/bin_temp/ +cp $CACHE_PATH/${cirros_filename} $TOOLS_PATH/setup/bin_temp/ + cp $TOOLS_PATH/setup/install_interface_patch.sh $TOOLS_PATH/setup/bin_temp/ chmod +x $TOOLS_PATH/setup/bin_temp/install_interface_patch.sh diff --git a/deploy/check_os_progress.sh b/deploy/check_os_progress.sh index bb2b3340..e742467c 100755 --- a/deploy/check_os_progress.sh +++ b/deploy/check_os_progress.sh @@ -43,13 +43,6 @@ if [ $deploy_env == 0 ];then echo "detail info of host $host_id:" daisy host-detail $host_id done -else - for host_id in $hosts_id; - do - echo "update host $host_id ipmi user and passwd" - daisy host-update $host_id --ipmi-user zteroot --ipmi-passwd superuser - done - echo "update all hosts ipmi user and passwd ok!" fi echo "check os installing progress..." diff --git a/deploy/post/execute.py b/deploy/post/execute.py index 159f3b67..d310acbc 100644 --- a/deploy/post/execute.py +++ b/deploy/post/execute.py @@ -72,7 +72,7 @@ def _prepare_cirros(): url = 'http://download.cirros-cloud.net' version = '0.3.5' name = 'cirros-{}-x86_64-disk.img'.format(version) - img = os.path.join(os.path.abspath(os.path.dirname(__file__)), name) + img = os.path.join("/var/lib/daisy/images", name) if not os.path.isfile(img): cmd = "wget %(url)s/%(version)s/%(name)s -O %(path)s" % { 'url': url, diff --git a/deploy/tempest.py b/deploy/tempest.py index f01aa77b..6e626c71 100644 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -31,7 +31,9 @@ _CLI_OPTS = [ help='Config cluster'), cfg.StrOpt('host', help='Config host'), - cfg.IntOpt('env', + cfg.StrOpt('install', + help='install daisy'), + cfg.IntOpt('isbare', help='deploy environment'), ] @@ -86,10 +88,14 @@ def prepare_install(): cluster_id = cluster_info.id add_hosts_interface(cluster_id, hosts_info, hosts_name, host_interface_map, vip) - if 'env' in conf and conf['env'] == 0: - build_pxe_without_ipmi(cluster_id) + if 'isbare' in conf and conf['isbare'] == 0: + install_os_for_vm_step1(cluster_id) else: - build_pxe_with_ipmi(cluster_id) + print("daisy baremetal deploy start") + install_os_for_bm_oneshot(cluster_id) + elif conf['install'] and conf['install'] == 'yes': + install_os_for_vm_step2(cluster_id) + except Exception: print("Deploy failed!!!.%s." % traceback.format_exc()) else: @@ -102,15 +108,22 @@ def build_pxe_for_discover(cluster_id): client.install.install(**cluster_meta) -def build_pxe_without_ipmi(cluster_id): +def install_os_for_vm_step1(cluster_id): cluster_meta = {'cluster_id': cluster_id, 'pxe_only': "true"} client.install.install(**cluster_meta) -def build_pxe_with_ipmi(cluster_id): +def install_os_for_bm_oneshot(cluster_id): + cluster_meta = {'cluster_id': cluster_id, + 'pxe_only': "false", + 'skip_pxe_ipmi': "false"} + client.install.install(**cluster_meta) + + +def install_os_for_vm_step2(cluster_id): cluster_meta = {'cluster_id': cluster_id, - 'pxe_only': "false"} + 'skip_pxe_ipmi': "true"} client.install.install(**cluster_meta) @@ -159,6 +172,8 @@ def add_hosts_interface(cluster_id, hosts_info, hosts_name, host_interface_map, for host_name, host in zip(hosts_name, hosts_info): host = host.to_dict() host['cluster'] = cluster_id + host['ipmi_user'] = 'zteroot' + host['ipmi_passwd'] = 'superuser' for interface in host['interfaces']: interface_name = interface['name'] if interface_name in host_interface_map: |