summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCerberus <matt.dietz@rackspace.com>2011-02-07 17:12:15 -0600
committerCerberus <matt.dietz@rackspace.com>2011-02-07 17:12:15 -0600
commita40f6041556ec09a1cb79c2b8abcec7fa70e72bf (patch)
tree730c406c06d9edba93857bb5502b380407a0e457
parente59c62efe5492e59fcc26b7b74f6ac2daa0caabe (diff)
downloadnova-a40f6041556ec09a1cb79c2b8abcec7fa70e72bf.tar.gz
nova-a40f6041556ec09a1cb79c2b8abcec7fa70e72bf.tar.xz
nova-a40f6041556ec09a1cb79c2b8abcec7fa70e72bf.zip
Some stuff
-rw-r--r--nova/virt/xenapi_conn.py2
-rw-r--r--plugins/xenserver/xenapi/etc/xapi.d/plugins/data_transfer12
2 files changed, 13 insertions, 1 deletions
diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py
index acfde6caf..726106b37 100644
--- a/nova/virt/xenapi_conn.py
+++ b/nova/virt/xenapi_conn.py
@@ -193,7 +193,7 @@ class XenAPIConnection(object):
self._vmops.power_on(instance)
def transfer_disk(self, instance, dest, callback):
- self._vmops.transfer_disk()
+ self._vmops.transfer_disk(dest)
def suspend(self, instance, callback):
"""suspend the specified instance"""
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/data_transfer b/plugins/xenserver/xenapi/etc/xapi.d/plugins/data_transfer
index d310a65d9..cde7bb823 100644
--- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/data_transfer
+++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/data_transfer
@@ -28,10 +28,13 @@ import XenAPIPlugin
SSH_HOSTS = '/root/.ssh/known_hosts'
DEVNULL = '/dev/null'
KEYSCAN = '/usr/bin/ssh-keyscan'
+RSYNC = '/usr/bin/rsync'
def _key_scan_and_add(host):
"""SSH scans a remote host and writes the SSH key out to known_hosts"""
+ # Touch the file if it doesn't yet exist
open(SSH_HOSTS, 'a').close()
+
null = open(DEVNULL, 'w')
known_hosts = open(SSH_HOSTS, 'a')
key = subprocess.Popen(['/usr/bin/ssh-keyscan', '-t', 'rsa', host],
@@ -42,3 +45,12 @@ def _key_scan_and_add(host):
known_hosts.write(key)
null.close()
known_hosts.close()
+
+def transfer_vhd(host, vhd_path):
+ """Rsyncs a VHD to an adjacent host"""
+ _key_scan_and_add(host)
+ if subprocess.call([RSYNC, vhd_path, "%s:/root/" % host]) != 0:
+ raise Exception("Unexpected VHD transfer failure")
+
+if __name__ == '__main__':
+ XenAPIPlugin.dispatch({'transfer_vhd': transfer_vhd})