Accomodate disappearance of nova.storage
Nova commit e6cdd1693ba843e1c8dcccbde3af20f62eb0b5a2 removed nova.storage, whose linuxscsi module we were using for echo_scsi_command. This change set incorporates the logic of that method - which is just a call to 'tee -a' via nova.utils.execute - into a local helper method. Change-Id: I4a494c41c7014473dadd94f84f1a04ddb3b88c34
This commit is contained in:
parent
cc07d32cd4
commit
06c6a8adce
@ -179,7 +179,7 @@ class TestNPIVAdapter(test.TestCase):
|
||||
'b': None}}}
|
||||
|
||||
mock_mapping = mock.MagicMock()
|
||||
mock_mapping.client_adapter.wwpns = set(['a', 'b'])
|
||||
mock_mapping.client_adapter.wwpns = {'a', 'b'}
|
||||
|
||||
mock_vios = mock.MagicMock()
|
||||
mock_vios.vfc_mappings = [mock_mapping]
|
||||
|
@ -24,7 +24,7 @@ The PowerVM Nova Compute service runs on the management partition.
|
||||
"""
|
||||
import glob
|
||||
from nova import exception
|
||||
from nova.storage import linuxscsi
|
||||
from nova import utils
|
||||
import os
|
||||
from os import path
|
||||
from pypowervm.wrappers import logical_partition as pvm_lpar
|
||||
@ -37,6 +37,15 @@ import retrying
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def _tee_as_root(fpath, payload):
|
||||
"""Executes 'echo $payload | sudo tee -a $fpath'.
|
||||
|
||||
:param fpath: The file system path to which to tee.
|
||||
:param payload: The string to pipe to the file.
|
||||
"""
|
||||
utils.execute('tee', '-a', fpath, process_input=payload, run_as_root=True)
|
||||
|
||||
|
||||
def get_mgmt_partition(adapter):
|
||||
"""Get the LPAR wrapper for this host's management partition.
|
||||
|
||||
@ -87,7 +96,7 @@ def discover_vscsi_disk(mapping, scan_timeout=10):
|
||||
for scanpath in glob.glob(
|
||||
'/sys/bus/vio/devices/%x/host*/scsi_host/host*/scan' % lslot):
|
||||
# echo '- - -' | sudo tee -a /path/to/scan
|
||||
linuxscsi.echo_scsi_command(scanpath, '- - -')
|
||||
_tee_as_root(scanpath, '- - -')
|
||||
|
||||
# Now see if our device showed up. If so, we can reliably match it based
|
||||
# on its Linux ID, which ends with the disk's UDID.
|
||||
@ -151,7 +160,7 @@ def remove_block_dev(devpath, scan_timeout=10):
|
||||
LOG.debug("Deleting block device %(devpath)s from the management "
|
||||
"partition via special file %(delpath)s.",
|
||||
{'devpath': devpath, 'delpath': delpath})
|
||||
linuxscsi.echo_scsi_command(delpath, '1')
|
||||
_tee_as_root(delpath, '1')
|
||||
|
||||
# The bus scan is asynchronous. Need to poll, waiting for the device to
|
||||
# disappear. Stop when stat raises OSError (dev file not found) - which is
|
||||
|
Loading…
x
Reference in New Issue
Block a user