processutlis.execute not usable in windows

Bug #1209410 reported by Pedro Navarro Pérez on 2013-08-07
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Undecided
Alessandro Pilotti
OpenStack Compute (nova)
Undecided
Matt Riedemann
oslo-incubator
High
Davanum Srinivas (DIMS)

Bug Description

In Havana time, in the execute method of processutils the condition (os.geteuid() != 0) was added in line 130

    if run_as_root and os.geteuid() != 0:
        if not root_helper:
            raise NoRootWrapSpecified(
                message=('Command requested root, but did not specify a root '
                         'helper.'))
        cmd = shlex.split(root_helper) + list(cmd)

That provokes the next error in Windows:

2013-08-08 00:27:09.937 2148 TRACE cinder.openstack.common.rpc.amqp (stdout, stderr) = processutils.execute(*cmd, **kwargs)
2013-08-08 00:27:09.937 2148 TRACE cinder.openstack.common.rpc.amqp File "C:\Users\Pedro\dev\cinder\cinder\openstack\common\processutils.py", line 130, in execute
2013-08-08 00:27:09.937 2148 TRACE cinder.openstack.common.rpc.amqp if run_as_root and os.geteuid() != 0:
2013-08-08 00:27:09.937 2148 TRACE cinder.openstack.common.rpc.amqp AttributeError: 'module' object has no attribute 'geteuid'

This should be removed in order to this code be used in nova and cinder windows-based drivers

Fix proposed to branch: master
Review: https://review.openstack.org/40773

Changed in oslo:
assignee: nobody → Davanum Srinivas (DIMS) (dims-v)
status: New → In Progress

Pedro,

Can you please check if the code change in the review will work for you?

Pedro Navarro Pérez (pednape) wrote :

Hi Davanum,

Your fix is working. Thanks

Mark McLoughlin (markmc) on 2013-08-20
Changed in oslo:
importance: Undecided → Low
importance: Low → High

Reviewed: https://review.openstack.org/40773
Committed: http://github.com/openstack/oslo-incubator/commit/d6a963e911b8456c06dceb5ee3cc88a70c08bf82
Submitter: Jenkins
Branch: master

commit d6a963e911b8456c06dceb5ee3cc88a70c08bf82
Author: Davanum Srinivas <email address hidden>
Date: Wed Aug 7 20:17:10 2013 -0400

    Fix processutils.execute errors on windows

    Added a check for existence of geteuid

    Fixes LP# 1209410

    Change-Id: I75a7343aa93761a7dcec3640245c7de945b9ce0a

Changed in oslo:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-09-05
Changed in oslo:
milestone: none → havana-3
status: Fix Committed → Fix Released

Fix proposed to branch: master
Review: https://review.openstack.org/47795

Changed in cinder:
assignee: nobody → Alessandro Pilotti (alexpilotti)
status: New → In Progress

Fix proposed to branch: master
Review: https://review.openstack.org/48166

Reviewed: https://review.openstack.org/48166
Committed: http://github.com/openstack/cinder/commit/5bac47ae22ff1dd1e9f1ec8617f723475281188b
Submitter: Jenkins
Branch: master

commit 5bac47ae22ff1dd1e9f1ec8617f723475281188b
Author: Alessandro Pilotti <email address hidden>
Date: Wed Sep 25 02:30:33 2013 +0300

    Fix processutils.execute errors on windows

    Added a check for existence of geteuid.

    This fix is related to oslo-incubator commit:
    d6a963e911b8456c06dceb5ee3cc88a70c08bf82

    Fixes bug #1209410

    Change-Id: Idd716a2104ba3fa24610825ce4bf9c8e2c6d490b

Changed in cinder:
status: In Progress → Fix Committed
Pedro Navarro Pérez (pednape) wrote :

I think this bug affects to nova too, since Hyper-V drivers uses processutils when launching convertions. https://github.com/openstack/nova/blob/master/nova/virt/hyperv/vmops.py#L299

Hi Pedro, we didn't face issues with Nova yet related to this bug, but it definitely should be updated there as well.

Matt Riedemann (mriedem) on 2013-09-28
Changed in nova:
status: New → Triaged
milestone: none → havana-rc1
Matt Riedemann (mriedem) wrote :

Nova patch is here: https://review.openstack.org/#/c/48806/

There are lots of hits for run_as_root=True in nova for utils.execute.

Changed in nova:
status: Triaged → In Progress
assignee: nobody → Matt Riedemann (mriedem)

Reviewed: https://review.openstack.org/48806
Committed: http://github.com/openstack/nova/commit/5fc059f13d4f0b2a5fef63095ea3fc710d46b5b3
Submitter: Jenkins
Branch: master

commit 5fc059f13d4f0b2a5fef63095ea3fc710d46b5b3
Author: Matt Riedemann <email address hidden>
Date: Sat Sep 28 12:59:49 2013 -0700

    Fix processutils.execute errors on windows

    Added a check for existence of geteuid.

    This fix is related to oslo-incubator commit:
    d6a963e911b8456c06dceb5ee3cc88a70c08bf82

    Closes-Bug: #1209410

    Change-Id: Ibaa1f061bf161768890d4708dc945180121726f9

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-10-03
Changed in nova:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-04
Changed in cinder:
milestone: none → havana-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in oslo:
milestone: havana-3 → 2013.2
Thierry Carrez (ttx) on 2013-10-17
Changed in cinder:
milestone: havana-rc1 → 2013.2
Thierry Carrez (ttx) on 2013-10-17
Changed in nova:
milestone: havana-rc1 → 2013.2
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers