From 5479928d2e5f9de48b3076e8fb2e7e7809948b02 Mon Sep 17 00:00:00 2001 From: xiaodongwang Date: Fri, 12 Jun 2015 15:47:47 -0700 Subject: [PATCH] add fusionsphere support Change-Id: If28b7b56b5feeeae67c2991fde56c5fb916ed044 --- conf/adapter/chef_fusionsphere.conf | 8 + conf/adapter/chef_openstack.conf | 2 +- conf/adapter/os_only.conf | 2 +- conf/flavor/fusionsphere_chef.conf | 25 ++ conf/os/uvp11sp3.conf | 3 + conf/role/fusionsphere_chef.conf | 69 +++ conf/setting | 2 +- .../openstack_icehouse/environments/base.tmpl | 2 - .../environments/fusionsphere.tmpl | 425 ++++++++++++++++++ install/cobbler.sh | 220 ++++++--- install/compass.sh | 4 + install/compass_web.sh | 7 +- install/install.conf | 5 + install/install.conf.template | 1 + install/install.sh | 12 + install/install_func.sh | 2 +- install/prepare.sh | 12 +- install/setup_env.sh | 1 + service/compass-celeryd | 20 + 19 files changed, 755 insertions(+), 67 deletions(-) create mode 100644 conf/adapter/chef_fusionsphere.conf create mode 100644 conf/flavor/fusionsphere_chef.conf create mode 100644 conf/os/uvp11sp3.conf create mode 100644 conf/role/fusionsphere_chef.conf create mode 100644 conf/templates/chef_installer/openstack_icehouse/environments/fusionsphere.tmpl diff --git a/conf/adapter/chef_fusionsphere.conf b/conf/adapter/chef_fusionsphere.conf new file mode 100644 index 00000000..ff18621b --- /dev/null +++ b/conf/adapter/chef_fusionsphere.conf @@ -0,0 +1,8 @@ +NAME = 'fusionsphere_icehouse' +DISPLAY_NAME = 'FusionSphere Icehouse' +PARENT = 'openstack' +PACKAGE_INSTALLER = 'chef_installer' +OS_INSTALLER = 'cobbler' +SUPPORTED_OS_PATTERNS = ['(?i)uvp.*'] +DEPLOYABLE = True +HEALTH_CHECK_COMMAND = 'python /opt/compass/health_check.py' diff --git a/conf/adapter/chef_openstack.conf b/conf/adapter/chef_openstack.conf index fa1c92ea..f96e39c0 100644 --- a/conf/adapter/chef_openstack.conf +++ b/conf/adapter/chef_openstack.conf @@ -3,6 +3,6 @@ DISPLAY_NAME = 'OpenStack Icehouse' PARENT = 'openstack' PACKAGE_INSTALLER = 'chef_installer' OS_INSTALLER = 'cobbler' -SUPPORTED_OS_PATTERNS = ['(?i)centos.*', '(?i)ubuntu.*'] +SUPPORTED_OS_PATTERNS = ['(?i)centos.*', '(?i)ubuntu.*', '(?i)sles.*'] DEPLOYABLE = True HEALTH_CHECK_COMMAND = 'python /opt/compass/health_check.py' diff --git a/conf/adapter/os_only.conf b/conf/adapter/os_only.conf index 3195aac5..253ff84c 100644 --- a/conf/adapter/os_only.conf +++ b/conf/adapter/os_only.conf @@ -1,5 +1,5 @@ NAME = 'os_only' PARENT = 'general' OS_INSTALLER = 'cobbler' -SUPPORTED_OS_PATTERNS = ['(?i)centos.*', '(?i)ubuntu.*', '(?i)sles.*'] +SUPPORTED_OS_PATTERNS = ['(?i)centos.*', '(?i)ubuntu.*', '(?i)sles.*', '(?i)uvp.*'] DEPLOYABLE = True diff --git a/conf/flavor/fusionsphere_chef.conf b/conf/flavor/fusionsphere_chef.conf new file mode 100644 index 00000000..d5a52b00 --- /dev/null +++ b/conf/flavor/fusionsphere_chef.conf @@ -0,0 +1,25 @@ +ADAPTER_NAME = 'fusionsphere_icehouse' +FLAVORS = [{ + 'flavor': 'allinone', + 'display_name': 'All-In-One', + 'template': 'fusionsphere.tmpl', + 'roles': ['allinone-compute'] +}, { + 'flavor': 'single-contoller-multi-compute', + 'display_name': 'Single Controller, Multi-compute', + 'template': 'fusionsphere.tmpl', + 'roles': [ + 'os-controller', 'os-compute-worker', 'os-network', + 'os-block-storage-volume' + ] +}, { + 'flavor': 'multinodes', + 'display_name': 'Multi-node Cluster', + 'template': 'fusionsphere.tmpl', + 'roles': [ + 'os-ops-database', 'os-identity', 'os-ops-messaging', + 'os-compute-controller', 'os-compute-worker', 'os-network-worker', + 'os-network-server', 'os-block-storage-controller', 'os-block-storage-volume', + 'os-image', 'os-dashboard' + ] +}] diff --git a/conf/os/uvp11sp3.conf b/conf/os/uvp11sp3.conf new file mode 100644 index 00000000..41a99b15 --- /dev/null +++ b/conf/os/uvp11sp3.conf @@ -0,0 +1,3 @@ +NAME = 'uvp-11sp3-x86_64' +PARENT = 'suse' +DEPLOYABLE = True diff --git a/conf/role/fusionsphere_chef.conf b/conf/role/fusionsphere_chef.conf new file mode 100644 index 00000000..fda2e993 --- /dev/null +++ b/conf/role/fusionsphere_chef.conf @@ -0,0 +1,69 @@ +ADAPTER_NAME = 'fusionsphere_icehouse' +ROLES = [{ + 'role': 'os-compute-worker', + 'display_name': 'compute node', + 'description': 'compute node' +}, { + 'role': 'os-network', + 'display_name': 'network node', + 'description': 'network node including network server' +}, { + 'role': 'os-network-server', + 'display_name': 'network server node', + 'description': 'network server node' +}, { + 'role': 'os-network-worker', + 'display_name': 'network node', + 'description': 'network node including network server' +}, { + 'role': 'os-block-storage-controller', + 'display_name': 'storage controller node', + 'description': 'storage controller node' +}, { + 'role': 'os-block-storage-volume', + 'display_name': 'storage node', + 'description': 'storage node', + 'optional': True +}, { + 'role': 'os-image', + 'display_name': 'image node', + 'description': 'image node' +}, { + 'role': 'os-compute-vncproxy', + 'display_name': 'vnc proxy node', + 'description': 'vnc proxy node' +}, { + 'role': 'os-controller', + 'display_name': 'controller node', + 'description': 'controller node including identity, dashboard, network server, and block stroage controller services' +}, { + 'role': 'os-compute-controller', + 'display_name': 'Nova controller node', + 'description': 'controller node for nova APIs' +}, { + 'role': 'os-ops-messaging', + 'display_name': 'message queue node', + 'description': 'message queue node' +}, { + 'role': 'os-ops-database', + 'display_name': 'database node', + 'description': 'database node' +}, { + 'role': 'os-identity', + 'display_name': 'keystone node', + 'description': 'keystone node' +}, { + 'role': 'os-dashboard', + 'display_name': 'dashboard node', + 'description': 'dashboard node' +}, { + 'role': 'os-ha', + 'display_name': 'ha proxy node', + 'description': 'ha proxy node', + 'optional': True +}, { + 'role': 'allinone-compute', + 'display_name': 'all in one compute', + 'description': 'all in one compute', + 'optional': True +}] diff --git a/conf/setting b/conf/setting index 4f7f7c5f..a1e9bff2 100644 --- a/conf/setting +++ b/conf/setting @@ -13,7 +13,7 @@ DEFAULT_LOGDIR = '/var/log/compass' DEFAULT_LOGINTERVAL = 6 DEFAULT_LOGINTERVAL_UNIT = 'h' DEFAULT_LOGFORMAT = '%(asctime)s - %(filename)s - %(lineno)d - %(levelname)s - %(message)s' -WEB_LOGFILE = 'compass.log' +WEB_LOGFILE = 'compass_web.log' CELERY_LOGFILE = 'celery.log' CELERYCONFIG_DIR = '/etc/compass' CELERYCONFIG_FILE = 'celeryconfig' diff --git a/conf/templates/chef_installer/openstack_icehouse/environments/base.tmpl b/conf/templates/chef_installer/openstack_icehouse/environments/base.tmpl index 2a476b18..6f3a388b 100644 --- a/conf/templates/chef_installer/openstack_icehouse/environments/base.tmpl +++ b/conf/templates/chef_installer/openstack_icehouse/environments/base.tmpl @@ -127,7 +127,6 @@ } }, "default_attributes": { - "local_repo": "", "mysql": { "server_root_password": "$db_pass", "server_debian_password": "$db_pass", @@ -191,7 +190,6 @@ "verbose": "True", "debug": "True", "service_plugins": [ - "router" ], "ml2": { "type_drivers": "$tenant_network_type", diff --git a/conf/templates/chef_installer/openstack_icehouse/environments/fusionsphere.tmpl b/conf/templates/chef_installer/openstack_icehouse/environments/fusionsphere.tmpl new file mode 100644 index 00000000..03facb98 --- /dev/null +++ b/conf/templates/chef_installer/openstack_icehouse/environments/fusionsphere.tmpl @@ -0,0 +1,425 @@ +#set controller = $get_role('os_compute_controller', [$get_role('os_controller', None), $get_role('allinone_compute', None)]) + +## Contoller node management IP/interface +#set controller_ip = $controller.management.ip +#set controller_nic = $controller.management.interface + +## Compute node management IP/interface +#set compute = $get_role('os_compute_worker', $get_role('allinone_compute', None)) +#set compute_nic = $compute.management.interface + +## Network server/worker node IP/interface +#set network = $get_role('os_network', None) +#set network_server = $get_role('os_network_server', [$network, $controller]) +#set network_worker = $get_role('os_network_worker', [$network, $compute]) + +#set network_server_ip = $network_server.management.ip +#set network_server_nic = $network_server.management.interface + +## Network worker node management IP/interface +#set network_worker_ip = $network_worker.management.ip +#set network_worker_nic = $network_worker.management.interface +#set network_worker_tenant_nic = $network_worker.tenant.interface +#set network_worker_public_nic = $network_worker.external.interface + +## Database node management IP +#set db_role = $get_role('os_ops_database', $controller) +#set db_ip = $db_role.management.ip +#set db_nic = $db_role.management.interface + +## Message queue node management IP/interface +#set msg_queue = $get_role('os_ops_messaging', $controller) +#set msg_queue_ip = $msg_queue.management.ip + +## Identity (keystone) node IP/interface +#set identity = $get_role('os_identity', $controller) +#set identity_ip = $identity.management.ip +#set identity_nic = $identity.management.interface + +## Glance node management IP/interface +#set glance = $get_role('os_image', $controller) +#set glance_ip = $glance.management.ip +#set glance_nic = $glance.management.interface + +## Cinder node management IP/interface +#set cinder = $get_role('os_block_storage_controller', $controller) +#set cinder_controller_ip = $cinder.management.ip +#set cinder_controller_nic = $cinder.management.interface + +## Dashboard node management IP/interface +#set dash = $get_role('os_dashboard', $controller) +#set dash_ip = $dash.management.ip + +## Set services credentials +#set db_pass = $getDictValue('service_credentials/mysql/password', 'root') +#set mq_username = $getDictValue('service_credentials/rabbitmq/username', 'guest') +#set mq_pass = $getDictValue('service_credentials/rabbitmq/password', 'guest') + +## Set Openstack neutron config +#set tenant_network_type = $getDictValue('neutron_config/openvswitch/tenant_network_type', 'gre') +#set enable_tunneling = True +#set tunnel_id_ranges = '' +#set vlan_ranges = '' +#set bridge_mappings = '' + +#if $tenant_network_type == 'vlan' + #set enable_tunneling = False + #set bridge_mappings = ','.join($getDictValue('neutron_config/openvswitch/bridge_mappings', ['physnet1:br-eth1'])) + #set vlan_ranges = ','.join($getDictValue('neutron_config/openvswitch/vlan_ranges', ['physnet1:2700:2999'])) +#else + #set tunnel_id_ranges = ','.join($getDictValue('neutron_config/openvswitch/tunnel_id_ranges', ['1:1000'])) +#end if + +## Utility functions definition +#def get_role($role_name, $default_roles=None) + #set target_role = $getVar($role_name, None) + #if isinstance($target_role, list) + #if $target_role + #set target_role = $target_role[0] + #else + #set target_role = None + #end if + #end if + #if $target_role is None and $default_roles is not None + #if isinstance($default_roles, list) + #for $role in $default_roles + #if $role is not None + #set target_role = $role + #break + #end if + #end for + #else + #set target_role = $default_roles + #end if + #end if + #return $target_role +#end def + +#def getDictValue($path, $default_value="") + #set keys = str($path).split('/') + #set value = $getVar($keys[0], {}) + + #if not $value + #return $default_value + #else + #for $key in $keys[1:] + #try + #set value = $value[$key] + #except + #return $default_value + #end try + #end for + #end if + + #return $value + +#end def +{ + "name": "base", + "description": "Environment used in testing the upstream cookbooks and reference Chef repository", + "cookbook_versions": { + }, + "json_class": "Chef::Environment", + "chef_type": "environment", + "override_attributes": { + "compass": { + "cluster_id": "$id" + } + }, + "default_attributes": { + "mysql": { + "server_root_password": "$db_pass", + "server_debian_password": "$db_pass", + "server_repl_password": "$db_pass", + "allow_remote_root": true, + "root_network_acl": "%" + }, + "collectd": { + "server": { + "host": "metrics", + "port": "4242", + "protocol": "tcp" + } + }, + "memcached": { + "bind_interface": "$identity_nic" + }, + "openstack": { + "use_databags": false, + "auth": { + "validate_certs": false + }, + "block-storage": { + "syslog": { + "use": false + }, + "api": { + "ratelimit": "False" + }, + "debug": true + }, + "dashboard": { + "use_ssl": "false" + }, + "compute": { + "syslog": { + "use": false + }, + "libvirt": { + "bind_interface": "$compute_nic" + }, + "novnc_proxy": { + "bind_interface": "$compute_nic" + }, + "xvpvnc_proxy": { + "bind_interface": "$compute_nic" + }, + "ratelimit": { + "api": { + "enabled": false + }, + "volume": { + "enabled": false + } + }, + "network": { + "service_type": "neutron" + } + }, + "network": { + "verbose": "True", + "debug": "True", + "service_plugins": [ + ], + "ml2": { + "type_drivers": "local,flat,vlan,gre,vxlan", + "tenant_network_types": "vxlan, flat, vlan", + "tunnel_id_ranges": "$tunnel_id_ranges", + "network_vlan_ranges": "physnet1:1:4000", + "enable_security_group": "True" + }, + "openvswitch": { + "tenant_network_type": "vxlan", + "enable_tunneling": "$enable_tunneling", + "tunnel_id_ranges": "$tunnel_id_ranges", + "network_vlan_ranges": "physnet1:1:4000", + "bridge_mappings": "physnet1:br-ex", + "bind_interface": "$network_worker_tenant_nic" + }, + "l3": { + "external_network_bridge_interface": "$network_worker_public_nic" + } + }, + "db": { + "bind_interface": "$db_nic", + "compute": { + "host": "$db_ip" + }, + "identity": { + "host": "$db_ip" + }, + "image": { + "host": "$db_ip" + }, + "network": { + "host": "$db_ip" + }, + "volume": { + "host": "$db_ip" + }, + "dashboard": { + "host": "$db_ip" + }, + "telemetry": { + "host": "$db_ip" + }, + "orchestration": { + "host": "$db_ip" + } + }, + "developer_mode": true, + "endpoints": { + "db": { + "host": "$db_ip" + }, + "mq": { + "host": "$msg_queue_ip" + }, + "compute-api": { + "host": "$controller_ip", + "scheme": "http", + "port": "8774", + "path": "/v2/%(tenant_id)s" + }, + "compute-api-bind": { + "bind_interface": "$controller_nic" + }, + "compute-ec2-admin": { + "host": "$controller_ip", + "scheme": "http", + "port": "8773", + "path": "/services/Admin" + }, + "compute-ec2-api": { + "host": "$controller_ip", + "scheme": "http", + "port": "8773", + "path": "/services/Cloud" + }, + "compute-novnc": { + "host": "$controller_ip", + "scheme": "http", + "port": "6080", + "path": "/vnc_auto.html" + }, + "compute-novnc-bind": { + "bind_interface": "$controller_nic" + }, + "compute-vnc-bind": { + "bind_interface" : "$compute_nic" + }, + "vnc_bind": { + "bind_interface": "$controller_nic" + }, + "image-api": { + "host": "$glance_ip", + "scheme": "http", + "port": "9292", + "path": "/v2" + }, + "image-api-bind": { + "bind_interface": "$glance_nic" + }, + "image-registry": { + "host": "$glance_ip", + "scheme": "http", + "port": "9191", + "path": "/v2" + }, + "image-registry-bind": { + "bind_interface": "$glance_nic" + }, + "identity-bind": { + "bind_interface": "$identity_nic" + }, + "identity-api": { + "host": "$identity_ip", + "scheme": "http", + "port": "5000", + "path": "/v2.0" + }, + "identity-admin": { + "host": "$identity_ip", + "scheme": "http", + "port": "35357", + "path": "/v2.0" + }, + "block-storage-api": { + "host": "$cinder_controller_ip", + "scheme": "http", + "port": "8776", + "path": "/v1/%(tenant_id)s" + }, + "block-storage-api-bind": { + "bind_interface": "$cinder_controller_nic" + }, + "telemetry-api": { + "host": "$controller_ip", + "scheme": "http", + "port": "8777", + "path": "/v1" + }, + "network-api": { + "host": "$network_server_ip", + "scheme": "http", + "port": "9696", + "path": "" + }, + "network-api-bind": { + "bind_interface": "$network_server_nic" + }, + "orchestration-api": { + "host": "$controller_ip", + "scheme": "http", + "port": "8004", + "path": "/v1/%(tenant_id)s" + }, + "orchestration-api-cfn": { + "host": "$controller_ip", + "scheme": "http", + "port": "8000", + "path": "/v1" + } + }, + "identity": { + "admin_user": "admin", + "bind_interface": "$identity_nic", + "catalog": { + "backend": "sql" + }, + "debug": true, + "roles": [ + "admin", + "member" + ], + "syslog": { + "use": false + }, + "tenants": [ + "admin", + "service", + "demo" + ], + "token": { + "backend": "sql" + }, + "users": { + "admin": { + "password": "admin", + "default_tenant": "admin", + "roles": { + "admin": [ + "admin" + ] + } + }, + "demo": { + "password": "demo", + "default_tenant": "demo", + "roles": { + "member": [ + "demo" + ] + } + } + } + }, + "image": { + "api": { + "bind_interface": "$glance_nic" + }, + "debug": true, + "registry": { + "bind_interface": "$glance_nic" + }, + "syslog": { + "use": false + }, + "upload_image": { + "cirros": "http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img" + }, + "upload_images": [ + "cirros" + ] + }, + "mq": { + "user": "$mq_username", + "password": "$mq_pass", + "vhost": "/nova", + "network": { + "service_type": "rabbitmq" + } + } + } + } +} diff --git a/install/cobbler.sh b/install/cobbler.sh index dec572ac..8bc7c117 100755 --- a/install/cobbler.sh +++ b/install/cobbler.sh @@ -34,6 +34,9 @@ sudo chkconfig cobblerd on # create backup dir sudo mkdir -p /root/backup/cobbler +# update bootloaders +download -u "$COBBLER_LOADERS_SOURCE" -u "$COBBLER_LOADERS_SOURCE_ASIA" loaders.tar.gz unzip /var/lib/cobbler || exit $? + # update httpd conf sudo cp -rn /etc/httpd/conf.d /root/backup/cobbler/ sudo rm -f /etc/httpd/conf.d/cobbler_web.conf @@ -176,6 +179,13 @@ sudo service httpd restart sudo service cobblerd restart sudo cobbler get-loaders +if [[ "$?" != "0" ]]; then + echo "failed to get loaders for cobbler" + exit 1 +else + echo "cobbler loaders updated" +fi + sudo cobbler sync if [[ "$?" != "0" ]]; then echo "failed to sync cobbler" @@ -384,6 +394,30 @@ if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then download -u "$SLES_11SP3_PPA_REPO_SOURCE" -u "$SLES_11SP3_PPA_REPO_SOURCE_ASIA" sles_11sp3_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? fi +if [[ $SUPPORT_UVP_11SP3 == "y" ]]; then + sudo mkdir -p /var/lib/cobbler/repo_mirror/sles_11sp3_ppa_repo + found_sles_11sp3_ppa_repo=0 + for repo in $(cobbler repo list); do + if [ "$repo" == "sles_11sp3_ppa_repo" ]; then + found_sles_11sp3_ppa_repo=1 + fi + done + + if [ "$found_sles_11sp3_ppa_repo" == "0" ]; then + sudo cobbler repo add --mirror=/var/lib/cobbler/repo_mirror/sles_11sp3_ppa_repo --name=sles_11sp3_ppa_repo --mirror-locally=Y --arch=x86_64 + if [[ "$?" != "0" ]]; then + echo "failed to add sles_11sp3_ppa_repo" + exit 1 + else + echo "sles_11sp3_ppa_repo is added" + fi + else + echo "repo sles_11sp3_ppa_repo has already existed." + fi + + download -u "$SLES_11SP3_PPA_REPO_SOURCE" -u "$SLES_11SP3_PPA_REPO_SOURCE_ASIA" sles_11sp3_ppa_repo.tar.gz unzip /var/lib/cobbler/repo_mirror || exit $? +fi + sudo cobbler reposync if [[ "$?" != "0" ]]; then @@ -492,14 +526,31 @@ if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then fi fi +if [[ $SUPPORT_UVP_11SP3 == "y" ]]; then + download -u "$SLES_11SP3_IMAGE_SOURCE_ASIA" -u "$SLES_11SP3_IMAGE_SOURCE" sles-11sp3-x86_64.iso copy /var/lib/cobbler/iso/ || exit $? + sudo mkdir -p /mnt/sles-11sp3-x86_64 + if [ $(mount | grep -c "/mnt/sles-11sp3-x86_64") -eq 0 ]; then + sudo mount -o loop /var/lib/cobbler/iso/sles-11sp3-x86_64.iso /mnt/sles-11sp3-x86_64 + if [[ "$?" != "0" ]]; then + echo "failed to mount image /mnt/sles-11sp3-x86_64" + exit 1 + else + echo "/mnt/sles-11sp3-x86_64 is mounted" + fi + else + echo "/mnt/sles-11sp3-x86_64 has already mounted" + fi + download -u "$UVP_11SP3_IMAGE_SOURCE" -u "$UVP_11SP3_IMAGE_SOURCE_ASIA" uvp-os-11sp3-x86_64.tar.gz copy /var/www/cobbler/aux/uvp-11sp3-x86_64.tar.gz || exit $? +fi + + # add distro if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then found_centos_6_5_distro=0 - for distro in $(cobbler distro list); do - if [ "$distro" == "CentOS-6.5-x86_64" ]; then - found_centos_6_5_distro=1 - fi - done + distro=$(cobbler distro find --name=CentOS-6.5-x86_64) + if [ "$distro" == "CentOS-6.5-x86_64" ]; then + found_centos_6_5_distro=1 + fi if [ "$found_centos_6_5_distro" == "0" ]; then sudo cobbler import --path=/mnt/CentOS-6.5-x86_64 --name=CentOS-6.5 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.ks --breed=redhat @@ -521,11 +572,10 @@ if [[ $SUPPORT_CENTOS_6_5 == "y" ]]; then fi centos_6_5_found_profile=0 - for profile in $(cobbler profile list); do - if [ "$profile" == "CentOS-6.5-x86_64" ]; then - centos_6_5_found_profile=1 - fi - done + profile=$(cobbler profile find --name=CentOS-6.5-x86_64) + if [ "$profile" == "CentOS-6.5-x86_64" ]; then + centos_6_5_found_profile=1 + fi if [ "$centos_6_5_found_profile" == "0" ]; then sudo cobbler profile add --name="CentOS-6.5-x86_64" --repo=centos_6_5_ppa_repo --distro=CentOS-6.5-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/CentOS-6.5-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.ks @@ -549,11 +599,10 @@ fi if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then found_centos_6_6_distro=0 - for distro in $(cobbler distro list); do - if [ "$distro" == "CentOS-6.6-x86_64" ]; then - found_centos_6_6_distro=1 - fi - done + distro=$(cobbler distro find --name=CentOS-6.6-x86_64) + if [ "$distro" == "CentOS-6.6-x86_64" ]; then + found_centos_6_6_distro=1 + fi if [ "$found_centos_6_6_distro" == "0" ]; then sudo cobbler import --path=/mnt/CentOS-6.6-x86_64 --name=CentOS-6.6 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.ks --breed=redhat @@ -575,11 +624,10 @@ if [[ $SUPPORT_CENTOS_6_6 == "y" ]]; then fi centos_6_6_found_profile=0 - for profile in $(cobbler profile list); do - if [ "$profile" == "CentOS-6.6-x86_64" ]; then - centos_6_6_found_profile=1 - fi - done + profile=$(cobbler profile find --name=CentOS-6.6-x86_64) + if [ "$profile" == "CentOS-6.6-x86_64" ]; then + centos_6_6_found_profile=1 + fi if [ "$centos_6_6_found_profile" == "0" ]; then sudo cobbler profile add --name="CentOS-6.6-x86_64" --repo=centos_6_6_ppa_repo --distro=CentOS-6.6-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/CentOS-6.6-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.ks @@ -603,11 +651,10 @@ fi if [[ $SUPPORT_CENTOS_7_0 == "y" ]]; then found_centos_7_0_distro=0 - for distro in $(cobbler distro list); do - if [ "$distro" == "CentOS-7.0-x86_64" ]; then - found_centos_7_0_distro=1 - fi - done + distro=$(cobbler distro find --name=CentOS-7.0-x86_64) + if [ "$distro" == "CentOS-7.0-x86_64" ]; then + found_centos_7_0_distro=1 + fi if [ "$found_centos_7_0_distro" == "0" ]; then sudo cobbler import --path=/mnt/CentOS-7.0-x86_64 --name=CentOS-7.0 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.ks --breed=redhat @@ -657,11 +704,10 @@ fi if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then found_ubuntu_12_04_distro=0 - for distro in $(cobbler distro list); do - if [ "$distro" == "Ubuntu-12.04-x86_64" ]; then - found_ubuntu_12_04_distro=1 - fi - done + distro=$(cobbler distro find --name=Ubuntu-12.04-x86_64) + if [ "$distro" == "Ubuntu-12.04-x86_64" ]; then + found_ubuntu_12_04_distro=1 + fi if [ "$found_ubuntu_12_04_distro" == "0" ]; then sudo cobbler import --path=/mnt/Ubuntu-12.04-x86_64 --name=Ubuntu-12.04 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.seed --breed=ubuntu @@ -683,11 +729,10 @@ if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then fi ubuntu_12_04_found_profile=0 - for profile in $(cobbler profile list); do - if [ "$profile" == "Ubuntu-12.04-x86_64" ]; then - ubuntu_12_04_found_profile=1 - fi - done + profile=$(cobbler profile find --name=Ubuntu-12.04-x86_64) + if [ "$profile" == "Ubuntu-12.04-x86_64" ]; then + ubuntu_12_04_found_profile=1 + fi if [ "$ubuntu_12_04_found_profile" == "0" ]; then sudo cobbler profile add --name=Ubuntu-12.04-x86_64 --repo=ubuntu_12_04_ppa_repo --distro=Ubuntu-12.04-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/Ubuntu-12.04-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.seed --kopts="netcfg/choose_interface=auto" @@ -707,16 +752,18 @@ if [[ $SUPPORT_UBUNTU_12_04 == "y" ]]; then echo "profile Ubuntu-12.04-x86_64 is updated" fi fi - sudo cobbler repo remove --name=Ubuntu-12.04-x86_64 + remove_repo=$(cobbler repo find --name=Ubuntu-12.04-x86_64) + if [ "$remove_repo" == "Ubuntu-12.04-x86_64" ]; then + sudo cobbler repo remove --name=Ubuntu-12.04-x86_64 + fi fi if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then found_ubuntu_14_04_distro=0 - for distro in $(cobbler distro list); do - if [ "$distro" == "Ubuntu-14.04-x86_64" ]; then - found_ubuntu_14_04_distro=1 - fi - done + distro=$(cobbler distro find --name=Ubuntu-14.04-x86_64) + if [ "$distro" == "Ubuntu-14.04-x86_64" ]; then + found_ubuntu_14_04_distro=1 + fi if [ "$found_ubuntu_14_04_distro" == "0" ]; then sudo cobbler import --path=/mnt/Ubuntu-14.04-x86_64 --name=Ubuntu-14.04 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.seed --breed=ubuntu @@ -738,11 +785,10 @@ if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then fi ubuntu_14_04_found_profile=0 - for profile in $(cobbler profile list); do - if [ "$profile" == "Ubuntu-14.04-x86_64" ]; then - ubuntu_14_04_found_profile=1 - fi - done + profile=$(cobbler profile find --name=Ubuntu-14.04-x86_64) + if [ "$profile" == "Ubuntu-14.04-x86_64" ]; then + ubuntu_14_04_found_profile=1 + fi if [ "$ubuntu_14_04_found_profile" == "0" ]; then sudo cobbler profile add --name=Ubuntu-14.04-x86_64 --repo=ubuntu_14_04_ppa_repo --distro=Ubuntu-14.04-x86_64 --ksmeta="tree=http://$IPADDR/cobbler/ks_mirror/Ubuntu-14.04-x86_64" --kickstart=/var/lib/cobbler/kickstarts/default.seed --kopts="netcfg/choose_interface=auto" @@ -762,16 +808,18 @@ if [[ $SUPPORT_UBUNTU_14_04 == "y" ]]; then echo "profile Ubuntu-14.04-x86_64 is updated" fi fi - sudo cobbler repo remove --name=Ubuntu-14.04-x86_64 + remove_repo=$(cobbler repo find --name=Ubuntu-14.04-x86_64) + if [ "$remove_repo" == "Ubuntu-14.04-x86_64" ]; then + sudo cobbler repo remove --name=Ubuntu-14.04-x86_64 + fi fi if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then found_sles_11sp3_distro=0 - for distro in $(cobbler distro list); do - if [ "$distro" == "sles-11sp3-x86_64" ]; then - found_sles_11sp3_distro=1 - fi - done + distro=$(cobbler distro find --name=sles-11sp3-x86_64) + if [ "$distro" == "sles-11sp3-x86_64" ]; then + found_sles_11sp3_distro=1 + fi if [ "$found_sles_11sp3_distro" == "0" ]; then sudo cobbler import --path=/mnt/sles-11sp3-x86_64 --name=sles-11sp3 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.xml --breed=suse --os-version=sles11sp3 @@ -793,11 +841,10 @@ if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then fi sles_11sp3_found_profile=0 - for profile in $(cobbler profile list); do - if [ "$profile" == "sles-11sp3-x86_64" ]; then - sles_11sp3_found_profile=1 - fi - done + profile=$(cobbler profile find --name=sles-11sp3-x86_64) + if [ "$profile" == "sles-11sp3-x86_64" ]; then + sles_11sp3_found_profile=1 + fi if [ "$sles_11sp3_found_profile" == "0" ]; then sudo cobbler profile add --name=sles-11sp3-x86_64 --repo=sles_11sp3_ppa_repo --distro=sles-11sp3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.xml --kopts="textmode=1 install=http://$IPADDR/cobbler/ks_mirror/sles-11sp3-x86_64" @@ -819,6 +866,57 @@ if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then fi fi +if [[ $SUPPORT_UVP_11SP3 == "y" ]]; then + found_uvp_11sp3_distro=0 + distro=$(cobbler distro find --name=uvp-11sp3-x86_64) + if [ "$distro" == "uvp-11sp3-x86_64" ]; then + found_uvp_11sp3_distro=1 + fi + + if [ "$found_uvp_11sp3_distro" == "0" ]; then + sudo cobbler import --path=/mnt/sles-11sp3-x86_64 --name=uvp-11sp3 --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.xml --breed=suse --os-version=sles11sp3 + if [[ "$?" != "0" ]]; then + echo "failed to import /mnt/sles-11sp3-x86_64" + exit 1 + else + echo "/mnt/sles-11sp3-x86_64 is imported" + fi + else + echo "distro uvp-11sp3-x86_64 has already existed" + sudo cobbler distro edit --name=uvp-11sp3-x86_64 --arch=x86_64 --breed=suse --os-version=sles11sp3 + if [[ "$?" != "0" ]]; then + echo "failed to edit distro uvp-11sp3-x86_64" + exit 1 + else + echo "distro uvp-11sp3-x86_64 is updated" + fi + fi + + uvp_11sp3_found_profile=0 + profile=$(cobbler profile find --name=uvp-11sp3-x86_64) + if [ "$profile" == "uvp-11sp3-x86_64" ]; then + uvp_11sp3_found_profile=1 + fi + + if [ "$uvp_11sp3_found_profile" == "0" ]; then + sudo cobbler profile add --name=uvp-11sp3-x86_64 --repo=sles_11sp3_ppa_repo --distro=uvp-11sp3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.xml --kopts="textmode=1 install=http://$IPADDR/cobbler/ks_mirror/sles-11sp3-x86_64" --kopts-post="noexec=on nohz=off console=tty0 console=ttyS0,115200 hugepagesz=2M hpet=enable selinux=0 iommu=pt default_hugepagesz=2M intel_iommu=on pci=realloc crashkernel=192M@48M highres=on nmi_watchdog=1" --ksmeta="image_kernel_version=3.0.93-0.8 image_url=http://@@http_server@@/cblr/aux/uvp-11sp3-x86_64.tar.gz" + if [[ "$?" != "0" ]]; then + echo "failed to add profile uvp-11sp3-x86_64" + exit 1 + else + echo "profile uvp-11sp3-x86_64 is added" + fi + else + echo "profile sles-11sp3-x86_64 has already existed." + sudo cobbler profile edit --name=uvp-11sp3-x86_64 --repo=sles_11sp3_ppa_repo --distro=sles-11sp3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/default.xml --kopts="textmode=1 install=http://$IPADDR/cobbler/ks_mirror/sles-11sp3-x86_64" --kopts-post="noexec=on nohz=off console=tty0 console=ttyS0,115200 hugepagesz=2M hpet=enable selinux=0 iommu=pt default_hugepagesz=2M intel_iommu=on pci=realloc crashkernel=192M@48M highres=on nmi_watchdog=1" --ksmeta="image_kernel_version=3.0.93-0.8 image_url=http://@@http_server@@/cblr/aux/uvp-11sp3-x86_64.tar.gz" + if [[ "$?" != "0" ]]; then + echo "failed to edit profile uvp-11sp3-x86_64" + exit 1 + else + echo "profile uvp-11sp3-x86_64 is updated" + fi + fi +fi sudo cobbler reposync if [[ "$?" != "0" ]]; then @@ -828,6 +926,14 @@ else echo "cobbler repos are synced" fi +sudo cobbler sync +if [[ "$?" != "0" ]]; then + echo "cobbler sync failed" + exit 1 +else + echo "cobbler are synced" +fi + echo "Checking cobbler is OK" sudo cobbler check if [[ "$?" != "0" ]]; then diff --git a/install/compass.sh b/install/compass.sh index ccbb8f88..2fd45202 100755 --- a/install/compass.sh +++ b/install/compass.sh @@ -63,6 +63,10 @@ if [[ $SUPPORT_SLES_11SP3 != "y" ]]; then sudo rm -f /etc/compass/os/sles11sp3.conf fi +if [[ $SUPPORT_UVP_11SP3 != "y" ]]; then + sudo rm -f /etc/compass/os/uvp11sp3.conf +fi + # add apache user to the group of virtualenv user sudo usermod -a -G `groups $USER|awk '{print$3}'` apache diff --git a/install/compass_web.sh b/install/compass_web.sh index c6e0e341..f179e65d 100755 --- a/install/compass_web.sh +++ b/install/compass_web.sh @@ -43,11 +43,14 @@ if [[ $LOCAL_REPO = "y" ]]; then mkdir -p /var/www/compass_web/v2/apt.repos.d/ubuntu/14.04 download -u "${LOCAL_REPO_US}/ubuntu/14.04/ubuntu_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/ubuntu/14.04/ubuntu_repo.tar.gz" Ubuntu-14.04-x86_64.tar.gz unzip /var/www/compass_web/v2/apt.repos.d/ubuntu/14.04 || exit $? fi - if [[ $SUPPORT_SLES_11SP3 = "y" ]]; then + if [[ $SUPPORT_SLES_11SP3 = "y" ]]; then mkdir -p /var/www/compass_web/v2/zypp.repos.d/sles/11sp3 download -u "${LOCAL_REPO_US}/sles/11sp3/sles_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/sles/11sp3/sles_repo.tar.gz" sles-11sp3-x86_64.tar.gz unzip /var/www/compass_web/v2/zypp.repos.d/sles/11sp3 || exit $? fi - + if [[ $SUPPORT_UVP_11SP3 = "y" ]]; then + mkdir -p /var/www/compass_web/v2/zypp.repos.d/uvp/11sp3 + download -u "${LOCAL_REPO_US}/uvp/11sp3/uvp_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/uvp/11sp3/uvp_repo.tar.gz" uvp-11sp3-x86_64.tar.gz unzip /var/www/compass_web/v2/zypp.repos.d/uvp/11sp3 || exit $? + fi fi sudo service httpd restart diff --git a/install/install.conf b/install/install.conf index d2dd7b92..1e022c85 100755 --- a/install/install.conf +++ b/install/install.conf @@ -60,6 +60,8 @@ export UBUNTU_14_04_IMAGE_SOURCE=${UBUNTU_14_04_IMAGE_SOURCE:-"https://s3-us-wes export UBUNTU_14_04_IMAGE_SOURCE_ASIA=${UBUNTU_14_04_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/ubuntu/14.04/Ubuntu-14.04-x86_64.iso"} export SLES_11SP3_IMAGE_SOURCE=${SLES_11SP3_IMAGE_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/sles/11sp3/sles-11sp3-x86_64.iso"} export SLES_11SP3_IMAGE_SOURCE_ASIA=${SLES_11SP3_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/sles/11sp3/sles-11sp3-x86_64.iso"} +export UVP_11SP3_IMAGE_SOURCE=${UVP_11SP3_IMAGE_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/uvp/11sp3/uvp-os-11sp3-x86_64.tar.gz"} +export UVP_11SP3_IMAGE_SOURCE_ASIA=${UVP_11SP3_IMAGE_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/uvp/11sp3/uvp-os-11sp3-x86_64.tar.gz"} export CENTOS_6_5_PPA_REPO_SOURCE=${CENTOS_6_5_PPA_REPO_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/centos/6.5/centos_6_5_ppa_repo.tar.gz"} export CENTOS_6_5_PPA_REPO_SOURCE_ASIA=${CENTOS_6_5_PPA_REPO_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/centos/6.5/centos_6_5_ppa_repo.tar.gz"} @@ -76,6 +78,9 @@ export SLES_11SP3_PPA_REPO_SOURCE_ASIA=${SLES_11SP3_PPA_REPO_SOURCE_ASIA:-"http: export COBBLER_PASSWORD=${COBBLER_PASSWORD:-"cobbler"} +export COBBLER_LOADERS_SOURCE=${COBBLER_LOADERS_SOURCE:-"https://s3-us-west-1.amazonaws.com/compass-local-repo/loaders.tar.gz"} +export COBBLER_LOADERS_SOURCE_ASIA=${COBBLER_LOADERS_SOURCE_ASIA:-"http://huawei-repo.uubright.com/repos/compass/loaders.tar.gz"} + # Currently the use of Javascript MVC is set to version 3.2.4 export JS_MVC=${JS_MVC:-"javascriptmvc-3.2.4"} diff --git a/install/install.conf.template b/install/install.conf.template index 2db04423..9344c0dd 100755 --- a/install/install.conf.template +++ b/install/install.conf.template @@ -22,6 +22,7 @@ export SUPPORT_CENTOS_7_0=${SUPPORT_CENTOS_7_0:-"y"} export SUPPORT_UBUNTU_12_04=${SUPPORT_UBUNTU_12_04:-"y"} export SUPPORT_UBUNTU_14_04=${SUPPORT_UBUNTU_14_04:-"y"} export SUPPORT_SLES_11SP3=${SUPPORT_SLES_11SP3:-"n"} +export SUPPORT_UVP_11SP3=${SUPPORT_UVP_11SP3:-"n"} # DHCP config export IPADDR=`ifconfig $NIC | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'` diff --git a/install/install.sh b/install/install.sh index a9c8b470..3bd09fa1 100755 --- a/install/install.sh +++ b/install/install.sh @@ -319,6 +319,18 @@ if [[ -z $SUPPORT_SLES_11SP3 ]]; then done fi +if [[ -z $SUPPORT_UVP_11SP3 ]]; then + echo -e "\x1b[32mWould you like to support uvp11sp3?(y/n)\x1b[37m" + while true; do + read ans + case $ans in + y ) export SUPPORT_UVP_11SP3="y"; break;; + n ) export SUPPORT_UVP_11SP3="n"; break;; + * ) echo "I don't understand this";; + esac + done +fi + loadvars NAMESERVER_DOMAINS "ods.com" loadvars NAMESERVER_REVERSE_ZONES "unused" loadvars WEB_SOURCE 'http://git.openstack.org/stackforge/compass-web' diff --git a/install/install_func.sh b/install/install_func.sh index 1ec1aeee..e5cf569d 100755 --- a/install/install_func.sh +++ b/install/install_func.sh @@ -247,7 +247,7 @@ download() elif [[ "$action" == "copy" ]]; then destdir=$2 echo "copy /tmp/$package to $destdir" - sudo cp /tmp/$package $destdir + sudo cp -rn /tmp/$package $destdir if [[ "$?" != "0" ]]; then echo "failed to copy $package to $destdir" exit 1 diff --git a/install/prepare.sh b/install/prepare.sh index 1afe07ef..c4736bf0 100755 --- a/install/prepare.sh +++ b/install/prepare.sh @@ -302,7 +302,12 @@ if [[ $SUPPORT_SLES_11SP3 == "y" ]]; then download -u "$SLES_11SP3_IMAGE_SOURCE" -u "$SLES_11SP3_IMAGE_SOURCE_ASIA" sles-11sp3-x86_64.iso || exit $? fi - +if [[ $SUPPORT_UVP_11SP3 == "y" ]]; then + echo "download sles11sp3 image" + download -u "$SLES_11SP3_IMAGE_SOURCE" -u "$SLES_11SP3_IMAGE_SOURCE_ASIA" sles-11sp3-x86_64.iso || exit $? + echo "download uvp image" + download -u "$UVP_11SP3_IMAGE_SOURCE" -u "$UVP_11SP3_IMAGE_SOURCE_ASIA" uvp-os-11sp3-x86_64.tar.gz || exit $? +fi # download local repo if [[ $LOCAL_REPO == "y" ]]; then @@ -334,7 +339,10 @@ if [[ $LOCAL_REPO == "y" ]]; then echo "download sles11sp3 local repo" download -u "${LOCAL_REPO_US}/sles/11sp3/sles_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/sles/11sp3/sles_repo.tar.gz" sles-11sp3-x86_64.tar.gz || exit $? fi - + if [[ $SUPPORT_UVP_11SP3 == "y" ]]; then + echo "download uvp11sp3 local repo" + download -u "${LOCAL_REPO_US}/uvp/11sp3/uvp_repo.tar.gz" -u "${LOCAL_REPO_HUAWEI}/uvp/11sp3/uvp_repo.tar.gz" uvp-11sp3-x86_64.tar.gz || exit $? + fi fi # Install net-snmp diff --git a/install/setup_env.sh b/install/setup_env.sh index 673441d6..4c6a829f 100755 --- a/install/setup_env.sh +++ b/install/setup_env.sh @@ -17,5 +17,6 @@ SUPPORT_CENTOS_7_0=\${SUPPORT_CENTOS_7_0:-$SUPPORT_CENTOS_7_0} SUPPORT_UBUNTU_12_04=\${SUPPORT_UBUNTU_12_04:-$SUPPORT_UBUNTU_12_04} SUPPORT_UBUNTU_14_04=\${SUPPORT_UBUNTU_14_04:-$SUPPORT_UBUNTU_14_04} SUPPORT_SLES_11SP3=\${SUPPORT_SLES_11SP3:-$SUPPORT_SLES_11SP3} +SUPPORT_UVP_11SP3=\${SUPPORT_UVP_11SP3:-$SUPPORT_UVP_11SP3} EOF chmod ugo+x $SCRIPT_DIR/env.conf diff --git a/service/compass-celeryd b/service/compass-celeryd index 9fdfb2da..196ab070 100755 --- a/service/compass-celeryd +++ b/service/compass-celeryd @@ -48,6 +48,22 @@ start() { RETVAL=$? fi echo + retries=0 + max_retries=10 + output='' + while [ $retries -lt $max_retries ]; do + output=$(C_FORCE_ROOT=1 CELERY_CONFIG_MODULE=compass.utils.celeryconfig_wrapper $CELERY status 2&>1) + RETVAL=$? + if [ "$RETVAL" == "0" ]; then + break + else + sleep 10 + fi + let retries=${retries}+1 + done + if [ "$RETVAL" != "0" ]; then + echo output + fi return $RETVAL } @@ -88,6 +104,10 @@ case "$1" in status -p /var/run/celery-worker.pid $CELERY RETVAL=$? fi + if [ "$RETVAL" == "0" ]; then + C_FORCE_ROOT=1 CELERY_CONFIG_MODULE=compass.utils.celeryconfig_wrapper $CELERY status + RETVAL=$? + fi ;; *) echo "Usage: $0 {start|stop|status|restart}"