按照www.hastexo.com安装openstack的文档安装
OpenStack Compute, codenamed Nova, is by far the most important and the most substantial openstack component. Whatever you do when it comes to managing VMs will be done by Nova in the background. The good news is: Nova is basically controlled by one configuration file, /etc/nova/nova.conf. Get started by installing all nova-related components:apt-get install nova-api nova-cert nova-common nova-compute nova-compute-kvm nova-doc nova-network nova-objectstore nova-scheduler nova-volume nova-consoleauth novnc python-nova python-novaclientThen, open /etc/nova/nova.conf and replace everything in there with these lines:--dhcpbridge_flagfile=/etc/nova/nova.conf
--dhcpbridge=/usr/bin/nova-dhcpbridge
--logdir=/var/log/nova
--state_path=/var/lib/nova
--lock_path=/var/lock/nova
--allow_admin_api=true
--use_deprecated_auth=false
--auth_strategy=keystone
--scheduler_driver=nova.scheduler.simple.SimpleScheduler
--s3_host=10.42.0.6
--ec2_host=10.42.0.6
--rabbit_host=10.42.0.6
--cc_host=10.42.0.6
--nova_url=http://10.42.0.6:8774/v1.1/
--routing_source_ip=10.42.0.6
--glance_api_servers=10.42.0.6:9292
--image_service=nova.image.glance.GlanceImageService
--iscsi_ip_prefix=192.168.22
--sql_connection=mysql://novadbadmin:[email protected]/nova
--ec2_url=http://10.42.0.6:8773/services/Cloud
--keystone_ec2_url=http://10.42.0.6: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_enabled=true
--vncproxy_url=http://10.42.0.6:6080
--vnc_console_proxy_url=http://10.42.0.6:6080
# network specific settings
--network_manager=nova.network.manager.FlatDHCPManager
--public_interface=eth0
--flat_interface=eth1
--flat_network_bridge=br100
--fixed_range=192.168.22.32/27
--floating_range=10.42.0.32/27 
--network_size=32
--flat_network_dhcp_start=192.168.22.33
--flat_injected=False
--force_dhcp_release
--iscsi_helper=tgtadm
--connection_type=libvirt
--root_helper=sudo nova-rootwrap
--verbose
--libvirt_use_virtio_for_bridges
--ec2_private_dns_show
--novnc_enabled=true
--novncproxy_base_url=http://10.42.0.6:6080/vnc_auto.html
--vncserver_proxyclient_address=10.42.0.6
--vncserver_listen=10.42.0.6As you can see, many of the entries in this file are self-explanatory; the trickiest bit to get done right is the network configuration part, which you can see at the end of the file. We're using Nova's FlatDHCP network mode; 192.168.22.32/27 is the fixed range from which our future VMs will get their IP adresses, starting with 192.168.22.33. Our flat interface is eth1 (nova-network will bridge this into a bridge named br100), our public interface is eth0. An additional floating range is defined at 10.42.0.32/27 (for those VMs that we want to have a 'public IP'). Attention: Every occurance of 10.42.0.6 in this file refers to the IP of the machine I used for writing this guide. You need to replace it with the actual machine IP of the box you are running  this on. For example, if your machine has the local IP address 192.168.0.1, then use this IP instead of 10.42.0.6.After saving nova.conf, open /etc/nova/api-paste.ini in an editor and scroll down to the end of the file. Adapt it according to the changes you conducted in Glance's paste-files in step 3. Use service as tenant name and nova as username.Then, restart all nova services to make the configuration file changes take effect:for a in libvirt-bin nova-network nova-compute nova-cert nova-api nova-objectstore nova-scheduler nova-volume novnc nova-consoleauth; do service "$a" stop; donefor a in libvirt-bin nova-network nova-compute nova-cert nova-api nova-objectstore nova-scheduler nova-volume novnc nova-consoleauth; do service "$a" start; doneThe next step will create all databases Nova needs in MySQL. While we are at it, we can also create the network we want to use for our VMs in the Nova databases. Do this:nova-manage db syncnova-manage network create private --fixed_range_v4=192.168.22.32/27 --num_networks=1 --bridge=br100 --bridge_interface=eth1 --network_size=32 Also, make sure that all files in /etc/nova belong to the nova user and the nova group:chown -R nova:nova /etc/novaThen, restart all nova-related services again:for a in libvirt-bin nova-network nova-compute nova-cert nova-api nova-objectstore nova-scheduler nova-volume novnc nova-consoleauth; do service "$a" stop; donefor a in libvirt-bin nova-network nova-compute nova-cert nova-api nova-objectstore nova-scheduler nova-volume novnc nova-consoleauth; do service "$a" start; doneYou should now see all these nova-* processes when doing ps auxw. And you should be able to use the numerous nova commands. For example,nova listshould give you a list of all currently running VMs (none, the list should be empty). And nova image-listshould show a list of the image you uploaded to Glance in the step before. If that's the case, Nova is working as expected and you can carry on with starting your first VM.
Once Nova works as desired, starting your first own cloud VM is easy. As we're using a Ubuntu image for this example which allows for SSH-key based login only, we first need to store a public SSH key for our admin user in the OpenStack database. Upload the file containing your SSH public key onto the server (i'll assume the file is called id_dsa.pub) and do this:nova keypair-add --pub_key id_rsa.pub key1This will add the key to OpenStack Nova and store it with the name "key1". The only thing left to do after this is firing up your VM. Find out what ID your Ubuntu image has, you can do this with:nova image-listWhen starting a VM, you also need to define the flavor it is supposed to use. Flavors are pre-defined hardware schemes in OpenStack with which you can define what resources your newly created VM has. OpenStack comes with five pre-defined flavors; you can get an overview over the existing flavors withnova flavor-listFlavors are referenced by their ID, not by  their name. That's important for the actual command to execute to start your VM. That command's syntax basically is this:nova boot --flavor ID --image Image-UUID --key_name key-name vm_nameSo let's assume you want to start a VM with the m1.tiny flavor, which has the ID 1. Let's further assume that your image's UUID in Glance is 9bab7ce7-7523-4d37-831f-c18fbc5cb543 and that you want to use the SSH key key1. Last but nut least, you want your new VM to have the name superfrobnicator. Here's the command you would need to start that particular VM:nova boot --flavor 1 --image 9bab7ce7-7523-4d37-831f-c18fbc5cb543 --key_name key1 superfrobnicatorAfter hitting the Enter key, Nova will show you a summary with all important details concerning the new VM. After some seconds, issue the commandnova show superfrobnicator
+--------------------------------------+---------+--------+-----------------------+
|                  ID                  |   Name  | Status |        Networks       |
+--------------------------------------+---------+--------+-----------------------+
| b3b4a95f-efd2-4ab3-a4df-90ebe0389e57 | cirros2 | ERROR  | private=192.168.22.35 |
| c921ec7b-b721-4703-8d35-e3406fa615a4 | cirros  | ERROR  | private=192.168.22.34 |
+--------------------------------------+---------+--------+-----------------------+
状态一直是error,求帮助啊。

