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
This commit is contained in:
parent
e030fa908f
commit
664d363857
@ -41,7 +41,10 @@ argument of type `os_vif.objects.VIF`::
|
|||||||
|
|
||||||
instance_uuid = 'd7a730ca-3c28-49c3-8f26-4662b909fe8a'
|
instance_uuid = 'd7a730ca-3c28-49c3-8f26-4662b909fe8a'
|
||||||
instance = nova_objects.Instance.get_by_uuid(instance_uuid)
|
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')
|
subnet = vif_objects.Subnet(cidr='192.168.1.0/24')
|
||||||
subnets = vif_objects.SubnetList([subnet])
|
subnets = vif_objects.SubnetList([subnet])
|
||||||
|
@ -29,9 +29,3 @@ class InstanceInfo(base.VersionedObject):
|
|||||||
# The project/tenant ID that owns the instance
|
# The project/tenant ID that owns the instance
|
||||||
'project_id': fields.StringField(),
|
'project_id': fields.StringField(),
|
||||||
}
|
}
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_nova_instance(cls, instance):
|
|
||||||
return cls(uuid=instance.uuid,
|
|
||||||
name=instance.name,
|
|
||||||
project_id=instance.project_id)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user