Prevent the migration of VM with 'optimize' False in VM metadata

This patch adds the functionality to filter out VMs which have
metadata field 'optimize' set to False. This patch implements the
functionality for basic_consolidation strategy.

Change-Id: Iaf7b63e09534e4a67406e7f092242558b78c0bde
Partially-Implements: BP audit-tag-vm-metadata
This commit is contained in:
Pradeep Kumar Singh
2017-03-27 08:05:18 +00:00
parent a644600a18
commit a2cb02a861
17 changed files with 131 additions and 91 deletions

View File

@@ -48,7 +48,7 @@ class Instance(compute_resource.ComputeResource):
"disk": wfields.IntegerField(),
"disk_capacity": wfields.NonNegativeIntegerField(),
"vcpus": wfields.NonNegativeIntegerField(),
"metadata": wfields.DictField(),
"metadata": wfields.JsonField(),
}
def accept(self, visitor):

View File

@@ -235,3 +235,10 @@ class ModelRoot(nx.DiGraph, base.Model):
model.add_instance(instance)
return model
@classmethod
def is_isomorphic(cls, G1, G2):
def node_match(node1, node2):
return node1.as_dict() == node2.as_dict()
return nx.algorithms.isomorphism.isomorph.is_isomorphic(
G1, G2, node_match=node_match)