Bài 10:Cấu hình Cloud Compute trong CentOS 6(phần 2-OpenStack Havana)

9. Thiết lập Floating IP.

[1] Change Nova’s setting first to assign Floating IP address automatically.

[root@dlp ~(keystone)]#vi /etc/nova/nova.conf

# line 999 : uncomment and change

auto_assign_floating_ip=True

[root@dlp ~(keystone)]#/etc/rc.d/init.d/openstack-nova-network restart

Stopping openstack-nova-network: [ OK ]
Starting openstack-nova-network: [ OK ]

[2] Set Floating IP address. For exmaple, assign 10.0.0.248/29 for Floating IP addresses in internal network 10.0.0.0/24.
[root@dlp ~(keystone)]#nova-manage floating create –ip_range=10.0.0.248/29

[root@dlp ~(keystone)]#nova-manage floating list

None    10.0.0.249      None    nova    eth0
None    10.0.0.250      None    nova    eth0
None    10.0.0.251      None    nova    eth0
None    10.0.0.252      None    nova    eth0
None    10.0.0.253      None    nova    eth0
None    10.0.0.254      None    nova    eth0
[3] Create a new instance and boot it, then Floating IP is assgined automatically like follows. In the example below, The “10.0.0.249” is just the Floating IP.
# create and boot Instance

[root@dlp ~(keystone)]#nova boot –flavor 2 –image CentOS6 –security_group default CentOS_64_Pub

[root@dlp ~(keystone)]#nova list

+------------+---------------+---------+------------+-------------+--------------------------------+
| ID         | Name          | Status  | Task State | Power State | Networks                       |
+------------+---------------+---------+------------+-------------+--------------------------------+
| 081bba5e-0 | CentOS_64     | SHUTOFF | None       | Shutdown    | network01=10.1.0.2             |
| 4cf02c97-b | CentOS_64_Pub | ACTIVE  | None       | Running     | network01=10.1.0.3, 10.0.0.249 |
+------------+---------------+---------+------------+-------------+--------------------------------+
[4] The Instances created before setting Floating IP, Floating IP does not assigned automatically, so it necessarry to set it manually like follows.
[root@dlp ~(keystone)]#nova list

+------------+---------------+---------+------------+-------------+--------------------------------+
| ID         | Name          | Status  | Task State | Power State | Networks                       |
+------------+---------------+---------+------------+-------------+--------------------------------+
| 081bba5e-0 | CentOS_64     | SHUTOFF | None       | Shutdown    | network01=10.1.0.2             |
| 4cf02c97-b | CentOS_64_Pub | SHUTOFF | None       | Shutdown    | network01=10.1.0.3, 10.0.0.249 |
+------------+---------------+---------+------------+-------------+--------------------------------+

# assign “10.0.0.250” to “CentOS_64”

[root@dlp ~(keystone)]#nova add-floating-ip CentOS_64 10.0.0.250

[root@dlp ~(keystone)]#nova list

+------------+---------------+---------+------------+-------------+--------------------------------+
| ID         | Name          | Status  | Task State | Power State | Networks                       |
+------------+---------------+---------+------------+-------------+--------------------------------+
| 081bba5e-0 | CentOS_64     | SHUTOFF | None       | Shutdown    | network01=10.1.0.2, 10.0.0.250 |
| 4cf02c97-b | CentOS_64_Pub | SHUTOFF | None       | Shutdown    | network01=10.1.0.3, 10.0.0.249 |
+------------+---------------+---------+------------+-------------+--------------------------------+

10.Add Compute Nodes

Ví dụ hướng dẫn cấu hình một Compute Node trên một Computer khác trong từ Control Node

Install KVM Hypervisor first which needs on Compute Node. It’s unnecessarry to set Bridge networking on the section [2] of the link.
[2] Install Nova-Compute and Nova-Network.
# install from EPEL OpenStackEPEL

[root@node01 ~]#

yum –enablerepo=openstack-havana,epel -y install openstack-nova-compute openstack-nova-network
[3] Configure Nova
[root@node01 ~]#

vi /etc/nova/nova.conf
# line 65: uncomment and specify hostname

host=

node01.server.world
# line 68: uncomment (if not need)

use_ipv6=false

# line 100: uncomment

state_path=/var/lib/nova

# line 191: uncomment

enabled_apis=ec2,osapi_compute,metadata

