Nova rescue fails for libvirt driver with config drive

Bug #1334024 reported by Shraddha Pandhe
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Shraddha Pandhe

Bug Description

I am using config drive to boot VMs. In icehouse, I observed that nova rescue fails and leaves the VM in SHUTOFF state.

Short error log:
instances/270e299b-90b2-46d5-bf9a-e7f6efe3742e/disk.config.rescue': No such file or directory

Difference in Havana and Icehouse code path:

# Havana
# Config drive
 if configdrive.required_by(instance):
      LOG.info(_('Using config drive'), instance=instance)
      extra_md = {}
      if admin_pass:
          extra_md['admin_pass'] = admin_pass

      for f in ('user_name', 'project_name'):
         if hasattr(context, f):
             extra_md[f] = getattr(context, f, None)
         inst_md = instance_metadata.InstanceMetadata(instance,
                content=files, extra_md=extra_md, network_info=network_info)
         with configdrive.ConfigDriveBuilder(instance_md=inst_md) as cdb:
             configdrive_path = basepath(fname='disk.config')
             LOG.info(_('Creating config drive at %(path)s'),
                      {'path': configdrive_path}, instance=instance)

def basepath(fname='', suffix=suffix): << Adds suffix .rescue to disk.config.
    return os.path.join(libvirt_utils.get_instance_path(instance),
                                fname + suffix)

# Icehouse:
# Config drive
if configdrive.required_by(instance):
    LOG.info(_('Using config drive'), instance=instance)
    extra_md = {}
    if admin_pass:
        extra_md['admin_pass'] = admin_pass

    for f in ('user_name', 'project_name'):
        if hasattr(context, f):
            extra_md[f] = getattr(context, f, None)
        inst_md = instance_metadata.InstanceMetadata(instance,
                content=files, extra_md=extra_md, network_info=network_info)
        with configdrive.ConfigDriveBuilder(instance_md=inst_md) as cdb:
            configdrive_path = self._get_disk_config_path(instance)
            LOG.info(_('Creating config drive at %(path)s'),
                         {'path': configdrive_path}, instance=instance)

@staticmethod
def _get_disk_config_path(instance):
    return os.path.join(libvirt_utils.get_instance_path(instance),
                        'disk.config')

The suffix .rescue is missed here and hence, original disk.config is overwritten.

Following change fixed the issue for me:

configdrive_path = self._get_disk_config_path(instance, suffix)

@staticmethod
def _get_disk_config_path(instance, suffix=''):
    return os.path.join(libvirt_utils.get_instance_path(instance),
                            'disk.config' + suffix)

Changed in nova:
assignee: nobody → Shraddha Pandhe (shraddha-pandhe)
description: updated
description: updated
description: updated
description: updated
melanie witt (melwitt)
Changed in nova:
importance: Undecided → Medium
status: New → Confirmed
tags: added: libvirt
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/102645

Changed in nova:
status: Confirmed → In Progress
Michael Still (mikal)
tags: added: icehouse-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit 0d781d41fef329294891fdda0c1dac4add5ce7c3
Author: Shraddha Pandhe <email address hidden>
Date: Wed Jun 25 20:56:33 2014 +0000

    Libvirt: Added suffix to configdrive_path required for rescue

    It was observed that during nova rescue, nova failed to create
    a rescue disk for disk.config. The reason being that .rescue
    suffix was missing from the configdrive path. It was working
    till Havana but the functionality broke in Icehouse. This commit
    fixes the suffix problem.

    Unittests have been added to verify following scenarios:
        1. Make sure that .rescue disks are created when not using
            config drive
        2. Make sure that .rescue disks are created when using
            config drive

    Closes-Bug: #1334024

    Change-Id: I87449ffddd047cb84b7b881757ea4c29927b95da

Changed in nova:
status: In Progress → Fix Committed
Changed in nova:
milestone: none → juno-2
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-2 → 2014.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.