Ephemeral/Persistent disks

Asked by aimar

Hi,
Actually I am running OpenStack Folsom release and I was wondering about the point that OpenStack handle the disks.
When we ask Nova to boot a VM, nova-compute will connect to Glance and "GET" the image file from Glance and save it on the its local filesystem. So by default the disk of an instance is basically stored on the local filesystem of the server where the instance is running that is the 'ephemeral' disk. In oppoiste of persistent disks, the ephemeral disks will be discarded if the VM is shut down and on failures.

Is that possible to make nova boot the primary disk 'ephemeral' as persistent from a volume instead in the local machine runing the hypervisor ?

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Compute (nova) Edit question
Assignee:
No assignee Edit question
Solved by:
John Garbutt
Solved:
Last query:
Last reply:
Revision history for this message
John Garbutt (johngarbutt) said :
#1

Basically a persistent disk == a volume

I think you are looking for the "boot from volume" feature:
http://docs.openstack.org/trunk/openstack-compute/admin/content/boot-from-volume.html

With newer versions, Cinder drivers you can create the volume from a Glance image.

An example is in DevStack:
https://github.com/openstack-dev/devstack/blob/master/exercises/boot_from_volume.sh

It is a bit more manual to create a good volume in Folsom, see this:
https://github.com/openstack-dev/devstack/blob/stable/folsom/exercises/boot_from_volume.sh

Revision history for this message
aimar (khedhermail) said :
#2

Thanks for the response,
In fact I used cinder as volume backend and followed the example above.
Once created a vm, it shows an error status without mentioning any reason in log files nova or cinder log files.
I was checking /var/lib/nova/instances to check the instance created but no new instance000000x was created in the folder.
I checked also nova show vm and as OS-EXT-SRV-ATTR:instance_name was instance-0000000a.
that means as far as I understand that the ephemeral disk is created [folder disk] in cinder-volumes level.
Could the be reason of the error ?

Revision history for this message
aimar (khedhermail) said :
#3

The instance created booted from that volume shows ERROR status in nova list instances. However I can ping it. No errors shown actually. try to figure out how it was done I could see in the /var/lib/nova/instances/instance000000x/libvirt.xml the creation of two types of disk [file and block types]
   <disk type="file" device="disk">
      <driver name="qemu" type="qcow2" cache="none"/>
      <source file="/var/lib/nova/instances/instance-00000011/disk"/>
      <target bus="virtio" dev="vda"/>
    </disk>
    <disk type="block" device="disk">
      <driver name="qemu" type="raw" cache="none"/>
      <source dev="/dev/disk/by-path/ip-172.16.0.3:3260-iscsi-iqn.2010-10.org.openstack:volume-19fd60dc-0b6e-4b11-8fc0-5cd32e45dacd-lun-1"/>
      <target bus="virtio" dev="volcinder2"/>
    </disk>

Is still something missing ?

Revision history for this message
John Garbutt (johngarbutt) said :
#4

Can you get hold of the nova-compute logs?
That should give us more help about what is going wrong.

Revision history for this message
aimar (khedhermail) said :
#5

tail -n150 /var/log/nova/nova-compute.log | grep error:

TRACE nova.compute.manager [instance: 618c913c-f47d-4449-95cb-2501fdf72bcd] libvirtError: internal error Invalid harddisk device name: volcinder2
TRACE nova.openstack.common.rpc.amqp self._set_instance_error_state(context, instance['uuid'])
TRACE nova.openstack.common.rpc.amqp libvirtError: internal error Invalid harddisk device name: volcinder2

it seems that the cinder volume not recognized by nova.
It s already configured in cinder.conf file.
To create that volume group I proceeded as follows:

dd if=/dev/zero of=volcinder2 bs=1 count=0 seek=6G
losetup /dev/loop3 volcinder2
fdisk /dev/loop3

Then we could see i cinder list the new volume group created and available.

Just after executing nova boot as follows:
nova boot --flavor 1 --image Test --key_name mykey --block-device-mapping volcinder2=19fd60dc-0b6e-4b11-8fc0-5cd32e45dacd:::0 ServerFromBoot

show building --> Error status.

???

n
p
1
ENTER
ENTER
t
8e
w

pvcreate /dev/loop3
vgcreate volcinder2 /dev/loop3

Revision history for this message
John Garbutt (johngarbutt) said :
#6

Hmm, that certainly could be a better error message.

The bit you have as "volcinder2" is meant to be a device, like "/dev/vda" (can't remember what the correct letters for "vd" are in your case.

Give that a whirl and see if it helps. You need something that libvirt (in your case) recognises as a device name.

I hope that helps get you a bit further.

Revision history for this message
aimar (khedhermail) said :
#7

I did not see how libvirt should recognise 'volcinder2' as a device. is that /dev/vda naming imporant for that ?

Revision history for this message
Best John Garbutt (johngarbutt) said :
#8

Take a look at how the exercise script works:
https://github.com/openstack-dev/devstack/blob/stable/folsom/exercises/boot_from_volume.sh#L204

What you want is:
nova boot --flavor 1 --image Test --key_name mykey --block-device-mapping vda=19fd60dc-0b6e-4b11-8fc0-5cd32e45dacd:::0 ServerFromBoot

The "vda" means first disk, where "vdb" would mean second disk, in the usual unixy way.

Revision history for this message
aimar (khedhermail) said :
#9

Thanks for your response. It helps by mentionning vda as you said before but still wondering about the 'vda' as a first disk for example will be created once the command launched ? and what is the differene between this way and using a cindervol2 as created above ?

Revision history for this message
aimar (khedhermail) said :
#10

Thanks John Garbutt, that solved my question.