andrijapanicsb commented on code in PR #14256:
URL: https://github.com/apache/cloudstack/pull/14256#discussion_r4186709029
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCheckVolumeCommandWrapper.java:
##########
@@ -63,6 +65,31 @@ public Answer execute(final CheckVolumeCommand command,
final LibvirtComputingRe
try {
if
(STORAGE_POOL_TYPES_SUPPORTED.contains(storageFilerTO.getType())) {
final KVMPhysicalDisk vol = pool.getPhysicalDisk(srcFile);
+ if
(Storage.StoragePoolType.RBD.equals(storageFilerTO.getType())
+ ||
Storage.StoragePoolType.Linstor.equals(storageFilerTO.getType())) {
+ // RBD and Linstor volumes are raw block devices, not
local qcow2 files:
+ // inspect them through qemu-img (RBD by its rbd: URI,
Linstor by its
+ // /dev/drbd device path) rather than checkQcow2File,
which would reject
+ // a raw device.
+ //
+ // A Linstor volume only materialises as a local /dev/drbd
device once the
+ // resource is made available on THIS host (a diskless
DRBD assignment). RBD
+ // needs no such step — qemu-img reaches it over the
network by its rbd: URI.
+ // So for Linstor we connect the resource here before
qemu-img inspects it and
+ // release the diskless assignment afterwards; the
replicated data on the
+ // storage nodes is untouched (disconnect only drops a
local diskless copy).
+ boolean linstorConnected = false;
+ if
(Storage.StoragePoolType.Linstor.equals(storageFilerTO.getType())) {
+ linstorConnected =
poolMgr.connectPhysicalDisk(storageFilerTO.getType(), storageFilerTO.getUuid(),
srcFile, null);
+ }
+ try {
+ return checkRbdVolume(command, pool, vol);
+ } finally {
+ if (linstorConnected) {
+
poolMgr.disconnectPhysicalDisk(storageFilerTO.getType(),
storageFilerTO.getUuid(), srcFile);
Review Comment:
Thanks — agreed that a successful connect does not establish ownership of
the local resource. Addressed in both wrappers in 01058cd674.
I took a slightly different approach from tracking temporary-resource
ownership: single-volume LINSTOR inspection now also uses read-only controller
metadata, so neither inspection path calls connectPhysicalDisk or
disconnectPhysicalDisk.
This removes the inspection-side risk of deleting an existing diskless
resource or changing allow-two-primaries/protocol during live migration. Actual
device connection remains the responsibility of the normal attach/start path;
this metadata check does not claim to verify local device accessibility.
Regression tests verify that inspection does not call connect/disconnect or
invoke qemu-img. The generic connection/disconnection implementation is
unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]