Skip to content

Commit

Permalink
libvirt: vif tests should use a flavor object
Browse files Browse the repository at this point in the history
Some part of the tests code are still using a dictionary
to simulate flavor data structure.
However, it has been in fact changed to being a nova object.

Changing these part to be an object.

Change-Id: Idb0e1ca8fa09e1a36ba0f62175f01ee856e3f31b
  • Loading branch information
vladikr committed Nov 19, 2014
1 parent 76c0522 commit df9b719
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions nova/tests/unit/virt/libvirt/test_vif.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from nova import exception
from nova.network import linux_net
from nova.network import model as network_model
from nova import objects
from nova import test
from nova.tests.unit.virt.libvirt import fakelibvirt
from nova import utils
Expand Down Expand Up @@ -348,15 +349,18 @@ def _get_conf(self):
return conf

def _get_instance_xml(self, driver, vif, image_meta=None):
default_inst_type = {
'memory_mb': 128, 'root_gb': 0, 'deleted_at': None,
'name': 'm1.micro', 'deleted': 0, 'created_at': None,
'ephemeral_gb': 0, 'updated_at': None,
'disabled': False, 'vcpus': 1,
'swap': 0, 'rxtx_factor': 1.0, 'is_public': True,
'flavorid': '1', 'vcpu_weight': None, 'id': 2,
'extra_specs': dict(self.bandwidth)
}
default_inst_type = objects.Flavor(name='m1.small',
memory_mb=128,
vcpus=1,
root_gb=0,
ephemeral_gb=0,
swap=0,
extra_specs=dict(self.bandwidth),
deleted_at=None,
deleted=0,
created_at=None, flavorid=1,
is_public=True, vcpu_weight=None,
id=2, disabled=False, rxtx_factor=1.0)
conf = self._get_conf()
nic = driver.get_config(self.instance, vif, image_meta,
default_inst_type, CONF.libvirt.virt_type)
Expand Down

0 comments on commit df9b719

Please sign in to comment.