"injected_files" doesn't work for nova rebuild

Bug #1187629 reported by TonyWang
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Mahesh Panchaksharaiah
tempest
Fix Released
High
Mahesh Panchaksharaiah

Bug Description

nova-compute manager doesn't send the argument "injected_files" to "driver.spawn":

"nova/compute/manager.py"
    def rebuild_instance(self, context, instance, orig_image_ref, image_ref,
                         injected_files, new_pass, orig_sys_metadata=None):

            instance.injected_files = injected_files
            network_info = self.network_api.get_instance_nw_info(context,
                                                                 instance)
            device_info = self._setup_block_device_mapping(context, instance)

            instance = self._instance_update(context,
                                             instance['uuid'],
                                             task_state=task_states.
                                                 REBUILD_SPAWNING,
                                             expected_task_state=task_states.
                                                 REBUILD_BLOCK_DEVICE_MAPPING)
            # pull in new password here since the original password isn't in
            # the db
            admin_password = new_pass

            self.driver.spawn(context, instance, image_meta,
                              [], admin_password, <--- Here.
                              self._legacy_nw_info(network_info),
                              device_info)

The definition for "driver.spawn" is as following:
"nova/virt/libvirt/driver.py"
def spawn(self, context, instance, image_meta, injected_files,
    admin_password, network_info=None, block_device_info=None):

The possible fix is as following:
            # instance.injected_files = injected_files
            ...
            self.driver.spawn(context, instance, image_meta,
                              # [], admin_password,
                              injected_files, admin_password,
                              self._legacy_nw_info(network_info),
                              device_info)

This should be a bug, and exists in the Folsom and master branch.

Tags: compute
tags: added: compute
removed: folsom rc-3
Revision history for this message
Tiantian Gao (gtt116) wrote :

Since we do not store 'inject_files' information into database, which means that we will lose the information after create_instance finished.

Changed in nova:
assignee: nobody → Mahesh Panchaksharaiah (maheshp)
status: New → In Progress
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/35278

Changed in tempest:
status: New → In Progress
assignee: nobody → Mahesh Panchaksharaiah (maheshp)
Changed in tempest:
importance: Undecided → High
Revision history for this message
Sean Dague (sdague) wrote :

It would be good to ensure this was considered a real bug in Nova by getting a priority set, or someone commenting on the proposed nova patch.

Revision history for this message
Attila Fazekas (afazekas) wrote :

$ glance image-list
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
| befba0fb-4e69-4051-b488-9f140c5325fa | cirros-0.3.1-x86_64-uec | ami | ami | 25165824 | active |
| c91697db-6dab-404f-bccd-5d9ad10e208b | cirros-0.3.1-x86_64-uec-kernel | aki | aki | 4955792 | active |
| eb042039-c4d4-4f49-85ab-dc3de687dc90 | cirros-0.3.1-x86_64-uec-ramdisk | ari | ari | 3714968 | active |
+--------------------------------------+---------------------------------+-------------+------------------+----------+--------+
$ glance image-download befba0fb-4e69-4051-b488-9f140c5325fa >image.img
$ file image.img
image.img: Linux rev 1.0 ext3 filesystem data, UUID=74251bb8-3a28-4a46-9a78-064497b26b9d, volume name "cirros-rootfs"
$ mkdir /tmp/loop
$ sudo mount -o loop image.img /tmp/loop/
$ ls /tmp/loop/
lost+found

It seams still empty.

Keeping test in the repo which referencing to not exiting directory is not good.
Implementing the https://bugs.launchpad.net/tempest/+bug/893843 would be better test for injections.

The other possible solution on the nova side, is creating the directories automatically, but I am not sure what will be the correct permission -- owner/group and/or security label for new directory.

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

Reviewed: https://review.openstack.org/35473
Committed: http://github.com/openstack/tempest/commit/21599a9d463a6b6263f90824c25542f2c175d6c6
Submitter: Jenkins
Branch: master

commit 21599a9d463a6b6263f90824c25542f2c175d6c6
Author: Mahesh Panchaksharaiah <email address hidden>
Date: Wed Jul 3 15:28:58 2013 +0530

    Using relative path for personality file in rebuild server test.

    Personality files with absolute paths e.g /etc/rebuild.txt breaks on the test
    cirros image. This is because cirros has an empty root filesystem.

    fixes lp 1187629

    Change-Id: I5b2b37224b722686c3163214fbd53227ac9ce49f

Changed in tempest:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/35278
Committed: http://github.com/openstack/nova/commit/876bba6d45fac0456679321fd45c3a787113b648
Submitter: Jenkins
Branch: master

commit 876bba6d45fac0456679321fd45c3a787113b648
Author: Mahesh Panchaksharaiah <email address hidden>
Date: Mon Jul 1 18:42:09 2013 +0530

    Personality files can be injected during server rebuild

    Injected files are ignored during a server rebuild, this patch fixes
    this issue.

    Fixes: bug #1187629

    Change-Id: I5e7776de07c8513e36c2926b1fc58c66b382a5ec

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-3
status: Fix Committed → Fix Released
Sean Dague (sdague)
Changed in tempest:
milestone: none → havana-3
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-3 → 2013.2
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.