libvirt utils doesn't canonicalize the image architecture property

Bug #1418675 reported by Markus Zoeller (markus_z)
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Markus Zoeller (markus_z)

Bug Description

If the image has an architecture property, the libvirt utils do *not* canonicalize that.

``utils.get_arch(image_meta)`` can possibly return "S390X" (<= upper case). The canonicalized version should be "s390x" (<= lower case).

This will be an issue when a user adds the property "architecture=S390X" on an image.

I used "S390X" as an arbitrary example. The real issue here is the lower case and upper case thing.

See method ``get_arch(image_meta)`` in https://github.com/openstack/nova/blob/master/nova/virt/libvirt/utils.py#L557
See method ``canonicalize(name)`` in https://github.com/openstack/nova/blob/master/nova/compute/arch.py#L147

Tags: libvirt
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

On a second thought, is maybe glance supposed to lower-case all added/updated properties on an image?

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

@Markus, Let me ask a slightly different question, is there enough information in the Nova REST API / CLI response that helps the user to quickly figure out what they did wrong?

thanks,
dims

Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

@dims: The error I got in the CLI when I try to boot an instance with the upper case property was "No valid host was found. There are not enough hosts available." In the stack trace of the logs of the compute node where the failure happens is more information available.
I'm not sure if a user could/should be blamed here. From a user point of view I would expect that "x86" is the same as "X86".

To clarify what I would expect:
    def test_get_arch(self):
        image_meta = {'properties': {'architecture': "X86_64"}} # upper case!
        image_arch = libvirt_utils.get_arch(image_meta)
        self.assertEqual(arch.X86_64, image_arch)

This fails right now with ``MismatchError: 'x86_64' != 'X86_64'``

I ran into this issue while working on this patch set: https://review.openstack.org/#/c/149653/7/nova/virt/libvirt/driver.py,cm
The libvirt driver contains multiple IF switches where the architecture is used to determine how the domain XML has to be build. The upper case "X" will lead to a failed spawn of an instance.

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

Changed in nova:
assignee: nobody → Markus Zoeller (mzoeller)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit 175b22637f5b2c13480f47f2956ca4b049da6ec5
Author: Markus Zoeller <email address hidden>
Date: Mon Feb 9 10:42:44 2015 +0100

    libvirt: utils canonicalize now the image architecture property

    If the image has an architecture property, the libvirt utils did *not*
    canonicalize that. The architecture switches in the libvirt driver
    could then produce a wrong domain xml.
    This patch canonicalizes the image architecture property.

    Closes-Bug: 1418675

    Change-Id: Ie88c8e79f6b31f48ad0e98215bd7f6dbca93119a

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-3
status: Fix Committed → Fix Released
Revision history for this message
Feilong Wang (flwang) wrote :

It doesn't affect Glance. so I'm going to remove it from glance list.

no longer affects: glance
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-3 → 2015.1.0
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.