Dry-run shall not change any state (21.10.01 regression) (#998)

This commit is contained in:
Uwe Seimet 2022-11-21 09:30:10 +01:00 committed by GitHub
parent 0d95890887
commit ae66bbdc26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -136,7 +136,7 @@ bool CTapDriver::Init(const unordered_map<string, string>& 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))

View File

@ -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<string, string> 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);
}