mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-01 04:41:38 +00:00
Dry-run shall not change any state (21.10.01 regression) (#998)
This commit is contained in:
parent
0d95890887
commit
ae66bbdc26
|
@ -136,7 +136,7 @@ bool CTapDriver::Init(const unordered_map<string, string>& const_params)
|
||||||
}
|
}
|
||||||
inet = params["inet"];
|
inet = params["inet"];
|
||||||
|
|
||||||
LOGTRACE("Opening Tap device")
|
LOGTRACE("Opening tap device")
|
||||||
// TAP device initilization
|
// TAP device initilization
|
||||||
if ((m_hTAP = open("/dev/net/tun", O_RDWR)) < 0) {
|
if ((m_hTAP = open("/dev/net/tun", O_RDWR)) < 0) {
|
||||||
LOGERROR("Can't open tun: %s", strerror(errno))
|
LOGERROR("Can't open tun: %s", strerror(errno))
|
||||||
|
|
|
@ -331,6 +331,11 @@ bool RascsiExecutor::Attach(const CommandContext& context, const PbDeviceDefinit
|
||||||
device->SetProtected(pb_device.protected_());
|
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() };
|
unordered_map<string, string> params = { pb_device.params().begin(), pb_device.params().end() };
|
||||||
if (!device->SupportsFile()) {
|
if (!device->SupportsFile()) {
|
||||||
// Clients like rasctl might have sent both "file" and "interfaces"
|
// 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);
|
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)) {
|
if (!controller_manager.AttachToScsiController(id, device)) {
|
||||||
return context.ReturnLocalizedError(LocalizationKey::ERROR_SCSI_CONTROLLER);
|
return context.ReturnLocalizedError(LocalizationKey::ERROR_SCSI_CONTROLLER);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user