diff --git a/cloud/blockstore/libs/daemon/common/bootstrap.cpp b/cloud/blockstore/libs/daemon/common/bootstrap.cpp index 735c880d5a9..b4b7dda596c 100644 --- a/cloud/blockstore/libs/daemon/common/bootstrap.cpp +++ b/cloud/blockstore/libs/daemon/common/bootstrap.cpp @@ -526,6 +526,8 @@ void TBootstrapBase::Init() .NbdDevicePrefix = Configs->ServerConfig->GetNbdDevicePrefix(), }; + NBD::IDeviceFactoryPtr nbdDeviceFactory; + if (Configs->ServerConfig->GetEndpointProxySocketPath()) { EndpointProxyClient = NClient::CreateClient( { @@ -539,11 +541,15 @@ 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(), @@ -551,14 +557,6 @@ void TBootstrapBase::Init() 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