summaryrefslogtreecommitdiffstats
path: root/plugins/xenserver/xenapi
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/xenserver/xenapi')
-rwxr-xr-xplugins/xenserver/xenapi/etc/xapi.d/plugins/bittorrent7
-rw-r--r--plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py8
2 files changed, 10 insertions, 5 deletions
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/bittorrent b/plugins/xenserver/xenapi/etc/xapi.d/plugins/bittorrent
index 8ae93698d..70c62ec23 100755
--- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/bittorrent
+++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/bittorrent
@@ -49,12 +49,11 @@ def _make_torrent_cache():
return torrent_cache_path
-def _fetch_torrent_file(torrent_cache_path, image_id, torrent_base_url):
+def _fetch_torrent_file(torrent_cache_path, image_id, torrent_url):
torrent_path = os.path.join(
torrent_cache_path, image_id + '.torrent')
if not os.path.exists(torrent_path):
- torrent_url = torrent_base_url + "/%s.torrent" % image_id
logging.info("Downloading %s" % torrent_url)
# Write contents to temporary path to ensure we don't have partially
@@ -250,7 +249,7 @@ def _make_seed_cache():
return seed_cache_path
-def download_vhd(session, image_id, torrent_base_url, torrent_seed_duration,
+def download_vhd(session, image_id, torrent_url, torrent_seed_duration,
torrent_seed_chance, torrent_max_last_accessed,
torrent_listen_port_start, torrent_listen_port_end,
torrent_download_stall_cutoff, uuid_stack, sr_path,
@@ -266,7 +265,7 @@ def download_vhd(session, image_id, torrent_base_url, torrent_seed_duration,
_reap_old_torrent_files(torrent_cache_path, torrent_max_last_accessed)
torrent_path = _fetch_torrent_file(
- torrent_cache_path, image_id, torrent_base_url)
+ torrent_cache_path, image_id, torrent_url)
staging_path = utils.make_staging_area(sr_path)
try:
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py b/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py
index 95f01bba3..a15ace92a 100644
--- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py
+++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py
@@ -46,7 +46,13 @@ def _link(src, dst):
def _rename(src, dst):
LOG.info("Renaming file '%s' -> '%s'" % (src, dst))
- os.rename(src, dst)
+ try:
+ os.rename(src, dst)
+ except OSError, e:
+ if e.errno == errno.EXDEV:
+ LOG.error("Invalid cross-device link. Perhaps %s and %s should "
+ "be symlinked on the same filesystem?" % (src, dst))
+ raise
def make_subprocess(cmdline, stdout=False, stderr=False, stdin=False,