From ae66bbdc2619cad0355db39a8f44f4a55c7719a6 Mon Sep 17 00:00:00 2001 From: Uwe Seimet <48174652+uweseimet@users.noreply.github.com> Date: Mon, 21 Nov 2022 09:30:10 +0100 Subject: [PATCH] Dry-run shall not change any state (21.10.01 regression) (#998) --- cpp/devices/ctapdriver.cpp | 2 +- cpp/rascsi/rascsi_executor.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/devices/ctapdriver.cpp b/cpp/devices/ctapdriver.cpp index df02e187..10ee7803 100644 --- a/cpp/devices/ctapdriver.cpp +++ b/cpp/devices/ctapdriver.cpp @@ -136,7 +136,7 @@ bool CTapDriver::Init(const unordered_map& const_params) } inet = params["inet"]; - LOGTRACE("Opening Tap device") + LOGTRACE("Opening tap device") // TAP device initilization if ((m_hTAP = open("/dev/net/tun", O_RDWR)) < 0) { LOGERROR("Can't open tun: %s", strerror(errno)) diff --git a/cpp/rascsi/rascsi_executor.cpp b/cpp/rascsi/rascsi_executor.cpp index 51923c84..c5843bee 100644 --- a/cpp/rascsi/rascsi_executor.cpp +++ b/cpp/rascsi/rascsi_executor.cpp @@ -331,6 +331,11 @@ bool RascsiExecutor::Attach(const CommandContext& context, const PbDeviceDefinit device->SetProtected(pb_device.protected_()); } + // Stop the dry run here, before actually attaching + if (dryRun) { + return true; + } + unordered_map params = { pb_device.params().begin(), pb_device.params().end() }; if (!device->SupportsFile()) { // Clients like rasctl might have sent both "file" and "interfaces" @@ -346,11 +351,6 @@ bool RascsiExecutor::Attach(const CommandContext& context, const PbDeviceDefinit storage_device->ReserveFile(full_path, id, lun); } - // Stop the dry run here, before actually attaching - if (dryRun) { - return true; - } - if (!controller_manager.AttachToScsiController(id, device)) { return context.ReturnLocalizedError(LocalizationKey::ERROR_SCSI_CONTROLLER); }