Libvirt pool on Ceph

Some quick notes on attaching a Ceph pool to libvirt (KVM)

  1. Create an XML file to define your libvirt secret in 'secret.xml'. Replace 'client.admin' with whatever ceph user you want, or you can just leave it as 'admin'
    <secret ephemeral='no' private='no'>
            <usage type='ceph'>
                    <name>client.admin secret</name>
  2. Get the ceph authentication key for the user that you defined in 'secret.xml'. Make note of the key
    ceph auth get-key client.admin
  3. On your libvirt host, define the secret from the 'secret.xml' file. Make note of the UUID output
    virsh secret-define /path_to/secret.xml
  4. Set the value of the secret to the ceph authentication key
    virsh secret-set-value <UUID> <CephKey>
  5. Create an XML file to define the libvirt pool in 'ceph-pool.xml'. Modify 'secret uuid' to the UUID of the secret that you defined above
    <pool type="rbd">
        <host name=''/>
        <host name='my.ceph.monitor'/>
        <host name='third.ceph.monitor' port='6789'/>
        <auth username='admin' type='ceph'>
          <secret uuid='2ec115d7-3a88-3ceb-bc12-0ac909a6fd87'/>
  6. Define the pool, start the pool and set it to autostart
    virsh pool-define /path_to/ceph-pool.xml
    virsh pool-start myrbdpool
    virsh pool-autostart myrbdpool
Show php error messages