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']
|
||||
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
|
||||
|
||||
self.stubs.Set(host.Host, "get_capabilities",
|
||||
|
|
|
@ -5866,11 +5866,17 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
for dt in g.domtype:
|
||||
if dt != CONF.libvirt.virt_type:
|
||||
continue
|
||||
instance_cap = (
|
||||
fields.Architecture.canonicalize(g.arch),
|
||||
fields.HVType.canonicalize(dt),
|
||||
fields.VMMode.canonicalize(g.ostype))
|
||||
instance_caps.append(instance_cap)
|
||||
try:
|
||||
instance_cap = (
|
||||
fields.Architecture.canonicalize(g.arch),
|
||||
fields.HVType.canonicalize(dt),
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue