summaryrefslogtreecommitdiff
path: root/nova/virt/disk/mount/api.py
diff options
context:
space:
mode:
authorMichael Still <mikal@stillhq.com>2017-09-27 06:59:51 +1000
committerSean Dague <sean@dague.net>2017-10-24 12:24:16 +0000
commitb12f0a6026d9407d396c29b7a8bc9e9fdf31fe8d (patch)
tree33c1d90e874f2e30a9c3814bce66ad3a1839b3a5 /nova/virt/disk/mount/api.py
parentc7dae4e19bfb45a3cd6cbf78fa771f5e34e2651c (diff)
Move kpartx calls to privsep.
Notes
Notes (review): Code-Review+2: Sean Dague <sean@dague.net> Verified+1: IBM PowerKVM CI <kvmpower@linux.vnet.ibm.com> Verified+1: IBM zKVM CI <zkvm-ci@linux.vnet.ibm.com> Code-Review+2: Dan Smith <dms@danplanet.com> Workflow+1: Dan Smith <dms@danplanet.com> Code-Review+1: jichenjc <jichenjc@cn.ibm.com> Verified+1: IBM zVM CI <zvmosci@us.ibm.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 25 Oct 2017 18:59:54 +0000 Reviewed-on: https://review.openstack.org/500354 Project: openstack/nova Branch: refs/heads/master
Diffstat (limited to 'nova/virt/disk/mount/api.py')
-rw-r--r--nova/virt/disk/mount/api.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/nova/virt/disk/mount/api.py b/nova/virt/disk/mount/api.py
index 8e87051..97ac6d2 100644
--- a/nova/virt/disk/mount/api.py
+++ b/nova/virt/disk/mount/api.py
@@ -23,7 +23,6 @@ from oslo_utils import importutils
23from nova import exception 23from nova import exception
24from nova.i18n import _ 24from nova.i18n import _
25import nova.privsep.fs 25import nova.privsep.fs
26from nova import utils
27from nova.virt.image import model as imgmodel 26from nova.virt.image import model as imgmodel
28 27
29LOG = logging.getLogger(__name__) 28LOG = logging.getLogger(__name__)
@@ -200,8 +199,7 @@ class Mount(object):
200 # Note kpartx can output warnings to stderr and succeed 199 # Note kpartx can output warnings to stderr and succeed
201 # Also it can output failures to stderr and "succeed" 200 # Also it can output failures to stderr and "succeed"
202 # So we just go on the existence of the mapped device 201 # So we just go on the existence of the mapped device
203 _out, err = utils.trycmd('kpartx', '-a', self.device, 202 _out, err = nova.privsep.fs.create_device_maps(self.device)
204 run_as_root=True, discard_warnings=True)
205 203
206 @loopingcall.RetryDecorator( 204 @loopingcall.RetryDecorator(
207 max_retry_count=MAX_FILE_CHECKS - 1, 205 max_retry_count=MAX_FILE_CHECKS - 1,
@@ -241,7 +239,7 @@ class Mount(object):
241 return 239 return
242 LOG.debug("Unmap dev %s", self.device) 240 LOG.debug("Unmap dev %s", self.device)
243 if self.partition and not self.automapped: 241 if self.partition and not self.automapped:
244 utils.execute('kpartx', '-d', self.device, run_as_root=True) 242 nova.privsep.fs.remove_device_maps(self.device)
245 self.mapped = False 243 self.mapped = False
246 self.automapped = False 244 self.automapped = False
247 245