## Create bootable volume, boot a nova instance from it -- https://fedoraproject.org/wiki/QA:Testcase_Nova_Create_Bootable_Volume ======= [root@localhost ~]# glance image-create --name cirros2 --is-public true --disk-format qcow2 --container-format bare --copy-from https://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img ======= [root@localhost ~]# glance image-list +--------------------------------------+----------+-------------+------------------+-----------+--------+ | ID | Name | Disk Format | Container Format | Size | Status | +--------------------------------------+----------+-------------+------------------+-----------+--------+ | 4f455e7b-afd2-4813-9275-04ab4cb3b62d | cirros2 | qcow2 | bare | 9761280 | active | | 1908c7eb-ce09-4754-891b-5ba793e4700c | fedora18 | qcow2 | bare | 227409920 | active | +--------------------------------------+----------+-------------+------------------+-----------+--------+ [root@localhost ~]# ======= [root@localhost ~]# echo $IMAGE_ID 4f455e7b-afd2-4813-9275-04ab4cb3b62d [root@localhost ~]# ======= [root@localhost ~]# cinder create --image-id $IMAGE_ID --display_name=bootable_cirros 1 +---------------------+--------------------------------------+ | Property | Value | +---------------------+--------------------------------------+ | attachments | [] | | availability_zone | nova | | bootable | false | | created_at | 2013-04-03T11:52:00.625242 | | display_description | None | | display_name | bootable_cirros | | id | 0331cb46-41e8-45db-b14b-a6a209bf349b | | image_id | 4f455e7b-afd2-4813-9275-04ab4cb3b62d | | metadata | {} | | size | 1 | | snapshot_id | None | | source_volid | None | | status | creating | | volume_type | None | +---------------------+--------------------------------------+ ======= [root@localhost ~]# cinder list +--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+ | ID | Status | Display Name | Size | Volume Type | Bootable | Attached to | +--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+ | 0331cb46-41e8-45db-b14b-a6a209bf349b | available | bootable_cirros | 1 | None | true | | +--------------------------------------+-----------+-----------------+------+-------------+----------+-------------+ [root@localhost ~]# ======= [root@localhost ~]# VOLUME_ID=$(cinder list | awk '/bootable_cirros/ {print $2}') [root@localhost ~]# echo $VOLUME_ID 0331cb46-41e8-45db-b14b-a6a209bf349b [root@localhost ~]# ======= [root@localhost ~]# cinder snapshot-create --display_name bootable_snapshot $VOLUME_ID +---------------------+--------------------------------------+ | Property | Value | +---------------------+--------------------------------------+ | created_at | 2013-04-03T12:03:31.179663 | | display_description | None | | display_name | bootable_snapshot | | id | 3a518bd5-1aee-4aff-8919-2e5da7614815 | | metadata | {} | | size | 1 | | status | creating | | volume_id | 0331cb46-41e8-45db-b14b-a6a209bf349b | +---------------------+--------------------------------------+ [root@localhost ~]# ======= [root@localhost ~]# cinder snapshot-list +--------------------------------------+--------------------------------------+-----------+-------------------+------+ | ID | Volume ID | Status | Display Name | Size | +--------------------------------------+--------------------------------------+-----------+-------------------+------+ | 3a518bd5-1aee-4aff-8919-2e5da7614815 | 0331cb46-41e8-45db-b14b-a6a209bf349b | available | bootable_snapshot | 1 | +--------------------------------------+--------------------------------------+-----------+-------------------+------+ [root@localhost ~]# ======= [root@localhost ~]# SNAPSHOT_ID=$(cinder snapshot-list | awk '/bootable_snapshot/ {print $2}') ======= [root@localhost ~]# echo $SNAPSHOT_ID 3a518bd5-1aee-4aff-8919-2e5da7614815 [root@localhost ~]# ======= [root@localhost ~]# nova boot --flavor 1 --block_device_mapping vda=${SNAPSHOT_ID}:snap::0 --key_name oskey volume_backed ERROR: Block Device Mapping is Invalid: failed to get snapshot 3a518bd5-1aee-4aff-8919-2e5da7614815. (HTTP 400) (Request-ID: req-d2de4e9a-a075-47b4-8a05-13688cdbfc35) [root@localhost ~]# ======= *** log info *** ==> /var/log/cinder/api.log <== 140653864408992:error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:172: 2013-04-02 14:11:06 ERROR [keystoneclient.common.cms] Verify error: Error loading file /var/lib/cinder/cacert.pem 140211616528288:error:02001002:system library:fopen:No such file or directory:bss_file.c:169:fopen('/var/lib/cinder/cacert.pem','r') 140211616528288:error:2006D080:BIO routines:BIO_new_file:no such file:bss_file.c:172: 140211616528288:error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib:by_file.c:281: 2013-04-02 14:11:06 WARNING [cinder.openstack.common.policy] Inheritance-based rules are deprecated; use the default brain instead of HttpBrain. 2013-04-03 04:50:13 WARNING [cinder.openstack.common.policy] Inheritance-based rules are deprecated; use the default brain instead of HttpBrain. 2013-04-03 04:56:01 WARNING [cinder.openstack.common.policy] Inheritance-based rules are deprecated; use the default brain instead of HttpBrain. ==> /var/log/cinder/cinder-manage.log <== 2013-04-02 09:23:19 CRITICAL [cinder] __init__() got an unexpected keyword argument 'assert_unicode' ==> /var/log/cinder/scheduler.log <== 2013-04-02 14:11:07 ERROR [cinder.scheduler.manager] Failed to schedule_create_volume: No valid host was found. 2013-04-03 04:28:28 ERROR [cinder.scheduler.manager] Failed to schedule_create_volume: No valid host was found. 2013-04-03 04:57:01 ERROR [cinder.scheduler.manager] Failed to schedule_create_volume: No valid host was found. 2013-04-03 05:02:27 ERROR [cinder.scheduler.manager] Failed to schedule_create_volume: No valid host was found. 2013-04-03 05:08:32 ERROR [cinder.scheduler.manager] Failed to schedule_create_volume: No valid host was found. ==> /var/log/cinder/volume.log <== self.driver.check_for_setup_error() File "/usr/lib/python2.7/site-packages/cinder/volume/drivers/lvm.py", line 74, in check_for_setup_error out, err = self._execute('vgs', '--noheadings', '-o', 'name', File "/usr/lib/python2.7/site-packages/cinder/volume/drivers/lvm.py", line 74, in check_for_setup_error out, err = self._execute('vgs', '--noheadings', '-o', 'name', File "/usr/lib64/python2.7/bdb.py", line 48, in trace_dispatch return self.dispatch_line(frame) File "/usr/lib64/python2.7/bdb.py", line 67, in dispatch_line if self.quitting: raise BdbQuit BdbQuit ** root-cause: ** [1] I enabled a trace point for debugging & deleted it in one of the files: - /usr/lib/python2.7/site-packages/cinder/volume/drivers/lvm.py and then, it still remained in the byte-compiled file: - $ grep -R pdb /usr/lib/python2.7/site-packages/cinder/ Binary file /usr/lib/python2.7/site-packages/cinder/volume/drivers/lvm.pyc matches So, I removed it manually ======= [root@localhost ~]# find /usr/lib/python2.7 -name *.pyc -delete [root@localhost ~]# ======= [2] Restart all services: ======= [root@localhost ~]# for i in `systemctl list-unit-files --type=service | grep -i openstack | \ grep -i enabled | awk '{print $1}'`; do systemctl restart $i ; done ======= Then try the snapshot: ======= [root@localhost ~]# nova boot --flavor 1 --block_device_mapping vda=${SNAPSHOT_ID}:snap::0 --key_name oskey volume_backed +-------------------------------------+-------------------------------------------------+ | Property | Value | +-------------------------------------+-------------------------------------------------+ | OS-EXT-STS:task_state | scheduling | | image | Attempt to boot from volume - no image supplied | | OS-EXT-STS:vm_state | building | | OS-EXT-SRV-ATTR:instance_name | instance-00000003 | | flavor | m1.tiny | | id | 5f59c83c-e7a2-414d-86ce-4b63389d1d2e | | security_groups | [{u'name': u'default'}] | | user_id | 88591c9877424643ae9796ce4db90d19 | | OS-DCF:diskConfig | MANUAL | | accessIPv4 | | | accessIPv6 | | | progress | 0 | | OS-EXT-STS:power_state | 0 | | OS-EXT-AZ:availability_zone | None | | config_drive | | | status | BUILD | | updated | 2013-04-03T13:11:02Z | | hostId | | | OS-EXT-SRV-ATTR:host | None | | key_name | oskey | | OS-EXT-SRV-ATTR:hypervisor_hostname | None | | name | volume_backed | | adminPass | xFNAf6QKXXpu | | tenant_id | f7c558bcc5934c2db24c0a2e00b2b6d5 | | created | 2013-04-03T13:11:02Z | | metadata | {} | +-------------------------------------+-------------------------------------------------+ [root@localhost ~]# [root@localhost ~]# nova list +--------------------------------------+---------------+--------+----------+ | ID | Name | Status | Networks | +--------------------------------------+---------------+--------+----------+ | daa28d37-4461-4acb-a11c-5120cf334971 | cirros-test1 | ACTIVE | | | 5f59c83c-e7a2-414d-86ce-4b63389d1d2e | volume_backed | ERROR | | +--------------------------------------+---------------+--------+----------+ [root@localhost ~]# -> Try just the VOLUME_ID == [root@localhost ~]# echo $VOLUME_ID 0331cb46-41e8-45db-b14b-a6a209bf349b [root@localhost ~]# nova boot --flavor 1 --block_device_mapping vda=${VOLUME_ID}:::0 --key_name oskey test1 +-------------------------------------+-------------------------------------------------+ | Property | Value | +-------------------------------------+-------------------------------------------------+ | OS-EXT-STS:task_state | scheduling | | image | Attempt to boot from volume - no image supplied | | OS-EXT-STS:vm_state | building | | OS-EXT-SRV-ATTR:instance_name | instance-00000004 | | flavor | m1.tiny | | id | 64fa387e-b4af-4b1d-9928-a426c41d61c4 | | security_groups | [{u'name': u'default'}] | | user_id | 88591c9877424643ae9796ce4db90d19 | | OS-DCF:diskConfig | MANUAL | | accessIPv4 | | | accessIPv6 | | | progress | 0 | | OS-EXT-STS:power_state | 0 | | OS-EXT-AZ:availability_zone | None | | config_drive | | | status | BUILD | | updated | 2013-04-03T13:24:20Z | | hostId | | | OS-EXT-SRV-ATTR:host | None | | key_name | oskey | | OS-EXT-SRV-ATTR:hypervisor_hostname | None | | name | test1 | | adminPass | 7z5icn8ghuQs | | tenant_id | f7c558bcc5934c2db24c0a2e00b2b6d5 | | created | 2013-04-03T13:24:20Z | | metadata | {} | +-------------------------------------+-------------------------------------------------+ [root@localhost ~]# == [root@localhost ~]# nova list +--------------------------------------+---------------+--------+----------+ | ID | Name | Status | Networks | +--------------------------------------+---------------+--------+----------+ | daa28d37-4461-4acb-a11c-5120cf334971 | cirros-test1 | ACTIVE | | | 64fa387e-b4af-4b1d-9928-a426c41d61c4 | test1 | ERROR | | | 5f59c83c-e7a2-414d-86ce-4b63389d1d2e | volume_backed | ERROR | | +--------------------------------------+---------------+--------+----------+ *** configs & other info *** ======= [root@localhost ~]# cat /etc/cinder/cinder.conf | grep -v ^$ | grep -v ^# [DEFAULT] logdir = /var/log/cinder state_path = /var/lib/cinder lock_path = /var/lib/cinder/tmp volumes_dir = /etc/cinder/volumes iscsi_helper = tgtadm sql_connection = mysql://cinder:cinder@localhost/cinder rpc_backend = cinder.openstack.common.rpc.impl_qpid rootwrap_config = /etc/cinder/rootwrap.conf auth_strategy = keystone [keystone_authtoken] admin_tenant_name = service admin_user = cinder admin_password = servicepass auth_host = 127.0.0.1 auth_port = 35357 auth_protocol = http [root@localhost ~]# ======= [root@localhost ~]# vgs --noheadings -o name cinder-volumes fedora [root@localhost ~]# ======= [root@localhost ~]# systemctl | grep -i cinder openstac...nder-api.service loaded active running OpenStack Cinder API Server openstac...cheduler.service loaded active running OpenStack Cinder Scheduler Server openstac...r-volume.service loaded active running OpenStack Cinder Volume Server [root@localhost ~]# =======