Comment 4 for bug 1026404

Revision history for this message
Paul Collins (pjdc) wrote :

Below is a mostly paste'n'go Ceph recipe — apt clears the input buffer, so it can't be pasted in its entirety.

I've tested it on a blank VM and it seems to work. It could be a little tidier, e.g. currently logs will end up in /var/log/ceph.

I'm unsure about the test case as you have it above. The failure with Openstack occurs when we try to attach a volume to a running instance, not when the instance is started, so the test case probably needs to simulate that more closely. With a working Ceph handy the test case can now attach a volume and then perhaps poll "virsh dumpxml" for a while to ensure it shows up.

I seem to recall "virsh attach-disk" being a sufficiently incomplete mapping to "virsh attach-device" that it can't be used for RBDs. The test case will probably have to construct a suitable XML fragment and feed it to "virsh attach-device". Something like this should work:

    <disk type='network' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source protocol='rbd' name='rbd/blorp'/>
      <target dev='vdz' bus='virtio'/>
    </disk>

# begin recipe

sudo su -

apt-get update && apt-get -y install ceph

# paste from here to end

export CEPH_ROOT_TEMP=$(mktemp -d /tmp/ceph-root.XXXXXXXX)

export MKCEPHFS_TEMP=$(mktemp -d /tmp/mkcephfs.XXXXXXXX)

mkdir /etc/ceph

cat > /etc/ceph/ceph.conf << EOF
[osd]
 osd journal size = 1024
 filestore xattr use omap = true
 osd data = ${CEPH_ROOT_TEMP}/\$name
 osd journal = ${CEPH_ROOT_TEMP}/journal.\$name

[mon.${HOSTNAME}]
 host = ${HOSTNAME}
 mon addr = 127.0.0.1:6789
 mon data = ${CEPH_ROOT_TEMP}/\$name
[osd.0]
 host = ${HOSTNAME}
[osd.1]
 host = ${HOSTNAME}
EOF

mkdir ${CEPH_ROOT_TEMP}/osd.{0,1}

mkcephfs -c /etc/ceph/ceph.conf -d $MKCEPHFS_TEMP --prepare-monmap

mkcephfs -d $MKCEPHFS_TEMP --init-local-daemons osd

mkcephfs -d $MKCEPHFS_TEMP --prepare-mon

mkcephfs -d $MKCEPHFS_TEMP --init-local-daemons mon

/etc/init.d/ceph start

ceph -s

rbd create --size 1024 blorp

rbd info blorp

# end