cockpit-project / cockpit-machines

Cockpit UI for virtual machines
GNU Lesser General Public License v2.1
286 stars 74 forks source link

Machine: No support for rbd pools #68

Open mzamot opened 4 years ago

mzamot commented 4 years ago

Hello,

I noticed in the code that there is no support for rbd pool types in Cockpit, even though they are supported in libvirt.

What is missing to add support for it?

Thank you

KKoukiou commented 4 years ago

Hey @mzamot, nothing is really missing, we just need to enable the option together with the relevant fields in the dialog and write a tests for it. The testing part needs some investigation since I never used RBD, so I am not sure how we can test it inside our test images.

Let me know if you want to help out implementing this, I will be happy to guide you.

mzamot commented 4 years ago

@KKoukiou thank you. I added an rbd pool on virt-manager and tried to attach it to a VM in Cockpit, but it tries to use volume type rather than network type, so it fails. I dont have access to the RBD at the moment, but when I do I can get some logs.

mzamot commented 4 years ago

@KKoukiou I can spend some try playing with it, but I will need your help :)

mzamot commented 4 years ago

So I was able to get access to a Ceph cluster. Selecting an rbd volume when creating a new VM works. But trying to create/attach an extra volume fails:

Trying to create a new volume clicking Add Disk from the VM properties, fails with:

Disk failed to be created

Error message: unsupported configuration: only RAW volumes are supported by this storage pool 

Trying to attach an existing volume with Add disk from the VM properties:

Error message: unsupported configuration: shared access for disk 'vdb' requires use of supported storage format
KKoukiou commented 4 years ago

I suspect where is the problem but I don't have right now a ceph cluster to reproduce. Maybe you 're interested to try this code out and let me know if that works for you?

From 80c89e27a3492b9693132aaac1fc866e7e06042a Mon Sep 17 00:00:00 2001
From: Katerina Koukiou <kkoukiou@redhat.com>
Date: Mon, 27 Jan 2020 10:27:56 +0100
Subject: [PATCH] WIP: machines: fix rbd volume creation

---
 .../components/storagePools/storageVolumeCreateBody.jsx        | 2 ++
 pkg/machines/helpers.js                                        | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/pkg/machines/components/storagePools/storageVolumeCreateBody.jsx b/pkg/machines/components/storagePools/storageVolumeCreateBody.jsx
