diff options
author | Michael Still <mikal@stillhq.com> | 2019-03-29 06:02:03 +0000 |
---|---|---|
committer | Michael Still <mikal@stillhq.com> | 2019-04-01 23:35:53 +0000 |
commit | 3aa702686ba0e01e8931585636da8d9535098923 (patch) | |
tree | 07d6859914842aa4c4aa9dbb8015887d2371549e /nova/virt/powervm | |
parent | 95a87bce9fa7575c172a7d06344fd3cd070db587 (diff) | |
download | nova-3aa702686ba0e01e8931585636da8d9535098923.tar.gz |
Style corrections for privsep usage.
We always import privsep modules like this:
import nova.privsep.libvirt
Not like this:
from nova.privsep import libvirt
This is because it makes it obvious at the caller that a priviledged
operation is occuring:
nova.privsep.libvirt.destroy_root_filesystem()
Not just:
libvirt.destroy_root_filesystem()
This is especially true when the imported module is called "libvirt",
which is a very common term in the codebase and super hard to grep
for specific uses of.
I've corrected the existing style mismatches to make things consistent.
Note that the next patch in this series covers this case with a
hacking check.
Change-Id: Ief177dbcb018da6fbad13bb0ff153fc47292d5b9
Diffstat (limited to 'nova/virt/powervm')
-rw-r--r-- | nova/virt/powervm/mgmt.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/nova/virt/powervm/mgmt.py b/nova/virt/powervm/mgmt.py index dc295f534f..a62fa29bde 100644 --- a/nova/virt/powervm/mgmt.py +++ b/nova/virt/powervm/mgmt.py @@ -31,7 +31,7 @@ from pypowervm.tasks import partition as pvm_par import retrying from nova import exception -from nova.privsep import path as priv_path +import nova.privsep.path LOG = logging.getLogger(__name__) @@ -85,7 +85,7 @@ def discover_vscsi_disk(mapping, scan_timeout=300): for scanpath in glob.glob( '/sys/bus/vio/devices/%x/host*/scsi_host/host*/scan' % lslot): # Writing '- - -' to this sysfs file triggers bus rescan - priv_path.writefile(scanpath, 'a', '- - -') + nova.privsep.path.writefile(scanpath, 'a', '- - -') # 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. @@ -150,7 +150,7 @@ def remove_block_dev(devpath, scan_timeout=10): "partition via special file %(delpath)s.", {'devpath': devpath, 'delpath': delpath}) # Writing '1' to this sysfs file deletes the block device and rescans. - priv_path.writefile(delpath, 'a', '1') + nova.privsep.path.writefile(delpath, 'a', '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 |