Skip to content

Commit

Permalink
Handle disabled CPU features to fix live migration failures
Browse files Browse the repository at this point in the history
Change-Id: Iaf14ca97cfac99dd280d1114123f2d4bb6292b63
  • Loading branch information
andrewbonney committed Oct 6, 2020
1 parent 7d55610 commit 9d11ce6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nova/virt/libvirt/config.py
Expand Up @@ -674,11 +674,13 @@ def __init__(self, name=None, **kwargs):
**kwargs)

self.name = name
self.policy = "require"

def parse_dom(self, xmldoc):
super(LibvirtConfigCPUFeature, self).parse_dom(xmldoc)

self.name = xmldoc.get("name")
self.policy = xmldoc.get("policy", "require")

def format_dom(self):
ft = super(LibvirtConfigCPUFeature, self).format_dom()
Expand Down Expand Up @@ -730,7 +732,8 @@ def parse_dom(self, xmldoc):
elif c.tag == "feature":
f = LibvirtConfigCPUFeature()
f.parse_dom(c)
self.add_feature(f)
if f.policy != "disable":
self.add_feature(f)

def format_dom(self):
cpu = super(LibvirtConfigCPU, self).format_dom()
Expand All @@ -753,7 +756,8 @@ def format_dom(self):

# sorting the features to allow more predictable tests
for f in sorted(self.features, key=lambda x: x.name):
cpu.append(f.format_dom())
if f.policy != "disable":
cpu.append(f.format_dom())

return cpu

Expand Down

0 comments on commit 9d11ce6

Please sign in to comment.