reviewed the FIXMEs, and spotted an uncaught exception in volume_utils...yay!

This commit is contained in:
Armando Migliaccio
2010-12-16 18:44:42 +00:00
parent e0b5318e54
commit 73e1126bc0
3 changed files with 11 additions and 20 deletions

View File

@@ -25,8 +25,6 @@ from nova import utils
from nova.api.ec2 import cloud from nova.api.ec2 import cloud
from nova.auth import manager from nova.auth import manager
from nova.virt import libvirt_conn from nova.virt import libvirt_conn
from nova.virt.xenapi import fake
from nova.virt.xenapi import volume_utils
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
flags.DECLARE('instances_path', 'nova.compute.manager') flags.DECLARE('instances_path', 'nova.compute.manager')

View File

@@ -58,21 +58,12 @@ class FakeSessionForVolumeTests(fake.SessionBase):
def __init__(self, uri): def __init__(self, uri):
super(FakeSessionForVolumeTests, self).__init__(uri) super(FakeSessionForVolumeTests, self).__init__(uri)
def VBD_plug(self, _1, _2): def VBD_plug(self, _1, ref):
#FIXME(armando):make proper plug rec = fake.get_record('VBD', ref)
pass rec['currently-attached'] = True
def PBD_unplug(self, _1, _2):
#FIXME(armando):make proper unplug
pass
def SR_forget(self, _1, _2):
#FIXME(armando):make proper forget
pass
def VDI_introduce(self, _1, uuid, _2, _3, _4, _5, def VDI_introduce(self, _1, uuid, _2, _3, _4, _5,
_6, _7, _8, _9, _10, _11): _6, _7, _8, _9, _10, _11):
#FIXME(armando):make proper introduce
valid_vdi = False valid_vdi = False
refs = fake.get_all('VDI') refs = fake.get_all('VDI')
for ref in refs: for ref in refs:
@@ -93,6 +84,9 @@ class FakeSessionForVolumeFailedTests(FakeSessionForVolumeTests):
# This is for testing failure # This is for testing failure
raise fake.Failure([['INVALID_VDI', 'session', self._session]]) raise fake.Failure([['INVALID_VDI', 'session', self._session]])
def VBD_plug(self, _1, _2): def PBD_unplug(self, _1, ref):
# This is for testing failure rec = fake.get_record('PBD', ref)
raise fake.Failure([['INVALID_VBD', 'session', self._session]]) rec['currently-attached'] = False
def SR_forget(self, _1, ref):
pass

View File

@@ -141,14 +141,13 @@ class XenAPIVolumeTestCase(test.TrialTestCase):
result = conn.attach_volume(instance.name, volume['ec2_id'], result = conn.attach_volume(instance.name, volume['ec2_id'],
'/dev/sdc') '/dev/sdc')
def check(exc): def check_exception(exc):
""" handler """ """ handler """
if exc: if exc:
pass pass
else: else:
self.fail('Oops, no exception has been raised!') self.fail('Oops, no exception has been raised!')
result.addErrback(check_exception)
result.addErrback(check)
return result return result
def tearDown(self): def tearDown(self):