Combination of 'hw_video_ram' image metadata prop, 'hw_video:ram_max_mb' extra spec raises error

Bug #1896496 reported by Stephen Finucane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Stephen Finucane
Train
Fix Released
Undecided
Unassigned
Ussuri
Fix Released
Undecided
Unassigned
Victoria
Fix Released
Undecided
Unassigned

Bug Description

The 'hw_video_ram' image metadata property is used to configure the amount of memory allocated to VRAM. Using it requires specifying the 'hw_video:ram_max_mb' extra spec or you'll get the following error:

  nova.exception.RequestedVRamTooHigh: The requested amount of video memory 8 is higher than the maximum allowed by flavor 0.

However, specifying these currently results in a libvirt failure.

  ERROR nova.compute.manager [None ...] [instance: 11a71ae4-e410-4856-aeab-eea6ca4784c5] Failed to build and run instance: libvirt.libvirtError: XML error: cannot parse video vram '8192.0'
  ERROR nova.compute.manager [instance: ...] Traceback (most recent call last):
  ERROR nova.compute.manager [instance: ...] File "/opt/stack/nova/nova/compute/manager.py", line 2333, in _build_and_run_instance
  ERROR nova.compute.manager [instance: ...] accel_info=accel_info)
  ERROR nova.compute.manager [instance: ...] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3632, in spawn
  ERROR nova.compute.manager [instance: ...] cleanup_instance_disks=created_disks)
  ERROR nova.compute.manager [instance: ...] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 6527, in _create_domain_and_network
  ERROR nova.compute.manager [instance: ...] cleanup_instance_disks=cleanup_instance_disks)
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  ERROR nova.compute.manager [instance: ...] self.force_reraise()
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  ERROR nova.compute.manager [instance: ...] six.reraise(self.type_, self.value, self.tb)
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/six.py", line 703, in reraise
  ERROR nova.compute.manager [instance: ...] raise value
  ERROR nova.compute.manager [instance: ...] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 6496, in _create_domain_and_network
  ERROR nova.compute.manager [instance: ...] post_xml_callback=post_xml_callback)
  ERROR nova.compute.manager [instance: ...] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 6425, in _create_domain
  ERROR nova.compute.manager [instance: ...] guest = libvirt_guest.Guest.create(xml, self._host)
  ERROR nova.compute.manager [instance: ...] File "/opt/stack/nova/nova/virt/libvirt/guest.py", line 127, in create
  ERROR nova.compute.manager [instance: ...] encodeutils.safe_decode(xml))
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
  ERROR nova.compute.manager [instance: ...] self.force_reraise()
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
  ERROR nova.compute.manager [instance: ...] six.reraise(self.type_, self.value, self.tb)
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/six.py", line 703, in reraise
  ERROR nova.compute.manager [instance: ...] raise value
  ERROR nova.compute.manager [instance: ...] File "/opt/stack/nova/nova/virt/libvirt/guest.py", line 123, in create
  ERROR nova.compute.manager [instance: ...] guest = host.write_instance_config(xml)
  ERROR nova.compute.manager [instance: ...] File "/opt/stack/nova/nova/virt/libvirt/host.py", line 1135, in write_instance_config
  ERROR nova.compute.manager [instance: ...] domain = self.get_connection().defineXML(xml)
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/eventlet/tpool.py", line 190, in doit
  ERROR nova.compute.manager [instance: ...] result = proxy_call(self._autowrap, f, *args, **kwargs)
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/eventlet/tpool.py", line 148, in proxy_call
  ERROR nova.compute.manager [instance: ...] rv = execute(f, *args, **kwargs)
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/eventlet/tpool.py", line 129, in execute
  ERROR nova.compute.manager [instance: ...] six.reraise(c, e, tb)
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/six.py", line 703, in reraise
  ERROR nova.compute.manager [instance: ...] raise value
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/eventlet/tpool.py", line 83, in tworker
  ERROR nova.compute.manager [instance: ...] rv = meth(*args, **kwargs)
  ERROR nova.compute.manager [instance: ...] File "/usr/local/lib/python3.6/dist-packages/libvirt.py", line 3703, in defineXML
  ERROR nova.compute.manager [instance: ...] if ret is None:raise libvirtError('virDomainDefineXML() failed', conn=self)
  ERROR nova.compute.manager [instance: ...] libvirt.libvirtError: XML error: cannot parse video vram '8192.0'
  ERROR nova.compute.manager [instance: ...]

This appears to be a Python 3 thing, introduced by division of ints now returning a float.

Steps to reproduce:

1. Set the 'hw_video_ram' image metadata property on an image:

   $ openstack image set --property hw_video_ram=8 $IMAGE

