summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmando Migliaccio <armando.migliaccio@citrix.com>2011-03-28 12:08:43 +0100
committerArmando Migliaccio <armando.migliaccio@citrix.com>2011-03-28 12:08:43 +0100
commit184fa8239d54d20ff294cdb019d07989ed3d6c4d (patch)
tree78027b0132063fe2caf5ea926dcaf984927f7b8c
parentdf946c08acba6fe1234b13f04d3c46c3973647c2 (diff)
downloadnova-184fa8239d54d20ff294cdb019d07989ed3d6c4d.tar.gz
nova-184fa8239d54d20ff294cdb019d07989ed3d6c4d.tar.xz
nova-184fa8239d54d20ff294cdb019d07989ed3d6c4d.zip
addressed termies review (third round)
-rw-r--r--nova/tests/db/fakes.py63
-rw-r--r--nova/tests/test_xenapi.py26
-rw-r--r--nova/virt/xenapi/fake.py2
-rw-r--r--nova/virt/xenapi/vmops.py3
4 files changed, 46 insertions, 48 deletions
diff --git a/nova/tests/db/fakes.py b/nova/tests/db/fakes.py
index f7610aa56..7ddfe377a 100644
--- a/nova/tests/db/fakes.py
+++ b/nova/tests/db/fakes.py
@@ -56,39 +56,36 @@ def stub_out_db_instance_api(stubs, injected=True):
flavorid=5,
rxtx_cap=5)}
- flat_network_fields = {
- 'id': 'fake_flat',
- 'bridge': 'xenbr0',
- 'label': 'fake_flat_network',
- 'netmask': '255.255.255.0',
- 'cidr_v6': 'fe80::a00:0/120',
- 'netmask_v6': '120',
- 'gateway': '10.0.0.1',
- 'gateway_v6': 'fe80::a00:1',
- 'broadcast': '10.0.0.255',
- 'dns': '10.0.0.2',
- 'ra_server': None,
- 'injected': injected}
-
- vlan_network_fields = {
- 'id': 'fake_vlan',
- 'bridge': 'br111',
- 'label': 'fake_vlan_network',
- 'netmask': '255.255.255.0',
- 'cidr_v6': 'fe80::a00:0/120',
- 'netmask_v6': '120',
- 'gateway': '10.0.0.1',
- 'gateway_v6': 'fe80::a00:1',
- 'broadcast': '10.0.0.255',
- 'dns': '10.0.0.2',
- 'ra_server': None,
- 'vlan': 111,
- 'injected': False}
-
- fixed_ip_fields = {
- 'address': '10.0.0.3',
- 'address_v6': 'fe80::a00:3',
- 'network_id': 'fake_flat'}
+ flat_network_fields = {'id': 'fake_flat',
+ 'bridge': 'xenbr0',
+ 'label': 'fake_flat_network',
+ 'netmask': '255.255.255.0',
+ 'cidr_v6': 'fe80::a00:0/120',
+ 'netmask_v6': '120',
+ 'gateway': '10.0.0.1',
+ 'gateway_v6': 'fe80::a00:1',
+ 'broadcast': '10.0.0.255',
+ 'dns': '10.0.0.2',
+ 'ra_server': None,
+ 'injected': injected}
+
+ vlan_network_fields = {'id': 'fake_vlan',
+ 'bridge': 'br111',
+ 'label': 'fake_vlan_network',
+ 'netmask': '255.255.255.0',
+ 'cidr_v6': 'fe80::a00:0/120',
+ 'netmask_v6': '120',
+ 'gateway': '10.0.0.1',
+ 'gateway_v6': 'fe80::a00:1',
+ 'broadcast': '10.0.0.255',
+ 'dns': '10.0.0.2',
+ 'ra_server': None,
+ 'vlan': 111,
+ 'injected': False}
+
+ fixed_ip_fields = {'address': '10.0.0.3',
+ 'address_v6': 'fe80::a00:3',
+ 'network_id': 'fake_flat'}
class FakeModel(object):
"""Stubs out for model."""
diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py
index 9fdd1feeb..bc1469223 100644
--- a/nova/tests/test_xenapi.py
+++ b/nova/tests/test_xenapi.py
@@ -287,19 +287,19 @@ class XenAPIVMTestCase(test.TestCase):
key = 'vm-data/networking/aabbccddeeff'
xenstore_value = xenstore_data[key]
tcpip_data = ast.literal_eval(xenstore_value)
- self.assertEquals(tcpip_data, {
- 'label': 'fake_flat_network',
- 'broadcast': '10.0.0.255',
- 'ips': [{'ip': '10.0.0.3',
- 'netmask':'255.255.255.0',
- 'enabled':'1'}],
- 'ip6s': [{'ip': 'fe80::a8bb:ccff:fedd:eeff',
- 'netmask': '120',
- 'enabled': '1',
- 'gateway': 'fe80::a00:1'}],
- 'mac': 'aa:bb:cc:dd:ee:ff',
- 'dns': ['10.0.0.2'],
- 'gateway': '10.0.0.1'})
+ self.assertEquals(tcpip_data,
+ {'label': 'fake_flat_network',
+ 'broadcast': '10.0.0.255',
+ 'ips': [{'ip': '10.0.0.3',
+ 'netmask':'255.255.255.0',
+ 'enabled':'1'}],
+ 'ip6s': [{'ip': 'fe80::a8bb:ccff:fedd:eeff',
+ 'netmask': '120',
+ 'enabled': '1',
+ 'gateway': 'fe80::a00:1'}],
+ 'mac': 'aa:bb:cc:dd:ee:ff',
+ 'dns': ['10.0.0.2'],
+ 'gateway': '10.0.0.1'})
def check_vm_params_for_windows(self):
self.assertEquals(self.vm['platform']['nx'], 'true')
diff --git a/nova/virt/xenapi/fake.py b/nova/virt/xenapi/fake.py
index d084c725f..d79312a60 100644
--- a/nova/virt/xenapi/fake.py
+++ b/nova/virt/xenapi/fake.py
@@ -60,7 +60,7 @@ from nova import exception
from nova import log as logging
-_CLASSES = ['host', 'network', 'session', 'SR', 'VBD',\
+_CLASSES = ['host', 'network', 'session', 'SR', 'VBD', \
'PBD', 'VDI', 'VIF', 'PIF', 'VM', 'VLAN', 'task']
_db_content = {}
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 08046318e..147419f90 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -668,7 +668,7 @@ class VMOps(object):
self._wait_with_callback(instance.id, task, callback)
def suspend(self, instance, callback):
- """Suspend the specified instance"""
+ """Suspend the specified instance."""
vm_ref = self._get_vm_opaque_ref(instance)
task = self._session.call_xenapi('Async.VM.suspend', vm_ref)
self._wait_with_callback(instance.id, task, callback)
@@ -686,6 +686,7 @@ class VMOps(object):
- shutdown the instance VM.
- set 'bootlock' to prevent the instance from starting in rescue.
- spawn a rescue VM (the vm name-label will be instance-N-rescue).
+
"""
rescue_vm_ref = VMHelper.lookup(self._session,
"%s-rescue" % instance.name)