From 664d363857955599f29d82db104a5641cd1708b3 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 15 Jan 2016 17:30:04 +0000 Subject: [PATCH] remove dependancy on nova object model The from_nova_instance method on the InstanceInfo class creates a dependancy on the nova object model. The os_vif library is intended for use by any compute layer, not just nova, so this method should live in Nova codebase instead. Change-Id: I7e23c266b73aecb96beba7be19b8dc36155b9e2e --- README.rst | 5 ++++- os_vif/objects/instance_info.py | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index eb65d285..e2e6f41f 100644 --- a/README.rst +++ b/README.rst @@ -41,7 +41,10 @@ argument of type `os_vif.objects.VIF`:: instance_uuid = 'd7a730ca-3c28-49c3-8f26-4662b909fe8a' instance = nova_objects.Instance.get_by_uuid(instance_uuid) - instance_info = vif_objects.InstanceInfo.from_nova_instance(instance) + instance_info = vif_objects.InstanceInfo( + uuid=instance.uuid, + name=instance.name, + project_id=instance.project_id) subnet = vif_objects.Subnet(cidr='192.168.1.0/24') subnets = vif_objects.SubnetList([subnet]) diff --git a/os_vif/objects/instance_info.py b/os_vif/objects/instance_info.py index 5ed30eee..57188e4b 100644 --- a/os_vif/objects/instance_info.py +++ b/os_vif/objects/instance_info.py @@ -29,9 +29,3 @@ class InstanceInfo(base.VersionedObject): # The project/tenant ID that owns the instance 'project_id': fields.StringField(), } - - @classmethod - def from_nova_instance(cls, instance): - return cls(uuid=instance.uuid, - name=instance.name, - project_id=instance.project_id)