File tree Expand file tree Collapse file tree 1 file changed +1
-12
lines changed
scripts/vm/hypervisor/kvm/imageserver/backends Expand file tree Collapse file tree 1 file changed +1
-12
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,6 @@ def __init__(
4545 need_block_status : bool = False ,
4646 extra_meta_contexts : Optional [List [str ]] = None ,
4747 ):
48- self ._sock = socket .socket (socket .AF_UNIX , socket .SOCK_STREAM )
49- self ._sock .connect (socket_path )
5048 self ._nbd = nbd .NBD ()
5149
5250 if export and hasattr (self ._nbd , "set_export_name" ):
@@ -59,7 +57,7 @@ def __init__(
5957 except Exception as e :
6058 logging .warning ("add_meta_context %r failed: %r" , ctx , e )
6159
62- self ._connect_existing_socket ( self . _sock )
60+ self ._nbd . connect_unix ( socket_path )
6361
6462 def _connect_existing_socket (self , sock : socket .socket ) -> None :
6563 last_err : Optional [BaseException ] = None
@@ -308,15 +306,6 @@ def close(self) -> None:
308306 self ._nbd .shutdown ()
309307 except Exception :
310308 pass
311- try :
312- if hasattr (self ._nbd , "close" ):
313- self ._nbd .close ()
314- except Exception :
315- pass
316- try :
317- self ._sock .close ()
318- except Exception :
319- pass
320309
321310 def __enter__ (self ) -> "NbdConnection" :
322311 return self
You can’t perform that action at this time.
0 commit comments