Install OpenStack on 4 MAAS Nodes (by quqi99)

*作者:张华 发表于:2016-11-09
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明
( http://blog.csdn.net/quqi99 )*

1, Prepare 4 MAAS Nodes

sudo apt-get install -y maas-cli
echo '' > ~/maas-apikey
maas login myprofile http:///MAAS/api/1.0/ `cat ~/maas-apikey`
maas myprofile tags list
cat /tmp/mymaas.yaml
clouds:
   mymaas:
      type: maas
      auth-types: [oauth1]
      endpoint: http:///MAAS

juju add-cloud mymaas /tmp/maas.yaml
juju list-clouds
#Enter maas credentials here, then write ~/.local/share/juju/credentials.yaml
juju add-credential mymaas
#juju destroy-controller mymaas-controller --destroy-all-models
juju destroy-model default
juju add-model default
juju switch default
juju bootstrap --constraints="tags=virtual" --config default-series=trusty mymaas-controller mymaas
juju list-controllers
juju list-models
juju switch controller #Juju2.0 creates two models "controller" and "default", switch to controller model
juju ssh 0             #ssh into the controller, or 'juju ssh -m controller 0'

#bzr branch lp:openstack-charm-testing
juju deploy ./test.yaml
#juju config neutron-gateway data-port='br-ex:eth6'
#juju remove-machine 1
#juju destroy-controller mymaas-controller

cat ./test.yaml
machines:
  '1':
    constraints: tags=node2
    series: trusty
  '2':
    constraints: tags=node3
    series: trusty
  '3':
    constraints: tags=virtual
    series: trusty
relations:
- - nova-compute:amqp
  - rabbitmq-server:amqp
- - neutron-gateway:amqp
  - rabbitmq-server:amqp
- - keystone:shared-db
  - mysql:shared-db
- - nova-cloud-controller:identity-service
  - keystone:identity-service
- - glance:identity-service
  - keystone:identity-service
- - neutron-api:identity-service
  - keystone:identity-service
- - neutron-openvswitch:neutron-plugin-api
  - neutron-api:neutron-plugin-api
- - neutron-api:shared-db
  - mysql:shared-db
- - neutron-api:amqp
  - rabbitmq-server:amqp
- - neutron-gateway:neutron-plugin-api
  - neutron-api:neutron-plugin-api
- - glance:shared-db
  - mysql:shared-db
- - glance:amqp
  - rabbitmq-server:amqp
- - nova-cloud-controller:image-service
  - glance:image-service
- - nova-compute:image-service
  - glance:image-service
- - nova-cloud-controller:cloud-compute
  - nova-compute:cloud-compute
- - nova-cloud-controller:amqp
  - rabbitmq-server:amqp
- - nova-cloud-controller:quantum-network-service
  - neutron-gateway:quantum-network-service
- - nova-compute:neutron-plugin
  - neutron-openvswitch:neutron-plugin
- - neutron-openvswitch:amqp
  - rabbitmq-server:amqp
- - nova-cloud-controller:shared-db
  - mysql:shared-db
- - nova-cloud-controller:neutron-api
  - neutron-api:neutron-api
series: trusty
services:
  glance:
    charm: cs:trusty/glance-253
    annotations:
      gui-x: '250'
      gui-y: '0'
    options:
      openstack-origin: cloud:trusty-kilo
    num_units: 1
    to:
    - lxc:1
  keystone:
    charm: cs:trusty/keystone-258
    annotations:
      gui-x: '500'
      gui-y: '0'
    num_units: 1
    options:
      openstack-origin: cloud:trusty-kilo
      admin-password: openstack
    to:
    - lxc:1
  mysql:
    charm: cs:trusty/percona-cluster-246
    annotations:
      gui-x: '0'
      gui-y: '250'
    num_units: 1
    options:
      max-connections: 20000
    to:
    - lxc:1
  neutron-api:
    charm: cs:trusty/neutron-api-246
    annotations:
      gui-x: '500'
      gui-y: '500'
    num_units: 1
    options:
      openstack-origin: cloud:trusty-kilo
      flat-network-providers: physnet1
      neutron-security-groups: true
    to:
    - lxc:1
  neutron-gateway:
    charm: cs:trusty/neutron-gateway-232
    annotations:
      gui-x: '0'
      gui-y: '0'
    num_units: 1
    options:
      openstack-origin: cloud:trusty-kilo
      bridge-mappings: physnet1:br-ex
      data-port: br-ex:eth1
    to:
    - '3'
  neutron-openvswitch:
    charm: cs:trusty/neutron-openvswitch-238
    annotations:
      gui-x: '250'
      gui-y: '500'
    num_units: 0
  nova-cloud-controller:
    charm: cs:trusty/nova-cloud-controller-292
    annotations:
      gui-x: '0'
      gui-y: '500'
    num_units: 1
    options:
      openstack-origin: cloud:trusty-kilo
      network-manager: Neutron
    to:
    - lxc:1
  nova-compute:
    charm: cs:trusty/nova-compute-259
    annotations:
      gui-x: '250'
      gui-y: '250'
    num_units: 2
    options:
      openstack-origin: cloud:trusty-kilo
      enable-live-migration: true
      enable-resize: true
      migration-auth-type: ssh
    to:
    - '1'
    - '2'
  rabbitmq-server:
    charm: cs:trusty/rabbitmq-server-54
    annotations:
      gui-x: '500'
      gui-y: '250'
    num_units: 1
    to:
    - lxc:2

2, Upload the image

wget https://api.jujucharms.com/charmstore/v5/openstack-base/archive
source novarc
wget http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1511.qcow2
glance image-create --name centos --disk-format qcow2 --container-format bare --file ./CentOS-7-x86_64-GenericCloud-1511.qcow2 --progress

3, Create the network

neutron net-create private --provider:network_type gre --provider:segmentation_id 1012
neutron subnet-create --allocation-pool start=192.168.21.22,end=192.168.21.122 --gateway 192.168.21.1 private 192.168.21.0/24 --enable_dhcp=True --name private_subnet

neutron net-create ext_net -- --router:external=True --provider:network_type flat --provider:physical_network physnet1
neutron subnet-create --allocation-pool start=10.230.56.100,end=10.230.56.104 --gateway 10.230.56.1 ext_net 10.230.56.100/21 --enable_dhcp=False --name ext_net_subnet

neutron router-create provider-router
EXT_NET_ID=$(neutron net-list |grep ' ext_net ' |awk '{print $2}')
ROUTER_ID=$(neutron router-list |grep ' provider-router ' |awk '{print $2}')
SUBNET_ID=$(neutron subnet-list |grep '192.168.21.0/24' |awk '{print $2}')
neutron router-interface-add $ROUTER_ID $SUBNET_ID
neutron router-gateway-set $ROUTER_ID $EXT_NET_ID
#neutron router-gateway-clear provider-router
#neutron router-interface-delete provider-router private_subnet
#nova floating-ip-delete 10.230.56.101
#neutron subnet-delete ext_net_subnet
#neutron subnet-delete private_subnet
#neutron net-delete ext_net
#neutron net-delete private
#neutron router-delete provider-router

4, Boot the VM

neutron security-group-rule-create --protocol icmp --direction ingress default
neutron security-group-rule-create --protocol tcp --port-range-min 22 --port-range-max 22 --direction ingress default
nova keypair-add --pub-key ~/.ssh/id_rsa.pub mykey
nova service-list
nova hypervisor-list
nova boot --poll --key-name mykey --image centos --flavor 2 --nic net-id=$(neutron net-list |grep 'private' |awk '{print $2}') --availability-zone nova:node2 i2
nova floating-ip-create
nova floating-ip-associate i2 10.230.56.104
ssh -i mykey centos@10.230.56.104 -v #dd if=/dev/urandom of=/var/tmp/live_mig_test bs=4M count=1000  #~/.local/share/juju/ssh/juju_id_rsa
nova live-migration --block-migrate i2 voltorb
#sudo virsh --connect qemu+ssh://node2/system list
#LIBVIRT_DEBUG=1 virsh migrate --verbose --live --copy-storage-all instance-0000000d qemu+ssh://voltorb/system 2>&1 > debug.log

你可能感兴趣的:(OpenStack,Non-Networking)