# line 197: uncomment

ec2_listen=0.0.0.0

# line 200: uncomment

ec2_listen_port=8773

# line 206: uncomment

osapi_compute_listen=0.0.0.0

# line 209: uncomment

osapi_compute_listen_port=8774

# line 237: uncomment

network_manager=nova.network.manager.FlatDHCPManager

# line 274: uncomment

rootwrap_config=/etc/nova/rootwrap.conf

# line 287: uncomment

api_paste_config=api-paste.ini

# line 320: uncomment and change

auth_strategy=

keystone
# line 909: uncomment and specify Glance server

glance_host=

10.0.0.30
# line 912: uncomment

glance_port=9292

# line 916: uncomment

glance_protocol=http

# line 921: uncomment

glance_api_servers=$glance_host:$glance_port

# line 980: uncomment

network_api_class=nova.network.api.API

# line 988: uncomment

network_driver=nova.network.linux_net

# line 1060: uncomment

dhcpbridge_flagfile=/etc/nova/nova.conf

# line 1066: uncomment and specify nic for public

public_interface=

eth0
# line 1072: uncomment

dhcpbridge=/usr/bin/nova-dhcpbridge

# line 1101: uncomment

linuxnet_interface_driver=nova.network.linux_net.LinuxBridgeInterfaceDriver

# line 1146: uncomment and specify any name for bridge

flat_network_bridge=

br100
# line 1157: uncomment and specify nic for flat DHCP bridge

flat_interface=

lo
# line 1308: uncomment

security_group_api=nova

# line 1434: uncomment

log_dir=/var/log/nova

# line 1448: uncomment and specify Memcached server

memcached_servers=

10.0.0.30:11211
# line 1457: uncomment and add

notification_driver=

nova.openstack.common.notifier.rpc_notifier
# line 1491: uncomment

rpc_backend=nova.openstack.common.rpc.impl_qpid

# line 1596: uncomment and specify Qpid server

qpid_hostname=

10.0.0.30
# line 1599: uncomment

qpid_port=5672

# line 1801: uncomment

scheduler_default_filters=RetryFilter,AvailabilityZoneFilter,RamFilter,
ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter

# line 1919: uncomment

compute_driver=libvirt.LibvirtDriver

# line 1940: uncomment

firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver

# line 1970: uncomment

libvirt_type=kvm

# line 2011: uncomment

libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtGenericVIFDriver

# line 2147: uncomment

libvirt_use_virtio_for_bridges=true

# line 2855: uncomment and specify values for Nova DB

connection=mysql://

nova:password@10.0.0.30/nova
# line 3377: uncomment and specify tenant name

admin_tenant_name=

service
# line 3380: uncomment and specify admin user

admin_user=

nova
# line 3383: uncomment and specify admin password

admin_password=

servicepassword
# line 3386: uncomment and specify Keystone server

auth_host=

10.0.0.30
# line 3389: uncomment

auth_port=35357

# line 3392: uncomment

auth_protocol=http

# line 3395: uncomment

auth_version=v2.0

# line 3400: uncomment

signing_dir=/var/lib/nova/keystone-signing

[root@node01 ~]#

for service in compute network; do
/etc/rc.d/init.d/openstack-nova-$service start
chkconfig openstack-nova-$service on
done
Starting openstack-nova-compute:                           [  OK  ]
Starting openstack-nova-network:                           [  OK  ]
[4] Make sure services are working normally. It’s OK if the status of services are like follows.
[root@node01 ~]#

nova-manage service list
Binary           Host                       Zone             Status     State Updated_At
nova-scheduler   dlp.server.world           internal         enabled    :-)   2013-10-23 13:08:17
nova-network     dlp.server.world           internal         enabled    :-)   2013-10-23 13:08:22
nova-cert        dlp.server.world           internal         enabled    :-)   2013-10-23 13:08:17
nova-consoleauth dlp.server.world           internal         enabled    :-)   2013-10-23 13:08:17
nova-conductor   dlp.server.world           internal         enabled    :-)   2013-10-23 13:08:17
nova-compute     dlp.server.world           nova             enabled    :-)   2013-10-23 13:08:19
nova-compute     node01.server.world        nova             enabled    :-)   2013-10-23 13:08:13
nova-network     node01.server.world        internal         enabled    :-)   2013-10-23 13:08:03