解决方案 »

  1.   

    用nova show <vm_name> 查看虚拟机在哪一步出错,然后再看对应日志。根据你的配置,日志文件在/var/log/nova目录下
      

  2.   

    nova-compute.log
    2012-11-13 08:57:49 ERROR nova.rpc.common [req-9985695c-3dca-4616-8191-06b7a1592274 None None] Timed out waiting for RPC response: timed out
    2012-11-13 08:57:49 TRACE nova.rpc.common Traceback (most recent call last):
    2012-11-13 08:57:49 TRACE nova.rpc.common   File "/usr/lib/python2.7/dist-packages/nova/rpc/impl_kombu.py", line 490, in ensure
    2012-11-13 08:57:49 TRACE nova.rpc.common     return method(*args, **kwargs)
    2012-11-13 08:57:49 TRACE nova.rpc.common   File "/usr/lib/python2.7/dist-packages/nova/rpc/impl_kombu.py", line 567, in _consume
    2012-11-13 08:57:49 TRACE nova.rpc.common     return self.connection.drain_events(timeout=timeout)
    2012-11-13 08:57:49 TRACE nova.rpc.common   File "/usr/lib/python2.7/dist-packages/kombu/connection.py", line 175, in drain_events
    2012-11-13 08:57:49 TRACE nova.rpc.common     return self.transport.drain_events(self.connection, **kwargs)
    2012-11-13 08:57:49 TRACE nova.rpc.common   File "/usr/lib/python2.7/dist-packages/kombu/transport/pyamqplib.py", line 238, in drain_events
    2012-11-13 08:57:49 TRACE nova.rpc.common     return connection.drain_events(**kwargs)
    2012-11-13 08:57:49 TRACE nova.rpc.common   File "/usr/lib/python2.7/dist-packages/kombu/transport/pyamqplib.py", line 57, in drain_events
    2012-11-13 08:57:49 TRACE nova.rpc.common     return self.wait_multi(self.channels.values(), timeout=timeout)
    2012-11-13 08:57:49 TRACE nova.rpc.common   File "/usr/lib/python2.7/dist-packages/kombu/transport/pyamqplib.py", line 63, in wait_multi
    2012-11-13 08:57:49 TRACE nova.rpc.common     chanmap.keys(), allowed_methods, timeout=timeout)
    2012-11-13 08:57:49 TRACE nova.rpc.common   File "/usr/lib/python2.7/dist-packages/kombu/transport/pyamqplib.py", line 120, in _wait_multiple
    2012-11-13 08:57:49 TRACE nova.rpc.common     channel, method_sig, args, content = read_timeout(timeout)
    2012-11-13 08:57:49 TRACE nova.rpc.common   File "/usr/lib/python2.7/dist-packages/kombu/transport/pyamqplib.py", line 94, in read_timeout
    2012-11-13 08:57:49 TRACE nova.rpc.common     return self.method_reader.read_method()
    2012-11-13 08:57:49 TRACE nova.rpc.common   File "/usr/lib/python2.7/dist-packages/amqplib/client_0_8/method_framing.py", line 221, in read_method
    2012-11-13 08:57:49 TRACE nova.rpc.common     raise m
    2012-11-13 08:57:49 TRACE nova.rpc.common timeout: timed out
    2012-11-13 08:57:49 TRACE nova.rpc.common 
    nova-network.log
    2012-11-13 08:55:27 CRITICAL nova [-] Unexpected error while running command.
    Command: sudo nova-rootwrap iptables-restore
    Exit code: 2
    Stdout: ''
    Stderr: 'iptables-restore v1.4.12: Port "None" does not resolve to anything.\n\nError occurred at line: 33\nTry `iptables-restore -h\' or \'iptables-restore --help\' for more information.\n'
    2012-11-13 08:55:27 TRACE nova Traceback (most recent call last):
    2012-11-13 08:55:27 TRACE nova   File "/usr/bin/nova-network", line 49, in <module>
    2012-11-13 08:55:27 TRACE nova     service.wait()
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 413, in wait
    2012-11-13 08:55:27 TRACE nova     _launcher.wait()
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 131, in wait
    2012-11-13 08:55:27 TRACE nova     service.wait()
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 166, in wait
    2012-11-13 08:55:27 TRACE nova     return self._exit_event.wait()
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/eventlet/event.py", line 116, in wait
    2012-11-13 08:55:27 TRACE nova     return hubs.get_hub().switch()
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line 177, in switch
    2012-11-13 08:55:27 TRACE nova     return self.greenlet.switch()
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 192, in main
    2012-11-13 08:55:27 TRACE nova     result = function(*args, **kwargs)
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 101, in run_server
    2012-11-13 08:55:27 TRACE nova     server.start()
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 162, in start
    2012-11-13 08:55:27 TRACE nova     self.manager.init_host()
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/network/manager.py", line 1766, in init_host
    2012-11-13 08:55:27 TRACE nova     NetworkManager.init_host(self)
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/network/manager.py", line 758, in init_host
    2012-11-13 08:55:27 TRACE nova     self._setup_network_on_host(ctxt, network)
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/network/manager.py", line 1853, in _setup_network_on_host
    2012-11-13 08:55:27 TRACE nova     network['vpn_private_address'])
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/network/l3.py", line 113, in add_vpn
    2012-11-13 08:55:27 TRACE nova     linux_net.ensure_vpn_forward(public_ip, port, private_ip)
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/network/linux_net.py", line 499, in ensure_vpn_forward
    2012-11-13 08:55:27 TRACE nova     iptables_manager.apply()
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/utils.py", line 943, in inner
    2012-11-13 08:55:27 TRACE nova     retval = f(*args, **kwargs)
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/network/linux_net.py", line 334, in apply
    2012-11-13 08:55:27 TRACE nova     attempts=5)
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/network/linux_net.py", line 813, in _execute
    2012-11-13 08:55:27 TRACE nova     return utils.execute(*cmd, **kwargs)
    2012-11-13 08:55:27 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/utils.py", line 242, in execute
    2012-11-13 08:55:27 TRACE nova     cmd=' '.join(cmd))
    2012-11-13 08:55:27 TRACE nova ProcessExecutionError: Unexpected error while running command.
    2012-11-13 08:55:27 TRACE nova Command: sudo nova-rootwrap iptables-restore
    2012-11-13 08:55:27 TRACE nova Exit code: 2
    2012-11-13 08:55:27 TRACE nova Stdout: ''
    2012-11-13 08:55:27 TRACE nova Stderr: 'iptables-restore v1.4.12: Port "None" does not resolve to anything.\n\nError occurred at line: 33\nTry `iptables-restore -h\' or \'iptables-restore --help\' for more information.\n'
    2012-11-13 08:55:27 TRACE nova 
    nova-volume.log
    2012-11-13 08:55:20 DEBUG nova.utils [-] Found sentinel openstack-1f5765-1f5b050.44811 for pid 44811 from (pid=44995) cleanup_file_locks /usr/lib/python2.7/dist-packages/nova/utils.py:1000
    2012-11-13 08:55:20 DEBUG nova.utils [-] Found lockfile nova-ensure_bridge.lock with link count 2 from (pid=44995) cleanup_file_locks /usr/lib/python2.7/dist-packages/nova/utils.py:1023
    2012-11-13 08:55:20 DEBUG nova.utils [req-1d2ebd03-666a-4ed7-8ade-e26e1303b33b None None] Running cmd (subprocess): sudo nova-rootwrap vgs --noheadings -o name from (pid=44995) execute /usr/lib/python2.7/dist-packages/nova/utils.py:219
    2012-11-13 08:55:21 CRITICAL nova [-] volume group nova-volumes doesn't exist
    2012-11-13 08:55:21 TRACE nova Traceback (most recent call last):
    2012-11-13 08:55:21 TRACE nova   File "/usr/bin/nova-volume", line 49, in <module>
    2012-11-13 08:55:21 TRACE nova     service.wait()
    2012-11-13 08:55:21 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 413, in wait
    2012-11-13 08:55:21 TRACE nova     _launcher.wait()
    2012-11-13 08:55:21 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 131, in wait
    2012-11-13 08:55:21 TRACE nova     service.wait()
    2012-11-13 08:55:21 TRACE nova   File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 166, in wait
    2012-11-13 08:55:21 TRACE nova     return self._exit_event.wait()
    2012-11-13 08:55:21 TRACE nova   File "/usr/lib/python2.7/dist-packages/eventlet/event.py", line 116, in wait
    2012-11-13 08:55:21 TRACE nova     return hubs.get_hub().switch()
    2012-11-13 08:55:21 TRACE nova   File "/usr/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line 177, in switch
    2012-11-13 08:55:21 TRACE nova     return self.greenlet.switch()
    2012-11-13 08:55:21 TRACE nova   File "/usr/lib/python2.7/dist-packages/eventlet/greenthread.py", line 192, in main
    2012-11-13 08:55:21 TRACE nova     result = function(*args, **kwargs)
    2012-11-13 08:55:21 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 101, in run_server
    2012-11-13 08:55:21 TRACE nova     server.start()
    2012-11-13 08:55:21 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/service.py", line 162, in start
    2012-11-13 08:55:21 TRACE nova     self.manager.init_host()
    2012-11-13 08:55:21 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/volume/manager.py", line 93, in init_host
    2012-11-13 08:55:21 TRACE nova     self.driver.check_for_setup_error()
    2012-11-13 08:55:21 TRACE nova   File "/usr/lib/python2.7/dist-packages/nova/volume/driver.py", line 107, in check_for_setup_error
    2012-11-13 08:55:21 TRACE nova     % FLAGS.volume_group)
    2012-11-13 08:55:21 TRACE nova Error: volume group nova-volumes doesn't exist
    2012-11-13 08:55:21 TRACE nova 
      

  3.   

    2012-11-13 08:55:27 TRACE nova Command: sudo nova-rootwrap iptables-restore
    2012-11-13 08:55:27 TRACE nova Exit code: 2
    2012-11-13 08:55:27 TRACE nova Stdout: ''
    2012-11-13 08:55:27 TRACE nova Stderr: 'iptables-restore v1.4.12: Port "None" does not resolve to anything.\n\nError occurred at line: 33\nTry `iptables-restore -h\' or \'iptables-restore --help\' for more information.\n'这一段是需要在NOVA.CONF中修改“root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf”
      

  4.   

    http://wiki.openstack.org/Packager/Rootwrap参考这个配置