2. Set the 'hw_video:ram_max_mb' flavor extra spec on a flavor:

   $ openstack flavor update --property hw_video:ram_max_mb=16384 $FLAVOR

3. Create a server using this flavor and image:

   $ openstack server create --image $IMAGE --flavor $FLAVOR ... test-server

Expected result:

Instance should be created with 8MB of VRAM.

Actual result:

Instance fails to create.

Changed in nova:
status: New → Confirmed
importance: Undecided → Low
assignee: nobody → Stephen Finucane (stephenfinucane)
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.opendev.org/753011

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

Reviewed: https://review.opendev.org/753011
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=f2ca089bce842127e7d0644b38a11da9278db8ea
Submitter: Zuul
Branch: master

commit f2ca089bce842127e7d0644b38a11da9278db8ea
Author: Stephen Finucane <email address hidden>
Date: Mon Sep 21 16:11:38 2020 +0100

    libvirt: 'video.vram' property must be an integer

    The 'vram' property of the 'video' device must be an integer else
    libvirt will spit the dummy out, e.g.

      libvirt.libvirtError: XML error: cannot parse video vram '8192.0'

    The division operator in Python 3 results in a float, not an integer
    like in Python 2. Use the truncation division operator instead.

    Change-Id: Iebf678c229da4f455459d068cafeee5f241aea1f
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1896496

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

Fix proposed to branch: stable/victoria
Review: https://review.opendev.org/757616

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

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/757617

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

Fix proposed to branch: stable/train
Review: https://review.opendev.org/757618

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

Reviewed: https://review.opendev.org/757616
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=fd7c66f61c0b07cff82d93e0f884777949170857
Submitter: Zuul
Branch: stable/victoria

commit fd7c66f61c0b07cff82d93e0f884777949170857
Author: Stephen Finucane <email address hidden>
Date: Mon Sep 21 16:11:38 2020 +0100

    libvirt: 'video.vram' property must be an integer

    The 'vram' property of the 'video' device must be an integer else
    libvirt will spit the dummy out, e.g.

      libvirt.libvirtError: XML error: cannot parse video vram '8192.0'

    The division operator in Python 3 results in a float, not an integer
    like in Python 2. Use the truncation division operator instead.

    Change-Id: Iebf678c229da4f455459d068cafeee5f241aea1f
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1896496
    (cherry picked from commit f2ca089bce842127e7d0644b38a11da9278db8ea)

tags: added: in-stable-victoria
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 23.0.0.0rc1

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

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

Reviewed: https://review.opendev.org/c/openstack/nova/+/757617
Committed: https://opendev.org/openstack/nova/commit/121e481a880b48ce800aafdeca0b8b086e2cddf3
Submitter: "Zuul (22348)"
Branch: stable/ussuri

commit 121e481a880b48ce800aafdeca0b8b086e2cddf3
Author: Stephen Finucane <email address hidden>
Date: Mon Sep 21 16:11:38 2020 +0100

    libvirt: 'video.vram' property must be an integer

    The 'vram' property of the 'video' device must be an integer else
    libvirt will spit the dummy out, e.g.

      libvirt.libvirtError: XML error: cannot parse video vram '8192.0'

    The division operator in Python 3 results in a float, not an integer
    like in Python 2. Use the truncation division operator instead.

    Change-Id: Iebf678c229da4f455459d068cafeee5f241aea1f
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1896496
    (cherry picked from commit f2ca089bce842127e7d0644b38a11da9278db8ea)
    (cherry picked from commit fd7c66f61c0b07cff82d93e0f884777949170857)

tags: added: in-stable-ussuri
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/train)

Reviewed: https://review.opendev.org/c/openstack/nova/+/757618
Committed: https://opendev.org/openstack/nova/commit/06b8f1467dc80203098de983cfc335b898440573
Submitter: "Zuul (22348)"
Branch: stable/train

commit 06b8f1467dc80203098de983cfc335b898440573
Author: Stephen Finucane <email address hidden>
Date: Mon Sep 21 16:11:38 2020 +0100

    libvirt: 'video.vram' property must be an integer

    The 'vram' property of the 'video' device must be an integer else
    libvirt will spit the dummy out, e.g.

      libvirt.libvirtError: XML error: cannot parse video vram '8192.0'

    The division operator in Python 3 results in a float, not an integer
    like in Python 2. Use the truncation division operator instead.

    Change-Id: Iebf678c229da4f455459d068cafeee5f241aea1f
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1896496
    (cherry picked from commit f2ca089bce842127e7d0644b38a11da9278db8ea)
    (cherry picked from commit fd7c66f61c0b07cff82d93e0f884777949170857)
    (cherry picked from commit 121e481a880b48ce800aafdeca0b8b086e2cddf3)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 21.2.1

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 20.6.1

This issue was fixed in the openstack/nova 20.6.1 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.