+invirt-images (0.0.3) unstable; urgency=low
+
+ * Add status messages; continue after failed downloads.
+
+ -- Quentin Smith <quentin@mit.edu> Sun, 31 Jan 2010 21:13:32 -0500
+
invirt-images (0.0.2) unstable; urgency=low
* Architecture: all
from invirt import database
import os
+import sys
import subprocess
import random
import string
"""
full_uri = os.path.join(cdrom.mirror.uri_prefix, cdrom.uri_suffix)
temp_file = tempfile.mkstemp()[1]
+ if verbosity > 0:
+ print >>sys.stderr, "Fetching image %s from %s to %s" % (cdrom.cdrom_id, full_uri, temp_file)
try:
if full_uri.startswith('rsync://'):
if subprocess.call(['rsync', '--no-motd', '-tLP', full_uri, temp_file],
return
temp_file = fetch_image(cdrom)
try:
- cdrom_size = '%sM' % math.ceil((float(os.stat(temp_file).st_size) / (1024 * 1024)))
+ st_size = os.stat(temp_file).st_size
+ if not st_size:
+ print >>sys.stderr, "Failed to fetch %s" % cdrom.cdrom_id
+ return
+ cdrom_size = '%sM' % math.ceil((float(st_size) / (1024 * 1024)))
new_lv = lvcreate_random('image-new_%s_%%s' % cdrom.cdrom_id, cdrom_size)
copy_file(temp_file, '/dev/xenvg/%s' % new_lv)
lvrename_random('image_%s' % cdrom.cdrom_id, 'image-old_%s_%%s' % cdrom.cdrom_id)