cannot set injected_files in build_instance pre hook

Bug #1518321 reported by Richard Megginson
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Juan Antonio Osorio Robles
Liberty
Fix Released
Medium
Matt Riedemann

Bug Description

http://lists.openstack.org/pipermail/openstack-dev/2015-November/079904.html

I have some code that uses the build_instance pre hook to set
injected_files in the new instance. With the kilo code, the argv[7] was
passed as [] - so I could append/extend this value to add more
injected_files. With the latest code, this is passed as None, so I
can't set it.

Tags: api
Revision history for this message
Richard Megginson (rmeggins) wrote :

from https://github.com/richm/rdo-vm-factory/blob/master/rdo-ipa-nova/novahooks.py#L248::

    def pre(self, *args, **kwargs):
        # args[7] is the injected_files parameter array
        # the value is ('filename', 'base64 encoded contents')
        ipaotp = str(uuid.uuid4())
        ipainject = ('/tmp/ipaotp', base64.b64encode(ipaotp))
        args[7].extend(self.inject_files)
        args[7].append(ipainject)

This doesn't work anymore because args[7] is None.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: nobody → Juan Antonio Osorio Robles (juan-osorio-robles)
status: New → In Progress
Matt Riedemann (mriedem)
tags: added: api
Sean Dague (sdague)
Changed in nova:
importance: Undecided → Medium
Changed in nova:
assignee: Juan Antonio Osorio Robles (juan-osorio-robles) → Matt Riedemann (mriedem)
Matt Riedemann (mriedem)
Changed in nova:
assignee: Matt Riedemann (mriedem) → Juan Antonio Osorio Robles (juan-osorio-robles)
tags: added: liberty-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/248662
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=be4220b37df42d4f99b5f5b8c18245a315228a8a
Submitter: Jenkins
Branch: master

commit be4220b37df42d4f99b5f5b8c18245a315228a8a
Author: Juan Antonio Osorio Robles <email address hidden>
Date: Mon Nov 23 14:24:36 2015 +0200

    Set personality/injected_files to empty list if not specified

    Previously, in the legacy_v2 controller, a "create" would pass an empty
    list as a default for the injected files to the compute API. This
    behavior has changed, and now, if no personality is specified, the
    injected_files parameter ends up as None.

    An empty list coming from the controller enabled us to inject files
    through the hook mechanism. So, having this behavior changed,
    breaks the functionality that was available through this, since we
    now aren't able to use that parameter effectively.

    Change-Id: Iac02c4ba23381889c36d897451b3e89756a75d4d
    Co-Authored-By: Rob Crittenden <email address hidden>
    Closes-Bug: #1518321

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/291407

Matt Riedemann (mriedem)
tags: removed: liberty-backport-potential
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/nova 13.0.0.0rc1

This issue was fixed in the openstack/nova 13.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/liberty)

Reviewed: https://review.openstack.org/291407
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=3cb02be50673f8bff89a83e700a5cac24082c151
Submitter: Jenkins
Branch: stable/liberty

commit 3cb02be50673f8bff89a83e700a5cac24082c151
Author: Juan Antonio Osorio Robles <email address hidden>
Date: Mon Nov 23 14:24:36 2015 +0200

    Set personality/injected_files to empty list if not specified

    Previously, in the legacy_v2 controller, a "create" would pass an empty
    list as a default for the injected files to the compute API. This
    behavior has changed, and now, if no personality is specified, the
    injected_files parameter ends up as None.

    An empty list coming from the controller enabled us to inject files
    through the hook mechanism. So, having this behavior changed,
    breaks the functionality that was available through this, since we
    now aren't able to use that parameter effectively.

    NOTE(mriedem): The test is slightly different from master because
    the stub_out helper didn't exist in stable/liberty.

    Change-Id: Iac02c4ba23381889c36d897451b3e89756a75d4d
    Co-Authored-By: Rob Crittenden <email address hidden>
    Closes-Bug: #1518321
    (cherry picked from commit be4220b37df42d4f99b5f5b8c18245a315228a8a)

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/nova 12.0.3

This issue was fixed in the openstack/nova 12.0.3 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.