This commit is contained in:
Cerberus
2011-02-07 17:39:53 -06:00
parent a40f604155
commit 203c94c89c
4 changed files with 13 additions and 5 deletions

View File

@@ -379,7 +379,7 @@ class API(base.Base):
kwargs = {'method': method, 'args': params}
return rpc.call(context, queue, kwargs)
def _cast_scheduler_message(self, context, args)
def _cast_scheduler_message(self, context, args):
"""Generic handler for RPC calls to the scheduler"""
rpc.cast(context, FLAGS.scheduler_topic, args)

View File

@@ -220,6 +220,14 @@ class VMOps(object):
logging.debug(_("Finished snapshot and upload for VM %s"), instance)
def transfer_disk(self, instance, dest):
""" Copies a VHD from one host machine to another
:param instance: the instance that owns the VHD in question
:param dest: the destination host machine
"""
def resize(self, instance, flavor):
"""Resize a running instance by changing it's RAM and disk size """
raise NotImplementedError()

View File

@@ -193,7 +193,7 @@ class XenAPIConnection(object):
self._vmops.power_on(instance)
def transfer_disk(self, instance, dest, callback):
self._vmops.transfer_disk(dest)
self._vmops.transfer_disk(instance, dest)
def suspend(self, instance, callback):
"""suspend the specified instance"""

View File

@@ -46,11 +46,11 @@ def _key_scan_and_add(host):
null.close()
known_hosts.close()
def transfer_vhd(host, vhd_path):
def transfer_file(host, file_path):
"""Rsyncs a VHD to an adjacent host"""
_key_scan_and_add(host)
if subprocess.call([RSYNC, vhd_path, "%s:/root/" % host]) != 0:
if subprocess.call([RSYNC, file_path, "%s:/root/" % host]) != 0:
raise Exception("Unexpected VHD transfer failure")
if __name__ == '__main__':
XenAPIPlugin.dispatch({'transfer_vhd': transfer_vhd})
XenAPIPlugin.dispatch({'transfer_file': transfer_file})