Changeset 2974 for trunk


Ignore:
Timestamp:
Jan 31, 2010, 9:14:30 PM (15 years ago)
Author:
gdb
Message:

Add status messages; continue after failed downloads.

Location:
trunk/packages/invirt-images
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-images/debian/changelog

    r1854 r2974  
     1invirt-images (0.0.3) unstable; urgency=low
     2
     3  * Add status messages; continue after failed downloads.
     4
     5 -- Quentin Smith <quentin@mit.edu>  Sun, 31 Jan 2010 21:13:32 -0500
     6
    17invirt-images (0.0.2) unstable; urgency=low
    28
  • trunk/packages/invirt-images/invirt-images

    r1365 r2974  
    33from invirt import database
    44import os
     5import sys
    56import subprocess
    67import random
     
    110111    full_uri = os.path.join(cdrom.mirror.uri_prefix, cdrom.uri_suffix)
    111112    temp_file = tempfile.mkstemp()[1]
     113    if verbosity > 0:
     114        print >>sys.stderr, "Fetching image %s from %s to %s" % (cdrom.cdrom_id, full_uri, temp_file)
    112115    try:
    113116        if full_uri.startswith('rsync://'):
     
    142145    temp_file = fetch_image(cdrom)
    143146    try:
    144         cdrom_size = '%sM' % math.ceil((float(os.stat(temp_file).st_size) / (1024 * 1024)))
     147        st_size = os.stat(temp_file).st_size
     148        if not st_size:
     149            print >>sys.stderr, "Failed to fetch %s" % cdrom.cdrom_id
     150            return
     151        cdrom_size = '%sM' % math.ceil((float(st_size) / (1024 * 1024)))
    145152        new_lv = lvcreate_random('image-new_%s_%%s' % cdrom.cdrom_id, cdrom_size)
    146153        copy_file(temp_file, '/dev/xenvg/%s' % new_lv)
Note: See TracChangeset for help on using the changeset viewer.