summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-07-18 16:58:23 -0700
committerVishvananda Ishaya <vishvananda@gmail.com>2011-07-18 16:58:23 -0700
commitb5ceab5a46ffac11cb229de86c49802bba3fa383 (patch)
tree62459fbead53019efe4efc3e762fe1e07e84a450 /nova/virt
parent67e5492d6723a00b0ad5d7e8c44f5762a9b0a206 (diff)
parent77db06c908f9c08c80beb11241c0e23247129ad6 (diff)
merged trunk
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/driver.py4
-rw-r--r--nova/virt/libvirt/connection.py30
-rw-r--r--nova/virt/xenapi/vmops.py12
3 files changed, 26 insertions, 20 deletions
diff --git a/nova/virt/driver.py b/nova/virt/driver.py
index 3c4a073bf..178279d31 100644
--- a/nova/virt/driver.py
+++ b/nova/virt/driver.py
@@ -197,7 +197,7 @@ class ComputeDriver(object):
def reset_network(self, instance):
"""reset networking for specified instance"""
- raise NotImplementedError()
+ pass
def ensure_filtering_rules_for_instance(self, instance_ref):
"""Setting up filtering rules and waiting for its completion.
@@ -244,7 +244,7 @@ class ComputeDriver(object):
def inject_network_info(self, instance, nw_info):
"""inject network info for specified instance"""
- raise NotImplementedError()
+ pass
def poll_rescued_instances(self, timeout):
"""Poll for rescued instances"""
diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py
index 6bf2cf2b8..edabea46d 100644
--- a/nova/virt/libvirt/connection.py
+++ b/nova/virt/libvirt/connection.py
@@ -331,7 +331,7 @@ class LibvirtConnection(driver.ComputeDriver):
if os.path.exists(target):
shutil.rmtree(target)
- @exception.wrap_exception
+ @exception.wrap_exception()
def attach_volume(self, instance_name, device_path, mountpoint):
virt_dom = self._lookup_by_name(instance_name)
mount_device = mountpoint.rpartition("/")[2]
@@ -375,7 +375,7 @@ class LibvirtConnection(driver.ComputeDriver):
if doc is not None:
doc.freeDoc()
- @exception.wrap_exception
+ @exception.wrap_exception()
def detach_volume(self, instance_name, mountpoint):
virt_dom = self._lookup_by_name(instance_name)
mount_device = mountpoint.rpartition("/")[2]
@@ -384,7 +384,7 @@ class LibvirtConnection(driver.ComputeDriver):
raise exception.DiskNotFound(location=mount_device)
virt_dom.detachDevice(xml)
- @exception.wrap_exception
+ @exception.wrap_exception()
def snapshot(self, instance, image_href):
"""Create snapshot from a running VM instance.
@@ -460,7 +460,7 @@ class LibvirtConnection(driver.ComputeDriver):
# Clean up
shutil.rmtree(temp_dir)
- @exception.wrap_exception
+ @exception.wrap_exception()
def reboot(self, instance):
"""Reboot a virtual machine, given an instance reference.
@@ -501,31 +501,31 @@ class LibvirtConnection(driver.ComputeDriver):
timer = utils.LoopingCall(_wait_for_reboot)
return timer.start(interval=0.5, now=True)
- @exception.wrap_exception
+ @exception.wrap_exception()
def pause(self, instance, callback):
"""Pause VM instance"""
dom = self._lookup_by_name(instance.name)
dom.suspend()
- @exception.wrap_exception
+ @exception.wrap_exception()
def unpause(self, instance, callback):
"""Unpause paused VM instance"""
dom = self._lookup_by_name(instance.name)
dom.resume()
- @exception.wrap_exception
+ @exception.wrap_exception()
def suspend(self, instance, callback):
"""Suspend the specified instance"""
dom = self._lookup_by_name(instance.name)
dom.managedSave(0)
- @exception.wrap_exception
+ @exception.wrap_exception()
def resume(self, instance, callback):
"""resume the specified instance"""
dom = self._lookup_by_name(instance.name)
dom.create()
- @exception.wrap_exception
+ @exception.wrap_exception()
def rescue(self, instance):
"""Loads a VM using rescue images.
@@ -563,7 +563,7 @@ class LibvirtConnection(driver.ComputeDriver):
timer = utils.LoopingCall(_wait_for_rescue)
return timer.start(interval=0.5, now=True)
- @exception.wrap_exception
+ @exception.wrap_exception()
def unrescue(self, instance):
"""Reboot the VM which is being rescued back into primary images.
@@ -573,13 +573,13 @@ class LibvirtConnection(driver.ComputeDriver):
"""
self.reboot(instance)
- @exception.wrap_exception
+ @exception.wrap_exception()
def poll_rescued_instances(self, timeout):
pass
# NOTE(ilyaalekseyev): Implementation like in multinics
# for xenapi(tr3buchet)
- @exception.wrap_exception
+ @exception.wrap_exception()
def spawn(self, instance, network_info=None, block_device_mapping=None):
xml = self.to_xml(instance, False, network_info=network_info,
block_device_mapping=block_device_mapping)
@@ -642,7 +642,7 @@ class LibvirtConnection(driver.ComputeDriver):
LOG.info(_('Contents of file %(fpath)s: %(contents)r') % locals())
return contents
- @exception.wrap_exception
+ @exception.wrap_exception()
def get_console_output(self, instance):
console_log = os.path.join(FLAGS.instances_path, instance['name'],
'console.log')
@@ -663,7 +663,7 @@ class LibvirtConnection(driver.ComputeDriver):
return self._dump_file(fpath)
- @exception.wrap_exception
+ @exception.wrap_exception()
def get_ajax_console(self, instance):
def get_open_port():
start_port, end_port = FLAGS.ajaxterm_portrange.split("-")
@@ -704,7 +704,7 @@ class LibvirtConnection(driver.ComputeDriver):
def get_host_ip_addr(self):
return FLAGS.my_ip
- @exception.wrap_exception
+ @exception.wrap_exception()
def get_vnc_console(self, instance):
def get_vnc_port_for_instance(instance_name):
virt_dom = self._lookup_by_name(instance_name)
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 56718f8e8..c332c27b0 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -597,7 +597,9 @@ class VMOps(object):
# No response from the agent
return
resp_dict = json.loads(resp)
- return resp_dict['message']
+ # Some old versions of the Windows agent have a trailing \\r\\n
+ # (ie CRLF escaped) for some reason. Strip that off.
+ return resp_dict['message'].replace('\\r\\n', '')
if timeout:
vm_ref = self._get_vm_opaque_ref(instance)
@@ -662,9 +664,13 @@ class VMOps(object):
# There was some sort of error; the message will contain
# a description of the error.
raise RuntimeError(resp_dict['message'])
- agent_pub = int(resp_dict['message'])
+ # Some old versions of the Windows agent have a trailing \\r\\n
+ # (ie CRLF escaped) for some reason. Strip that off.
+ agent_pub = int(resp_dict['message'].replace('\\r\\n', ''))
dh.compute_shared(agent_pub)
- enc_pass = dh.encrypt(new_pass)
+ # Some old versions of Linux and Windows agent expect trailing \n
+ # on password to work correctly.
+ enc_pass = dh.encrypt(new_pass + '\n')
# Send the encrypted password
password_transaction_id = str(uuid.uuid4())
password_args = {'id': password_transaction_id, 'enc_pass': enc_pass}