Add force to os-brick disconnect

In order to be sure that devices are being removed from the host,
we should be using the 'force' parameter with os-brick's
disconnect_volume() method.

Closes-bug: #2004555
Change-Id: I63d09ad9ef465bc154c85a9ea125449c039d1b90
This commit is contained in:
Brian Rosmaita 2023-04-18 11:22:27 -04:00
parent 7fd4c49b16
commit 1d8033e54e
4 changed files with 15 additions and 3 deletions

View File

@ -50,7 +50,8 @@ class BaseBrickConnectorInterface(object):
return device return device
def disconnect_volume(self, device): def disconnect_volume(self, device):
self.conn.disconnect_volume(self.connection_info, device) # Bug #2004555: use force so there aren't any leftovers
self.conn.disconnect_volume(self.connection_info, device, force=True)
def extend_volume(self): def extend_volume(self):
self.conn.extend_volume(self.connection_info) self.conn.extend_volume(self.connection_info)

View File

@ -102,7 +102,7 @@ class TestBaseBrickConnectorInterface(test_base.StoreBaseTest):
self.mock_object(self.connector.conn, 'disconnect_volume') self.mock_object(self.connector.conn, 'disconnect_volume')
self.connector.disconnect_volume(fake_device) self.connector.disconnect_volume(fake_device)
self.connector.conn.disconnect_volume.assert_called_once_with( self.connector.conn.disconnect_volume.assert_called_once_with(
self.connection_info, fake_device) self.connection_info, fake_device, force=True)
def test_extend_volume(self): def test_extend_volume(self):
self.mock_object(self.connector.conn, 'extend_volume') self.mock_object(self.connector.conn, 'extend_volume')

View File

@ -328,7 +328,7 @@ class TestCinderStoreBase(object):
fake_connector.connect_volume.assert_called_once_with( fake_connector.connect_volume.assert_called_once_with(
mock.ANY) mock.ANY)
fake_connector.disconnect_volume.assert_called_once_with( fake_connector.disconnect_volume.assert_called_once_with(
mock.ANY, fake_devinfo) mock.ANY, fake_devinfo, force=True)
fake_conn_obj.assert_called_once_with( fake_conn_obj.assert_called_once_with(
mock.ANY, root_helper, conn=mock.ANY, mock.ANY, root_helper, conn=mock.ANY,
use_multipath=multipath_supported) use_multipath=multipath_supported)

View File

@ -0,0 +1,11 @@
security:
- |
Cinder glance_store driver: in order to avoid a situation where a
leftover device could be mapped to a different volume than the one
intended, the cinder glance_store driver now instructs the os-brick
library to force detach volumes, which ensures that devices are
removed from the host.
See `Bug #2004555
<https://bugs.launchpad.net/glance-store/+bug/2004555>`_ for more
information about this issue.