libvirt: attaching volume device name should be decided using the same logic as when booting

Bug #1452224 reported by Nikola Đipanov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Maxim Nestratov

Bug Description

libvirt driver needs to use it's own logic for determining the device name that will be persisted in Nova instead of the generic methods in nova.compute.utils, since libvirt cannot really assign the device name to a block device of an instance (it's treated as a ordering hint only), and we need to make sure that information in the Nova DB matches what will be assigned.

We already have this logic in nova.virt.libvirt.blockinfo and is being called for booting instances, however when attaching volumes to an already running instance we rely on nova.compute.utils.get_device_name_for_instance() which will do the wrong thing in a number of cases (for example volumes using different bus (see bug #1379212), instances with an ephemeral disk etc.)

Current master is: 0b23bce359c8c92715695cac7a6eff7c473ad8c2

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/180635

Changed in nova:
assignee: nobody → Nikola Đipanov (ndipanov)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

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

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

commit 94a5793d63a797697fb1f937340cb49b3c7e9787
Author: Nikola Dipanov <email address hidden>
Date: Tue May 5 17:41:11 2015 +0100

    virt: Move building the block_device_info dict into a method

    The block_device_info structure is needed in several places, so it's
    useful to move it into a method and remove the code repetition that is
    all over the place.

    Also make sure there is a single way to get the legacy dict format for
    the drivers that need this (however at this point we should probably
    remove that soon, and convert all the in-tree drivers to expect the new
    format).

    Related-bug: 1231874
    Partial-bug: 1452224

    Change-Id: I608042c58c04f333f6fbb8d9824eb8f3913c6310

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit fb3d3773a2c2b07af2849608f1481c9f37a9ec62
Author: Nikola Dipanov <email address hidden>
Date: Wed May 6 13:56:45 2015 +0100

    libvirt: make default_device_names DRY-er

    Since we now have a reusable method to call to get the block_device_info
    structure that most driver code is designed to work with, we don't need
    to re-write it in the blockinfo code - we can just use it.

    In addition to this - this fixes a (yet unreported) issue that libvirt
    would not consider blank volumes in it's device assignments.

    Related-bug: 1231874
    Partial-bug: 1452224

    Change-Id: I4b9a6fd1b08ff787fdd1226f533f4181fe44b7e9

Matt Riedemann (mriedem)
tags: added: compute libvirt volumes
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit b6733dbdf3d04f4e334f1aeb6ee7ce4b6d1b7b95
Author: Nikola Dipanov <email address hidden>
Date: Tue May 5 16:14:46 2015 +0100

    virt: add get_device_name_for_instance to the base driver class

    Just as libvirt needs to decide on the device names when booting an
    instance (as opposed to them being assigned by the user), the same needs
    to be done when attaching additional volumes to a running instance.

    This patch exposes it on the ComputeDriver base class and makes sure
    that it will be called by the compute manager (and that an appropriate
    fallback will happen if the drivers do not care about overriding this),
    as a pre-req for doing the work in the libvirt driver.

    Partial-bug: 1452224
    Related-bug: 1231874

    Change-Id: I66693a8a6a632b65f930a58905336397ac6c9f29

Changed in nova:
assignee: Nikola Đipanov (ndipanov) → Maxim Nestratov (mnestratov)
Changed in nova:
assignee: Maxim Nestratov (mnestratov) → nobody
Changed in nova:
assignee: nobody → Maxim Nestratov (mnestratov)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

commit c5db407bb22e453a4bca22de1860bb6ce6090782
Author: Nikola Dipanov <email address hidden>
Date: Wed May 6 18:08:26 2015 +0100

    libvirt: implement get_device_name_for_instance

    We implement the method above with the purpose of using the
    nova.libvirt.blockinfo primitives (which match how libvirt itself works),
    to decide on which device name to use for an instance.

    With this change - we will be using the libvirt local logic to decide on
    the volume device name instead of relying on
    nova.compute.utils.get_device_name_for_instance() which will do wrong
    things in a number of cases.

    Closes-bug: 1452224
    Related-bug: 1231874

    Change-Id: I33d7363c018fc4e5e9f190486d5556363852badb

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → liberty-3
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/229609

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/229610

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/229611

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/229613

Thierry Carrez (ttx)
Changed in nova:
milestone: liberty-3 → 12.0.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/kilo)

Change abandoned by Matt Riedemann (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/229609
Reason: This didn't make test_stamp_pattern magically start working in the kilo compat job.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Matt Riedemann (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/229610
Reason: This didn't make test_stamp_pattern magically start working in the kilo compat job.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Matt Riedemann (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/229611
Reason: This didn't make test_stamp_pattern magically start working in the kilo compat job.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Matt Riedemann (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/229613
Reason: This didn't make test_stamp_pattern magically start working in the kilo compat job.

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.