From fa4115f9218c660a1475fd44eb96618b7e125f2c Mon Sep 17 00:00:00 2001 From: John Hua Date: Thu, 16 Jul 2015 13:21:21 +0800 Subject: [PATCH] Restructure file hierarchy * Move plugin directory inside * Split newrelease.yaml + Add deploy.sh for deploying fixture and plugin + Add dump.sh for dumping data from nailgun + Add xs_release.yaml for network/wizzard/setting configuration --- .gitignore | 3 + newrelease.yaml => base_release.yaml | 229 --------------- cleardb.py | 18 +- deploy.sh | 6 +- deployment_scripts/deploy.sh | 4 - dump.sh | 16 ++ LICENSE => xenserver-fuel-plugin/LICENSE | 0 .../deployment_scripts/deploy.sh | 1 + .../environment_config.yaml | 0 .../metadata.yaml | 0 .../pre_build_hook | 0 .../repositories}/centos/.gitkeep | 0 .../repositories}/ubuntu/.gitkeep | 0 .../tasks.yaml | 0 xs_release.yaml | 269 ++++++++++++++++++ 15 files changed, 306 insertions(+), 240 deletions(-) rename newrelease.yaml => base_release.yaml (81%) delete mode 100755 deployment_scripts/deploy.sh create mode 100755 dump.sh rename LICENSE => xenserver-fuel-plugin/LICENSE (100%) create mode 100755 xenserver-fuel-plugin/deployment_scripts/deploy.sh rename environment_config.yaml => xenserver-fuel-plugin/environment_config.yaml (100%) rename metadata.yaml => xenserver-fuel-plugin/metadata.yaml (100%) rename pre_build_hook => xenserver-fuel-plugin/pre_build_hook (100%) rename {repositories => xenserver-fuel-plugin/repositories}/centos/.gitkeep (100%) rename {repositories => xenserver-fuel-plugin/repositories}/ubuntu/.gitkeep (100%) rename tasks.yaml => xenserver-fuel-plugin/tasks.yaml (100%) create mode 100644 xs_release.yaml diff --git a/.gitignore b/.gitignore index 4aa674e..4afc066 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,7 @@ *.pyc *.rpm localrc +newrelease.yaml +models/ + diff --git a/newrelease.yaml b/base_release.yaml similarity index 81% rename from newrelease.yaml rename to base_release.yaml index bd23acf..6dc95bf 100644 --- a/newrelease.yaml +++ b/base_release.yaml @@ -1169,232 +1169,3 @@ datacenter: "" datastore: "" modes: ['ha_compact'] -- pk: 10 - extend: *base_release - fields: - name: "Juno+Citrix XenServer on Ubuntu 14.04.1" - version: "2014.2.2-6.1" - can_update_from_versions: [] - operating_system: "Ubuntu" - description: "This option will install the OpenStack Juno packages using Ubuntu as a base operating system. With high availability features built in, you are getting a robust, enterprise-grade OpenStack deployment." - attributes_metadata: - editable: - kernel_params: - kernel: - value: "console=ttyS0,9600 console=tty0 net.ifnames=0 biosdevname=0 rootdelay=90 nomodeset" - repo_setup: - metadata: - label: "Repositories" - weight: 50 - always_editable: true - repos: - type: "custom_repo_configuration" - extra_priority: null - description: | - Please note: the first repository will be considered the operating system mirror that will be used during node provisioning. - To create a local repository mirror on the Fuel master node, please follow the instructions provided by running "fuel-createmirror --help" on the Fuel master node. - Please make sure your Fuel master node has Internet access to the repository before attempting to create a mirror. - For more details, please refer to the documentation (https://docs.mirantis.com/openstack/fuel/fuel-6.1/operations.html#external-ubuntu-ops). - value: - - type: "deb" - name: "ubuntu" - uri: "http://archive.ubuntu.com/ubuntu/" - suite: "trusty" - section: "main universe multiverse" - priority: null - - type: "deb" - name: "ubuntu-updates" - uri: "http://archive.ubuntu.com/ubuntu/" - suite: "trusty-updates" - section: "main universe multiverse" - priority: null - - type: "deb" - name: "ubuntu-security" - uri: "http://archive.ubuntu.com/ubuntu/" - suite: "trusty-security" - section: "main universe multiverse" - priority: null - - type: "deb" - name: "mos" - uri: "http://{settings.MASTER_IP}:8080/{cluster.release.version}/ubuntu/x86_64" - suite: "mos6.1" - section: "main restricted" - priority: 1050 - - type: "deb" - name: "mos-updates" - uri: "http://mirror.fuel-infra.org/mos/ubuntu/" - suite: "mos6.1-updates" - section: "main restricted" - priority: 1050 - - type: "deb" - name: "mos-security" - uri: "http://mirror.fuel-infra.org/mos/ubuntu/" - suite: "mos6.1-security" - section: "main restricted" - priority: 1050 - - type: "deb" - name: "mos-holdback" - uri: "http://mirror.fuel-infra.org/mos/ubuntu/" - suite: "mos6.1-holdback" - section: "main restricted" - priority: 1100 - - type: "deb" - name: "Auxiliary" - uri: "http://{settings.MASTER_IP}:8080/{cluster.release.version}/ubuntu/auxiliary" - suite: "auxiliary" - section: "main restricted" - priority: 1150 - generated: - repo_setup: - installer_kernel: - remote_relative: "dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux" - local: "/var/www/nailgun/ubuntu/x86_64/images/linux" - installer_initrd: - remote_relative: "dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz" - local: "/var/www/nailgun/ubuntu/x86_64/images/initrd.gz" - cobbler: - profile: - generator_arg: "ubuntu_1404_x86_64" - provision: - codename: "trusty" - image_data: - /: - uri: "http://{settings.MASTER_IP}:8080/targetimages/env_{cluster.id}_ubuntu_1404_amd64.img.gz" - format: "ext4" - container: "gzip" - /boot: - uri: "http://{settings.MASTER_IP}:8080/targetimages/env_{cluster.id}_ubuntu_1404_amd64-boot.img.gz" - format: "ext2" - container: "gzip" - wizard_metadata: - Mode: - metadata: - restrictions: - - condition: "true" - action: "hide" - mode: - type: "radio" - bind: "cluster:mode" - values: - - data: "ha_compact" - label: "cluster.mode.ha_compact" - Compute: - hypervisor: - type: "radio" - value: "xen" - weight: 5 - bind: "settings:common.libvirt_type.value" - values: - - data: "xen" - label: "XenServer" - description: "dialog.create_cluster_wizard.compute.kvm_description" - bind: - - "wizard:Network.manager": "nova-network" - - "wizard:Storage.ceph": "disable" - - data: "kvm" - label: "dialog.create_cluster_wizard.compute.kvm" - description: "dialog.create_cluster_wizard.compute.kvm_description" - restrictions: - - condition: "'XenServer' in settings:name" - message: "only" - bind: - - "wizard:Storage.ceph": "disable" - - "wizard:Network.manager": "neutron-vlan" - - data: "qemu" - label: "dialog.create_cluster_wizard.compute.qemu" - description: "dialog.create_cluster_wizard.compute.qemu_description" - restrictions: - - condition: "'XenServer' in settings:name" - action: disable - bind: - - "wizard:Storage.ceph": "disable" - - "wizard:Network.manager": "neutron-vlan" - vcenter: - type: "checkbox" - weight: 10 - label: "dialog.create_cluster_wizard.compute.vcenter" - description: "dialog.create_cluster_wizard.compute.vcenter_description" - bind: - - "wizard:Storage.ceph": "disable" - - "wizard:Network.manager": "nova-network" - - "settings:common.use_vcenter.value" - restrictions: - - condition: "'XenServer' in settings:name" - action: disable - Network: - manager: - type: "radio" - value: "nova-network" - values: - - data: "neutron-vlan" - label: "dialog.create_cluster_wizard.network.neutr_vlan" - description: "dialog.create_cluster_wizard.network.neutr_vlan_description" - restrictions: - - condition: "'XenServer' in settings:name" - message: "only" - bind: - - "cluster:net_provider": "neutron" - - "cluster:net_segment_type": "vlan" - - data: "neutron-gre" - label: "dialog.create_cluster_wizard.network.neutr_gre" - description: "dialog.create_cluster_wizard.network.neutr_gre_description" - restrictions: - - condition: "'XenServer' in settings:name" - message: "only" - bind: - - "cluster:net_provider": "neutron" - - "cluster:net_segment_type": "gre" - - data: "nova-network" - label: "dialog.create_cluster_wizard.network.nova_network" - description: "dialog.create_cluster_wizard.network.nova_network_description" - bind: - - "cluster:net_provider": "nova_network" - Storage: - ceph: - type: "radio" - values: - - data: "disable" - label: "dialog.create_cluster_wizard.storage.ceph_disable" - bind: - - "settings:storage.volumes_lvm.value": true - - "settings:storage.volumes_ceph.value": false - - "settings:storage.objects_ceph.value": false - - "settings:storage.ephemeral_ceph.value": false - - "settings:storage.images_ceph.value": false - - data: "enable" - label: "dialog.create_cluster_wizard.storage.ceph_enable" - bind: - - "settings:storage.volumes_ceph.value": true - - "settings:storage.objects_ceph.value": true - - "settings:storage.ephemeral_ceph.value": true - - "settings:storage.images_ceph.value": true - - "settings:storage.volumes_lvm.value": false - AdditionalServices: - sahara: - type: "checkbox" - label: "dialog.create_cluster_wizard.additional.install_sahara" - description: "dialog.create_cluster_wizard.additional.install_sahara_description" - bind: "settings:additional_components.sahara.value" - weight: 10 - restrictions: - - condition: "'XenServer' in settings:name" - message: "only" - murano: - type: "checkbox" - label: "dialog.create_cluster_wizard.additional.install_murano" - description: "dialog.create_cluster_wizard.additional.install_murano_description" - bind: "settings:additional_components.murano.value" - weight: 20 - restrictions: - - condition: "'XenServer' in settings:name" - message: "only" - ceilometer: - type: "checkbox" - label: "dialog.create_cluster_wizard.additional.install_ceilometer" - description: "dialog.create_cluster_wizard.additional.install_ceilometer_description" - bind: "settings:additional_components.ceilometer.value" - weight: 30 - restrictions: - - condition: "'XenServer' in settings:name" - message: "only" - Ready: {} \ No newline at end of file diff --git a/cleardb.py b/cleardb.py index 300bc2f..c4fe89d 100755 --- a/cleardb.py +++ b/cleardb.py @@ -4,9 +4,17 @@ import os import yaml settings = yaml.load(open('/etc/nailgun/settings.yaml')) -os.environ["PGPASSWORD"] = settings['DATABASE']['passwd'] -cmd = ('psql -h {host} -p {port} -U {user} -w -d {name} ' - '-c "delete from releases where name like \'%Xen%\';" ' - ).format(**settings['DATABASE']) +db_settings = settings['DATABASE'] +os.environ["PGPASSWORD"] = db_settings['passwd'] + +def execute_sql(sql): + paras = dict(db_settings.items() + {'sql':sql}.items()) + print paras + cmd = ('psql -h {host} -p {port} -U {user} -w -d {name} ' + '-c "{sql}" ' + ).format(**paras) + os.system(cmd) + +if __name__ == '__main__': + execute_sql('delete from releases where name like \'%Xen%\';') -os.system(cmd) \ No newline at end of file diff --git a/deploy.sh b/deploy.sh index abb1aa3..51b2491 100755 --- a/deploy.sh +++ b/deploy.sh @@ -4,12 +4,14 @@ scp cleardb.py root@$FUELMASTER:$PLUGIN_PATH ssh root@$FUELMASTER dockerctl copy cleardb.py nailgun:/tmp/cleardb.py ssh root@$FUELMASTER dockerctl shell nailgun /tmp/cleardb.py +cat base_release.yaml xs_release.yaml > newrelease.yaml scp newrelease.yaml root@$FUELMASTER:$PLUGIN_PATH ssh root@$FUELMASTER dockerctl copy newrelease.yaml nailgun:/tmp/newrelease.yaml ssh root@$FUELMASTER dockerctl shell nailgun manage.py loaddata /tmp/newrelease.yaml +rm newrelease.yaml -fpb --check ./ -fpb --build . +fpb --check xenserver-fuel-plugin +fpb --build xenserver-fuel-plugin scp xenserver-fuel-plugin-$BUILD_VERSION.noarch.rpm root@$FUELMASTER:$PLUGIN_PATH diff --git a/deployment_scripts/deploy.sh b/deployment_scripts/deploy.sh deleted file mode 100755 index 2eb3852..0000000 --- a/deployment_scripts/deploy.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -dockerctl copy newrelease.yaml nailgun:/tmp/newrelease.yaml -dockerctl shell nailgun manage.py loaddata /tmp/newrelease.yaml \ No newline at end of file diff --git a/dump.sh b/dump.sh new file mode 100755 index 0000000..f973aec --- /dev/null +++ b/dump.sh @@ -0,0 +1,16 @@ +source localrc + +ALL_MODELS="action_log capacity_log attributes cluster cluster_changes release " +ALL_MODELS+="node node_roles role node_attributes node_bond_interface node_group " +ALL_MODELS+="network_group networking_config nova_network_config notification task " +ALL_MODELS+="master_node_settings" +MODELS="$@" +MODELS=${MODELS:-$ALL_MODELS} + + +mkdir -p models +for model in $MODELS +do + (set -x ; ssh root@$FUELMASTER dockerctl shell nailgun manage.py dumpdata $model \ + > models/$model.json) +done diff --git a/LICENSE b/xenserver-fuel-plugin/LICENSE similarity index 100% rename from LICENSE rename to xenserver-fuel-plugin/LICENSE diff --git a/xenserver-fuel-plugin/deployment_scripts/deploy.sh b/xenserver-fuel-plugin/deployment_scripts/deploy.sh new file mode 100755 index 0000000..a9bf588 --- /dev/null +++ b/xenserver-fuel-plugin/deployment_scripts/deploy.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/environment_config.yaml b/xenserver-fuel-plugin/environment_config.yaml similarity index 100% rename from environment_config.yaml rename to xenserver-fuel-plugin/environment_config.yaml diff --git a/metadata.yaml b/xenserver-fuel-plugin/metadata.yaml similarity index 100% rename from metadata.yaml rename to xenserver-fuel-plugin/metadata.yaml diff --git a/pre_build_hook b/xenserver-fuel-plugin/pre_build_hook similarity index 100% rename from pre_build_hook rename to xenserver-fuel-plugin/pre_build_hook diff --git a/repositories/centos/.gitkeep b/xenserver-fuel-plugin/repositories/centos/.gitkeep similarity index 100% rename from repositories/centos/.gitkeep rename to xenserver-fuel-plugin/repositories/centos/.gitkeep diff --git a/repositories/ubuntu/.gitkeep b/xenserver-fuel-plugin/repositories/ubuntu/.gitkeep similarity index 100% rename from repositories/ubuntu/.gitkeep rename to xenserver-fuel-plugin/repositories/ubuntu/.gitkeep diff --git a/tasks.yaml b/xenserver-fuel-plugin/tasks.yaml similarity index 100% rename from tasks.yaml rename to xenserver-fuel-plugin/tasks.yaml diff --git a/xs_release.yaml b/xs_release.yaml new file mode 100644 index 0000000..ef89593 --- /dev/null +++ b/xs_release.yaml @@ -0,0 +1,269 @@ +- pk: 10 + extend: *base_release + fields: + name: "Juno+Citrix XenServer on Ubuntu 14.04.1" + version: "2014.2.2-6.1" + can_update_from_versions: [] + operating_system: "Ubuntu" + description: "This option will install the OpenStack Juno packages using Ubuntu as a base operating system. With high availability features built in, you are getting a robust, enterprise-grade OpenStack deployment." + roles: + - controller + - compute + - cinder + roles_metadata: + controller: + name: "Controller" + description: "The Controller initiates orchestration activities and provides an external API. Other components like Glance (image storage), Keystone (identity management), Horizon (OpenStack dashboard) and Nova-Scheduler are installed on the controller as well." + conflicts: + - compute + update_required: + - compute + - cinder + has_primary: true + limits: + min: 1 + overrides: + - condition: "cluster:mode == 'multinode'" + max: 1 + message: "Multi-node environment can not have more than one Controller node." + - condition: "cluster:mode == 'ha_compact'" + recommended: 3 + message: "At least 3 Controller nodes are recommended for HA deployment." + compute: + name: "Compute" + description: "A Compute node creates, manages and terminates virtual machine instances." + limits: + recommended: 1 + fault_tolerance: "2%" + cinder: + # NOTE: naming, see https://bugs.launchpad.net/fuel/+bug/1383224 + name: "Storage - Cinder" + description: "Cinder provides scheduling of block storage resources, typically delivered over iSCSI and other compatible backend storage systems. Block storage can be used for database storage, expandable file systems, or providing a server with access to raw block level devices." + limits: + recommended: 1 + restrictions: + - condition: "settings:storage.volumes_lvm.value == false" + message: "Cinder LVM should be enabled in settings" + # NOTE: https://bugs.launchpad.net/fuel/+bug/1372914 - Prohibit possibility of adding cinder nodes to an environment with Ceph RBD + - condition: "settings:storage.volumes_ceph.value == true" + message: "Ceph RBD cannot be used with Cinder" + networks_metadata: + nova_network: + networks: + - name: "public" + cidr: "10.219.237.0/24" + gateway: "10.219.237.1" + ip_range: ["10.219.237.10", "10.219.237.100"] + vlan_start: null + use_gateway: true + notation: "ip_ranges" + render_type: null + render_addr_mask: "public" + map_priority: 1 + configurable: true + vips: ["haproxy", "vrouter"] + - name: "management" + cidr: "192.168.0.0/24" + vlan_start: 24 + use_gateway: false + notation: "cidr" + render_type: "cidr" + render_addr_mask: "internal" + map_priority: 2 + configurable: true + vips: ["haproxy", "vrouter"] + - name: "storage" + cidr: "192.168.1.0/24" + vlan_start: 20 + use_gateway: false + notation: "cidr" + render_type: "cidr" + render_addr_mask: "storage" + map_priority: 2 + configurable: true + - name: "fixed" + vlan_start: null + use_gateway: false + notation: null + render_type: null + render_addr_mask: null + map_priority: 2 + ext_net_data: ["fixed_networks_vlan_start", "fixed_networks_amount"] + configurable: false + config: + net_manager: "FlatDHCPManager" + fixed_networks_cidr: "10.0.0.0/16" + fixed_networks_vlan_start: 23 + fixed_network_size: 256 + fixed_networks_amount: 1 + floating_ranges: [["10.219.237.150", "10.219.237.200"]] + attributes_metadata: + editable: + kernel_params: + kernel: + value: "console=ttyS0,9600 console=tty0 net.ifnames=0 biosdevname=0 rootdelay=90 nomodeset" + repo_setup: + metadata: + label: "Repositories" + weight: 50 + always_editable: true + repos: + type: "custom_repo_configuration" + extra_priority: null + description: | + Please note: the first repository will be considered the operating system mirror that will be used during node provisioning. + To create a local repository mirror on the Fuel master node, please follow the instructions provided by running "fuel-createmirror --help" on the Fuel master node. + Please make sure your Fuel master node has Internet access to the repository before attempting to create a mirror. + For more details, please refer to the documentation (https://docs.mirantis.com/openstack/fuel/fuel-6.1/operations.html#external-ubuntu-ops). + value: + - type: "deb" + name: "ubuntu" + uri: "http://archive.ubuntu.com/ubuntu/" + suite: "trusty" + section: "main universe multiverse" + priority: null + - type: "deb" + name: "ubuntu-updates" + uri: "http://archive.ubuntu.com/ubuntu/" + suite: "trusty-updates" + section: "main universe multiverse" + priority: null + - type: "deb" + name: "ubuntu-security" + uri: "http://archive.ubuntu.com/ubuntu/" + suite: "trusty-security" + section: "main universe multiverse" + priority: null + - type: "deb" + name: "mos" + uri: "http://{settings.MASTER_IP}:8080/{cluster.release.version}/ubuntu/x86_64" + suite: "mos6.1" + section: "main restricted" + priority: 1050 + - type: "deb" + name: "mos-updates" + uri: "http://mirror.fuel-infra.org/mos/ubuntu/" + suite: "mos6.1-updates" + section: "main restricted" + priority: 1050 + - type: "deb" + name: "mos-security" + uri: "http://mirror.fuel-infra.org/mos/ubuntu/" + suite: "mos6.1-security" + section: "main restricted" + priority: 1050 + - type: "deb" + name: "mos-holdback" + uri: "http://mirror.fuel-infra.org/mos/ubuntu/" + suite: "mos6.1-holdback" + section: "main restricted" + priority: 1100 + - type: "deb" + name: "Auxiliary" + uri: "http://{settings.MASTER_IP}:8080/{cluster.release.version}/ubuntu/auxiliary" + suite: "auxiliary" + section: "main restricted" + priority: 1150 + generated: + repo_setup: + installer_kernel: + remote_relative: "dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux" + local: "/var/www/nailgun/ubuntu/x86_64/images/linux" + installer_initrd: + remote_relative: "dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz" + local: "/var/www/nailgun/ubuntu/x86_64/images/initrd.gz" + cobbler: + profile: + generator_arg: "ubuntu_1404_x86_64" + provision: + codename: "trusty" + image_data: + /: + uri: "http://{settings.MASTER_IP}:8080/targetimages/env_{cluster.id}_ubuntu_1404_amd64.img.gz" + format: "ext4" + container: "gzip" + /boot: + uri: "http://{settings.MASTER_IP}:8080/targetimages/env_{cluster.id}_ubuntu_1404_amd64-boot.img.gz" + format: "ext2" + container: "gzip" + wizard_metadata: + Mode: + metadata: + restrictions: + - condition: "true" + action: "hide" + mode: + type: "radio" + bind: "cluster:mode" + values: + - data: "ha_compact" + label: "cluster.mode.ha_compact" + Compute: + hypervisor: + type: "radio" + value: "xen" + weight: 5 + bind: "settings:common.libvirt_type.value" + values: + - data: "xen" + label: "XenServer" + description: "dialog.create_cluster_wizard.compute.kvm_description" + bind: + - "wizard:Network.manager": "nova-network" + - "wizard:Storage.ceph": "disable" + Network: + manager: + type: "radio" + value: "nova-network" + values: + - data: "nova-network" + label: "dialog.create_cluster_wizard.network.nova_network" + description: "dialog.create_cluster_wizard.network.nova_network_description" + bind: + - "cluster:net_provider": "nova_network" + Storage: + ceph: + type: "radio" + values: + - data: "disable" + label: "dialog.create_cluster_wizard.storage.ceph_disable" + bind: + - "settings:storage.volumes_lvm.value": true + - "settings:storage.volumes_ceph.value": false + - "settings:storage.objects_ceph.value": false + - "settings:storage.ephemeral_ceph.value": false + - "settings:storage.images_ceph.value": false + - data: "enable" + label: "dialog.create_cluster_wizard.storage.ceph_enable" + bind: + - "settings:storage.volumes_ceph.value": true + - "settings:storage.objects_ceph.value": true + - "settings:storage.ephemeral_ceph.value": true + - "settings:storage.images_ceph.value": true + - "settings:storage.volumes_lvm.value": false + restrictions: + - condition: "settings:common.libvirt_type.value == 'xen'" + action: disable + AdditionalServices: + sahara: + type: "checkbox" + label: "dialog.create_cluster_wizard.additional.install_sahara" + description: "dialog.create_cluster_wizard.additional.install_sahara_description" + bind: "settings:additional_components.sahara.value" + weight: 10 + murano: + type: "checkbox" + label: "dialog.create_cluster_wizard.additional.install_murano" + description: "dialog.create_cluster_wizard.additional.install_murano_description" + bind: "settings:additional_components.murano.value" + weight: 20 + ceilometer: + type: "checkbox" + label: "dialog.create_cluster_wizard.additional.install_ceilometer" + description: "dialog.create_cluster_wizard.additional.install_ceilometer_description" + bind: "settings:additional_components.ceilometer.value" + weight: 30 + restrictions: + - condition: "settings:common.libvirt_type.value == 'xen'" + action: disable + Ready: {} \ No newline at end of file