Merge "Avoid crashing while getting libvirt capabilities with unknown arch names" into stable/rocky
This commit is contained in:
commit
accbb17592
|
@ -16165,6 +16165,14 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
guest.domtype = ['kvm']
|
guest.domtype = ['kvm']
|
||||||
caps.guests.append(guest)
|
caps.guests.append(guest)
|
||||||
|
|
||||||
|
# Include one that is not known to nova to make sure it
|
||||||
|
# does not trip us up.
|
||||||
|
guest = vconfig.LibvirtConfigGuest()
|
||||||
|
guest.ostype = 'hvm'
|
||||||
|
guest.arch = 'itanic'
|
||||||
|
guest.domtype = ['kvm']
|
||||||
|
caps.guests.append(guest)
|
||||||
|
|
||||||
return caps
|
return caps
|
||||||
|
|
||||||
self.stubs.Set(host.Host, "get_capabilities",
|
self.stubs.Set(host.Host, "get_capabilities",
|
||||||
|
|
|
@ -5866,11 +5866,17 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||||
for dt in g.domtype:
|
for dt in g.domtype:
|
||||||
if dt != CONF.libvirt.virt_type:
|
if dt != CONF.libvirt.virt_type:
|
||||||
continue
|
continue
|
||||||
instance_cap = (
|
try:
|
||||||
fields.Architecture.canonicalize(g.arch),
|
instance_cap = (
|
||||||
fields.HVType.canonicalize(dt),
|
fields.Architecture.canonicalize(g.arch),
|
||||||
fields.VMMode.canonicalize(g.ostype))
|
fields.HVType.canonicalize(dt),
|
||||||
instance_caps.append(instance_cap)
|
fields.VMMode.canonicalize(g.ostype))
|
||||||
|
instance_caps.append(instance_cap)
|
||||||
|
except exception.InvalidArchitectureName:
|
||||||
|
# NOTE(danms): Libvirt is exposing a guest arch that nova
|
||||||
|
# does not even know about. Avoid aborting here and
|
||||||
|
# continue to process the rest.
|
||||||
|
pass
|
||||||
|
|
||||||
return instance_caps
|
return instance_caps
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue