0

I want to attach Ceph rbd block image to running VM. I can attach img1 by editing vm xml so all works here. But i want to make it live attach.

Pool and image are visible from host lvl

# virsh pool-list
 Name                 State      Autostart 
-------------------------------------------
 data-hdd             active     no        
 local                active     yes       
#


# virsh vol-list --details data-hdd
 Name   Path                                Type      Capacity  Allocation
---------------------------------------------------------------------------
 img1  data-hdd/img1                        network  10.00 GiB   10.00 GiB
#

# virsh attach-disk testvm data-hdd/img1 sdb
error: Failed to attach disk
error: Cannot access storage file 'data-hdd/img1': No such file or directory

I was trying to multiple driver/subdriver/type - but no luck

How to attaach CEPH rbd volume to running VM?

milekz
  • 9
  • 2

1 Answers1

0

here are the correct steps :

  1. create a block device pool
  2. create a block device user, example qemu user accessing the "vms" pool :
ceph auth get-or-create client.qemu mon 'profile rbd' osd 'profile rbd pool=vms, profile rbd-read-only pool=images' mgr 'profile rbd pool=images'
  1. on ceph client node, create a block device image with the quemu user :
rbd create foo --size 4096 --image-feature layering [-m {mon-IP}] [-k /path/to/ceph.qemu.keyring] [-p vms]
  1. on ceph client map the image:
sudo rbd map foo --name client.admin [-m {mon-IP}] [-k /path/to/ceph.qemu.keyring] [-p vms ]
  1. create file system:
sudo mkfs.ext4 -m0 /dev/rbd/vms/foo

And you can also do a following after steps 1. and 2. ( direct image also with qemu ):

example:

qemu-img create -f rbd rbd:libvirt-pool/new-libvirt-image 2G

and verify with :

rbd -p libvirt-pool ls
Norbert_Cs
  • 116
  • 2