index 02837c2bb..fa14b15b0 100644
--- a/pkg/machines/components/storagePools/storageVolumeCreateBody.jsx
+++ b/pkg/machines/components/storagePools/storageVolumeCreateBody.jsx
@@ -55,6 +55,8 @@ const VolumeDetails = ({ idPrefix, size, unit, format, storagePoolType, onValueC
         ];
     } else if (['dir', 'fs', 'netfs', 'gluster', 'vstorage'].indexOf(storagePoolType) > -1) {
         validVolumeFormats = ['qcow2', 'raw'];
+    } else if (['rbd'].indexOf(storagePoolType) > - 1) {
+        validVolumeFormats = ['raw'];
     }

     if (validVolumeFormats) {
diff --git a/pkg/machines/helpers.js b/pkg/machines/helpers.js
index f774d82dc..f59488163 100644
--- a/pkg/machines/helpers.js
+++ b/pkg/machines/helpers.js
@@ -702,6 +702,9 @@ export function getDefaultVolumeFormat(pool) {
     if (['dir', 'fs', 'netfs', 'gluster', 'vstorage'].indexOf(pool.type) > -1)
         return 'qcow2';

+    if (['rbd'].indexOf(pool.type) > -1)
+        return 'raw';
+
     return undefined;
 }

-- 
2.24.1
mzamot commented 4 years ago

Hello @KKoukiou applied your changes and this is what I see:

When I try to create a volume on the RBD pool, now it defaults to raw in a dropdown menu, but it still fails with the following, so even it's raw, it's not using it:

Disk failed to be created

Error message: unsupported configuration: only RAW volumes are supported by this storage pool 

image

And if I try to attach an already existing rbd volume it fails with the following:

Disk failed to be attached

Error message: unsupported configuration: using 'rbd' pools for backing 'volume' disks isn't yet supported 

image

This error it's because it's using volume instead of network type, but seems you're getting closer :)

KKoukiou commented 4 years ago

Hello @KKoukiou applied your changes and this is what I see:

When I try to create a volume on the RBD pool, now it defaults to raw in a dropdown menu, but it still fails with the following, so even it's raw, it's not using it:

Disk failed to be created

Error message: unsupported configuration: only RAW volumes are supported by this storage pool 

image

Weird, it clearly thinks that the volume is of different type that 'raw'. For the volume that got created, could you paste the XML. sudo virsh vol-dumpxml volName poolName.

And if I try to attach an already existing rbd volume it fails with the following:

Disk failed to be attached

Error message: unsupported configuration: using 'rbd' pools for backing 'volume' disks isn't yet supported 

image

This error it's because it's using volume instead of network type, but seems you're getting closer :)

Oh thanks for applying the patch, that was useful. Ok so in cockpit we always create disks of type=volume so that we can be more generic, and just provide the pool/volume pair instead of the disk source details. However I just realized that not all pool types support this yet,

https://github.com/libvirt/libvirt/blob/master/src/conf/domain_conf.c#L31525..L31531 and RBD is one of them. So,

mzamot commented 4 years ago

@KKoukiou

Weird, it clearly thinks that the volume is of different type that 'raw'. For the volume that got created, could you paste the XML. sudo virsh vol-dumpxml volName poolName.

This volume was created in Cockpit by going to the Pool and clicking Create Volume:

<volume type='network'>
  <name>test</name>
  <key>libvirt-pool/test</key>
  <source>
  </source>
  <capacity unit='bytes'>1073741824</capacity>
  <allocation unit='bytes'>1073741824</allocation>
  <target>
    <path>libvirt-pool/test</path>
    <format type='raw'/>
  </target>
</volume>

It just doesn't work when you try to create the volume from within the VM settings.

* I will open a feature request for libvirt to extend the support of disk type=volume for RBD storage

I think somebody tried to get it back in 2014 but no progress :-(

KKoukiou commented 4 years ago

@KKoukiou

Weird, it clearly thinks that the volume is of different type that 'raw'. For the volume that got created, could you paste the XML. sudo virsh vol-dumpxml volName poolName.

This volume was created in Cockpit by going to the Pool and clicking Create Volume:

<volume type='network'>
  <name>test</name>
  <key>libvirt-pool/test</key>
  <source>
  </source>
  <capacity unit='bytes'>1073741824</capacity>
  <allocation unit='bytes'>1073741824</allocation>
  <target>
    <path>libvirt-pool/test</path>
    <format type='raw'/>
  </target>
</volume>

It just doesn't work when you try to create the volume from within the VM settings.

* I will open a feature request for libvirt to extend the support of disk type=volume for RBD storage

I think somebody tried to get it back in 2014 but no progress :-(

I could not find a bug that asks exactly what we need, so I opened a new one. https://bugzilla.redhat.com/show_bug.cgi?id=1795541

mzamot commented 4 years ago

@KKoukiou considering that a RFE for libvirt can take a lot of time, can we have a workaround for this?

KKoukiou commented 4 years ago

@KKoukiou considering that a RFE for libvirt can take a lot of time, can we have a workaround for this?

Yes, I have it on my backlog.

mzamot commented 4 years ago

Yes, I have it on my backlog.

Awesome! If you need access to a Ceph cluster let me know, I can give you access to mine.

cobi-s commented 1 year ago

Is there any progress on this issue? I still don't see an option to create a rbd storage pool in the cockpit UI. If this option is still missing, could you link me to some resources on how I would manually create the pool and have it avaiable in cockpit?

Also, if I read this thread correctly, even having the pool available does still not allow to create disks in the VM management? How would I go about this?

strzinek commented 8 months ago

Is there any progress on this issue? I still don't see an option to create a rbd storage pool in the cockpit UI. If this option is still missing, could you link me to some resources on how I would manually create the pool and have it avaiable in cockpit?

It is possible to define rbd pool for libvirt with virsh and then use it in cockpit-machines: https://serverfault.com/a/1123669

Also, if I read this thread correctly, even having the pool available does still not allow to create disks in the VM management? How would I go about this?

Once you define the ceph rbd pool for libvirt, the cockpit then allows to work with pool images, e.g. create a new image in the pool and then use this image when creating a new vm. What does not work in cockpit for me yet, is creating a new image in rbd pool during vm creation, and also adding a new or existing rbd image to existing vm.