cockpit-machines icon indicating copy to clipboard operation
cockpit-machines copied to clipboard

Attach block device as a disk

Open skobyda opened this issue 2 years ago • 3 comments

Discussed in https://github.com/cockpit-project/cockpit-machines/discussions/746

Originally posted by pgmillon June 28, 2022 Hi, this is probably a dumb question since I'm not too familiar with qemu/cockpit: is it possible to attach a SATA device to a VM ? I already successfully attached a USD drive via the Host devices panel but I'm looking to attach /dev/sda & /dev/sdc and I'm not sure how to do that using cockpit-machines.

$ sudo lsscsi
[0:0:0:0]    disk    ATA      ST1000DM010-2EP1 CC46  /dev/sda
[1:0:0:0]    disk    ATA      INTEL SSDSC2BW12 DC32  /dev/sdb
[2:0:0:0]    disk    ATA      ST1000DM010-2EP1 CC46  /dev/sdc
```</div>

skobyda avatar Nov 13 '22 23:11 skobyda

Libvirt offers possibility to attach block device directly as a disk (see docs) We can expose this in the UI

skobyda avatar Nov 13 '22 23:11 skobyda

Oh, I assumed we had this already. We definitely should support block devices.

Now the questions are:

  • Is extending the file picker for a disk image obvious enough so that it'd support block devices as well? (We should definitely support this, as we should be able to tell if something is a block device or a disk image file — even if we have a more "proper" UI too.)
  • Do we need to add a mode which shows available block devices?

If we do show just block devices:

  • Instead of lsscsi (which isn't installed by default in Fedora Silverblue at least, and probably in other places), we probably should use something like lsblk (or some native systemd API if it exists).
  • We shouldn't show things like zram / zswap.
  • This can get tricky with subvolumes in various filesystems, like btrfs.

garrett avatar Nov 15 '22 08:11 garrett

Truenas vm also create zfs zvol for vm disk (a block device),currently cockpit recognite the zvol but can't attach disk corretly.

marcolam avatar Jan 13 '23 13:01 marcolam