[OpenStack] OpenStack Essex - Nova 安装部署与命令行详解
Install nova using the following commands:
sudo apt-get install nova-api nova-cert nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-volume rabbitmq-server novnc nova-consoleauth
Edit the /etc/nova/nova.conf file to look like this.
--dhcpbridge_flagfile=/etc/nova/nova.conf --dhcpbridge=/usr/bin/nova-dhcpbridge --logdir=/var/log/nova --state_path=/var/lib/nova --lock_path=/run/lock/nova --allow_admin_api=true --use_deprecated_auth=false --auth_strategy=keystone --scheduler_driver=nova.scheduler.simple.SimpleScheduler --s3_host=10.10.10.2 --ec2_host=10.10.10.2 --rabbit_host=10.10.10.2 --cc_host=10.10.10.2 --nova_url=http://10.10.10.2:8774/v1.1/ --routing_source_ip=10.10.10.2 --glance_api_servers=10.10.10.2:9292 --image_service=nova.image.glance.GlanceImageService --iscsi_ip_prefix=192.168.4 --sql_connection=mysql://novadbadmin:novasecret@10.10.10.2/nova --ec2_url=http://10.10.10.2:8773/services/Cloud --keystone_ec2_url=http://10.10.10.2:5000/v2.0/ec2tokens --api_paste_config=/etc/nova/api-paste.ini --libvirt_type=kvm --libvirt_use_virtio_for_bridges=true --start_guests_on_host_boot=true --resume_guests_state_on_host_boot=true # vnc specific configuration --novnc_enabled=true --novncproxy_base_url=http://10.10.10.2:6080/vnc_auto.html --vncserver_proxyclient_address=10.10.10.2 --vncserver_listen=10.10.10.2 # network specific settings --network_manager=nova.network.manager.FlatDHCPManager --public_interface=eth0 --flat_interface=eth1 --flat_network_bridge=br100 --fixed_range=192.168.4.1/27 --floating_range=10.10.10.2/27 --network_size=32 --flat_network_dhcp_start=192.168.4.33 --flat_injected=False --force_dhcp_release --iscsi_helper=tgtadm --connection_type=libvirt --root_helper=sudo nova-rootwrap --verbose
Create a Physical Volume.
sudo pvcreate /dev/sda6
Create a Volume Group named nova-volumes.
sudo vgcreate nova-volumes /dev/sda6
Change the ownership of the /etc/nova folder and permissions for /etc/nova/nova.conf:
sudo chown -R nova:nova /etc/nova sudo chmod 644 /etc/nova/nova.conf
Open /etc/nova/api-paste.ini and at the end of the file, edit the following lines:
admin_tenant_name = %SERVICE_TENANT_NAME% admin_user = %SERVICE_USER% admin_password = %SERVICE_PASSWORD%
These values have to be modified conforming to configurations made earlier. The admin_tenant_name will be 'service', admin_user will be 'nova' and admin_password is 'nova'.
After editing, the lines should be as follows:
admin_tenant_name = service admin_user = nova admin_password = nova
Create nova schema in the MySQL database.
sudo nova-manage db sync
Provide a range of IPs to be associated to the instances.
sudo nova-manage network create private --fixed_range_v4=192.168.4.32/27 --num_networks=1 --bridge=br100 --bridge_interface=eth1 --network_size=32
Export the following environment variables.
export OS_TENANT_NAME=admin export OS_USERNAME=admin export OS_PASSWORD=admin export OS_AUTH_URL="http://localhost:5000/v2.0/"
Restart nova services.
sudo restart libvirt-bin; sudo restart nova-network; sudo restart nova-compute; sudo restart nova-api; sudo restart nova-objectstore; sudo restart nova-scheduler; sudo restart nova-volume; sudo restart nova-consoleauth;
To test if nova is setup correctly run the following command.
sudo nova-manage service list Binary Host Zone Status State Updated_At nova-network server1 nova enabled :-) 2012-04-20 08:58:43 nova-scheduler server1 nova enabled :-) 2012-04-20 08:58:44 nova-volume server1 nova enabled :-) 2012-04-20 08:58:44 nova-compute server1 nova enabled :-) 2012-04-20 08:58:45 nova-cert server1 nova enabled :-) 2012-04-20 08:58:43
If the output is similar to the above with all components happy, your setup is ready to be used.