Skip to content

Commit 34edb22

Browse files
Eugenio Grossoclaude
andcommitted
kvm: align NVMe-oF adaptor stubs with the Fibre Channel adaptor
NVMe-TCP is a different carrier for the same array operations, so the NVMe-oF storage adaptor should only diverge from MultipathSCSIAdapterBase where the transport genuinely differs. Several unimplemented methods threw UnsupportedOperationException where the Fibre Channel adaptor returns a benign value, which means a caller that degrades gracefully on Fibre Channel aborts on NVMe-TCP: * deletePhysicalDisk(): FC returns false. Namespaces are created and destroyed by the storage provider, so a host-side delete is simply not handled here; throwing from a cleanup path is worse than reporting that. * createTemplateFromDisk(), listPhysicalDisks(): FC returns null. * createFolder(): FC logs and returns true. Block storage has no directory structure, so this is a no-op rather than an error. createPhysicalDisk(), createDiskFromTemplate() and createDiskFromTemplateBacking() still throw, because the Fibre Channel adaptor throws for those too. createTemplateFromDirectDownloadFile() also still throws, but the message now states the limitation instead of reading as an oversight. The Fibre Channel implementation resolves the downloaded file with destPool.getPhysicalDisk(), which on this adaptor requires a "type=NVMETCP;address=..." path and therefore cannot describe a plain local file. Supporting it needs a separate way to present the local file as the copy source, which is left for follow-up rather than guessed at here. No functional change to the connect/disconnect paths. The comment on disconnectPhysicalDisk() is updated because it described connections as host-group scoped, which is no longer how NVMe-TCP volumes are connected, and to record why the host-side no-op is correct: the kernel drops the namespace when the target removes the connection, whereas Fibre Channel must flush its device-mapper entry. Signed-off-by: Eugenio Grosso <eugenio.grosso@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 1faa7ce commit 34edb22

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/storage/MultipathNVMeOFAdapterBase.java‎

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,9 @@ private void rescanAllControllers() {
267267

268268
@Override
269269
public boolean disconnectPhysicalDisk(String volumePath, KVMStoragePool pool) {
270-
// NVMe-oF: the kernel drops the namespace as soon as the target
271-
// removes the host(-group) connection. No host-side action needed.
270+
// NVMe-oF: the kernel drops the namespace as soon as the target removes
271+
// this host's connection, so there is no host-side map to tear down the way
272+
// Fibre Channel must flush its device-mapper entry.
272273
return true;
273274
}
274275

@@ -286,7 +287,11 @@ public boolean disconnectPhysicalDiskByPath(String localPath) {
286287

287288
@Override
288289
public boolean deletePhysicalDisk(String uuid, KVMStoragePool pool, Storage.ImageFormat format) {
289-
throw new UnsupportedOperationException("Deletion of NVMe namespaces is the storage provider's responsibility");
290+
// Namespaces are created and destroyed by the storage provider, never from the
291+
// host. Report "not handled here" instead of throwing, so a caller on a cleanup
292+
// path behaves the same as it does on the Fibre Channel adapter.
293+
LOGGER.info("deletePhysicalDisk({}) not handled by the NVMe-oF adapter; the storage provider owns namespace deletion", uuid);
294+
return false;
290295
}
291296

292297
@Override
@@ -297,12 +302,15 @@ public KVMPhysicalDisk createPhysicalDisk(String name, KVMStoragePool pool, Phys
297302

298303
@Override
299304
public KVMPhysicalDisk createTemplateFromDisk(KVMPhysicalDisk disk, String name, QemuImg.PhysicalDiskFormat format, long size, KVMStoragePool destPool) {
300-
throw new UnsupportedOperationException("Unimplemented method 'createTemplateFromDisk'");
305+
LOGGER.info("createTemplateFromDisk not supported on NVMe-oF pools");
306+
return null;
301307
}
302308

303309
@Override
304310
public List<KVMPhysicalDisk> listPhysicalDisks(String storagePoolUuid, KVMStoragePool pool) {
305-
throw new UnsupportedOperationException("Unimplemented method 'listPhysicalDisks'");
311+
// The array owns the namespace inventory; it is not enumerable from the host.
312+
LOGGER.info("listPhysicalDisks not supported on NVMe-oF pool {}", storagePoolUuid);
313+
return null;
306314
}
307315

308316
@Override
@@ -376,7 +384,13 @@ public KVMPhysicalDisk createDiskFromTemplateBacking(KVMPhysicalDisk template, S
376384

377385
@Override
378386
public KVMPhysicalDisk createTemplateFromDirectDownloadFile(String templateFilePath, String destTemplatePath, KVMStoragePool destPool, Storage.ImageFormat format, int timeout) {
379-
throw new UnsupportedOperationException("Unimplemented method 'createTemplateFromDirectDownloadFile'");
387+
// Not supported yet. The equivalent Fibre Channel path resolves the downloaded
388+
// file through destPool.getPhysicalDisk(), which on this adapter requires a
389+
// "type=NVMETCP;address=..." volume path and so cannot describe a plain local
390+
// file. Supporting direct-download templates needs a separate way to present
391+
// the local file as the copy source.
392+
throw new UnsupportedOperationException(
393+
"Direct download templates are not supported on NVMe-oF pools; register the template via secondary storage instead");
380394
}
381395

382396
@Override
@@ -386,12 +400,15 @@ public boolean refresh(KVMStoragePool pool) {
386400

387401
@Override
388402
public boolean createFolder(String uuid, String path) {
389-
throw new UnsupportedOperationException("Unimplemented method 'createFolder'");
403+
return createFolder(uuid, path, null);
390404
}
391405

392406
@Override
393407
public boolean createFolder(String uuid, String path, String localPath) {
394-
throw new UnsupportedOperationException("Unimplemented method 'createFolder'");
408+
// Block storage has no directory structure to create. Succeed rather than
409+
// throw, matching the Fibre Channel adapter.
410+
LOGGER.info("createFolder({}, {}, {}) is a no-op on NVMe-oF pools", uuid, path, localPath);
411+
return true;
395412
}
396413

397414
/**

0 commit comments

Comments
 (0)