summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorArmando Migliaccio <armando.migliaccio@citrix.com>2010-12-18 00:50:49 +0000
committerArmando Migliaccio <armando.migliaccio@citrix.com>2010-12-18 00:50:49 +0000
commitca81b0c12a3853942e9ce85154c38dad381ead0e (patch)
tree4be3f2d43c2099f6d1a9c6604bf5447ade973ce0 /nova/virt
parent336bdb43ecc7d53d58d99f80877b10b57d4a6195 (diff)
fixed unittests and further clean-up post-eventlet merge
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/xenapi/__init__.py2
-rw-r--r--nova/virt/xenapi/network_utils.py2
-rw-r--r--nova/virt/xenapi/vm_utils.py3
-rw-r--r--nova/virt/xenapi/vmops.py8
-rw-r--r--nova/virt/xenapi/volume_utils.py2
-rw-r--r--nova/virt/xenapi/volumeops.py1
-rw-r--r--nova/virt/xenapi_conn.py8
7 files changed, 13 insertions, 13 deletions
diff --git a/nova/virt/xenapi/__init__.py b/nova/virt/xenapi/__init__.py
index c7038deae..c75162f08 100644
--- a/nova/virt/xenapi/__init__.py
+++ b/nova/virt/xenapi/__init__.py
@@ -20,7 +20,7 @@
"""
-class HelperBase():
+class HelperBase(object):
"""
The base for helper classes. This adds the XenAPI class attribute
"""
diff --git a/nova/virt/xenapi/network_utils.py b/nova/virt/xenapi/network_utils.py
index c292383b6..e783120fe 100644
--- a/nova/virt/xenapi/network_utils.py
+++ b/nova/virt/xenapi/network_utils.py
@@ -29,7 +29,7 @@ class NetworkHelper(HelperBase):
The class that wraps the helper methods together.
"""
def __init__(self):
- return
+ super(NetworkHelper, self).__init__()
@classmethod
def find_network_with_bridge(cls, session, bridge):
diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py
index 57d419773..911fcc9b2 100644
--- a/nova/virt/xenapi/vm_utils.py
+++ b/nova/virt/xenapi/vm_utils.py
@@ -24,7 +24,6 @@ import urllib
from xml.dom import minidom
from nova import flags
-from nova import utils
from nova.auth.manager import AuthManager
from nova.compute import instance_types
from nova.compute import power_state
@@ -48,7 +47,7 @@ class VMHelper(HelperBase):
The class that wraps the helper methods together.
"""
def __init__(self):
- return
+ super(VMHelper, self).__init__()
@classmethod
def create_vm(cls, session, instance, kernel, ramdisk):
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 0be4ed07d..aa3a3ae53 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -22,7 +22,6 @@ import logging
from nova import db
from nova import context
-from nova import flags
from nova import exception
from nova import utils
@@ -78,6 +77,7 @@ class VMOps(object):
logging.info('Spawning VM %s created %s.', instance.name,
vm_ref)
+ # NOTE(armando): Do we really need to do this in virt?
timer = utils.LoopingCall(f=None)
def _wait_for_boot():
@@ -88,7 +88,8 @@ class VMOps(object):
if state == power_state.RUNNING:
logging.debug('Instance %s: booted', instance['name'])
timer.stop()
- except:
+ except Exception, exc:
+ logging.warn(exc)
logging.exception('instance %s: failed to boot',
instance['name'])
db.instance_set_state(context.get_admin_context(),
@@ -131,6 +132,7 @@ class VMOps(object):
self._session.wait_for_task(task)
except self.XenAPI.Failure, exc:
logging.warn(exc)
+ # VM Destroy
try:
task = self._session.call_xenapi('Async.VM.destroy', vm)
self._session.wait_for_task(task)
@@ -149,7 +151,7 @@ class VMOps(object):
"""Return data about VM diagnostics"""
vm = VMHelper.lookup(self._session, instance_id)
if vm is None:
- raise exception.Exception("Instance not found %s" % instance_id)
+ raise exception.NotFound("Instance not found %s" % instance_id)
rec = self._session.get_xenapi().VM.get_record(vm)
return VMHelper.compile_diagnostics(self._session, rec)
diff --git a/nova/virt/xenapi/volume_utils.py b/nova/virt/xenapi/volume_utils.py
index 255f23d88..5366078ce 100644
--- a/nova/virt/xenapi/volume_utils.py
+++ b/nova/virt/xenapi/volume_utils.py
@@ -43,7 +43,7 @@ class VolumeHelper(HelperBase):
The class that wraps the helper methods together.
"""
def __init__(self):
- return
+ super(VolumeHelper, self).__init__()
@classmethod
def create_iscsi_storage(cls, session, info, label, description):
diff --git a/nova/virt/xenapi/volumeops.py b/nova/virt/xenapi/volumeops.py
index 6c7516073..9dbb1bb14 100644
--- a/nova/virt/xenapi/volumeops.py
+++ b/nova/virt/xenapi/volumeops.py
@@ -19,7 +19,6 @@ Management class for Storage-related functions (attach, detach, etc).
"""
import logging
-from nova import flags
from nova.virt.xenapi.vm_utils import VMHelper
from nova.virt.xenapi.volume_utils import VolumeHelper
from nova.virt.xenapi.volume_utils import StorageError
diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py
index 207222744..2a8614cfd 100644
--- a/nova/virt/xenapi_conn.py
+++ b/nova/virt/xenapi_conn.py
@@ -119,11 +119,11 @@ class XenAPIConnection(object):
def spawn(self, instance):
""" Create VM instance """
- return self._vmops.spawn(instance)
+ self._vmops.spawn(instance)
def reboot(self, instance):
""" Reboot VM instance """
- return self._vmops.reboot(instance)
+ self._vmops.reboot(instance)
def destroy(self, instance):
""" Destroy VM instance """
@@ -143,13 +143,13 @@ class XenAPIConnection(object):
def attach_volume(self, instance_name, device_path, mountpoint):
""" Attach volume storage to VM instance """
- return self._volumeops.attach_volume(instance_name,
+ self._volumeops.attach_volume(instance_name,
device_path,
mountpoint)
def detach_volume(self, instance_name, mountpoint):
""" Detach volume storage to VM instance """
- return self._volumeops.detach_volume(instance_name, mountpoint)
+ self._volumeops.detach_volume(instance_name, mountpoint)
class XenAPISession(object):