Skip to content

Commit

Permalink
[Blockstore] EndpointProxySocketPath option should have priority over…
Browse files Browse the repository at this point in the history
… NbdNetlink option, otherwise endpoint proxy may become accidentally disabled if someone enables NbdNetlink (#2543)
  • Loading branch information
SvartMetal authored Nov 20, 2024
1 parent 2186011 commit 26e6337
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions cloud/blockstore/libs/daemon/common/bootstrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ void TBootstrapBase::Init()
.NbdDevicePrefix = Configs->ServerConfig->GetNbdDevicePrefix(),
};

NBD::IDeviceFactoryPtr nbdDeviceFactory;

if (Configs->ServerConfig->GetEndpointProxySocketPath()) {
EndpointProxyClient = NClient::CreateClient(
{
Expand All @@ -539,26 +541,22 @@ void TBootstrapBase::Init()
Scheduler,
Timer,
Logging);
}

NBD::IDeviceFactoryPtr nbdDeviceFactory;
const ui32 defaultSectorSize = 4_KB;

if (Configs->ServerConfig->GetNbdNetlink()) {
nbdDeviceFactory = NClient::CreateProxyDeviceFactory(
{defaultSectorSize},
EndpointProxyClient);
}

if (!nbdDeviceFactory && Configs->ServerConfig->GetNbdNetlink()) {
nbdDeviceFactory = NBD::CreateNetlinkDeviceFactory(
Logging,
Configs->ServerConfig->GetNbdRequestTimeout(),
Configs->ServerConfig->GetNbdConnectionTimeout(),
true); // reconfigure
}

if (!nbdDeviceFactory && EndpointProxyClient) {
const ui32 defaultSectorSize = 4_KB;

nbdDeviceFactory = NClient::CreateProxyDeviceFactory(
{defaultSectorSize},
EndpointProxyClient);
}

// The only case we want kernel to retry requests is when the socket is dead
// due to nbd server restart. And since we can't configure ioctl device to
// use a new socket, request timeout effectively becomes connection timeout
Expand Down

0 comments on commit 26e6337

Please sign in to comment.