def pull_backup(user_email): sessname = unique_sessname(user_email) S3Disk.log_info("pulling %s.tar.gz from %s", sessname, JBoxVol.BACKUP_BUCKET) CloudHost.pull_file_from_s3(JBoxVol.BACKUP_BUCKET, sessname + ".tar.gz", metadata_only=False)
def calc_stat(user_email): VolMgr.STATS['num_users'] += 1 sessname = unique_sessname(user_email) k = CloudHost.pull_file_from_s3(JBoxVol.BACKUP_BUCKET, sessname + ".tar.gz", metadata_only=True) if k is not None: VolMgr.STATS['loopback']['sizes'].append(k.size)
def calc_stat(user_email): VolMgr.STATS['num_users'] += 1 sessname = unique_sessname(user_email) k = CloudHost.pull_file_from_s3(JBoxVol.BACKUP_BUCKET, sessname + ".tar.gz", metadata_only=True) if k is not None: VolMgr.STATS['loopback']['sizes'].append(k.size)
def update_user_home_image(fetch=True): img_dir, curr_img = os.path.split(JBoxVol.USER_HOME_IMG) bucket, new_img = JBoxDynConfig.get_user_home_image(CloudHost.INSTALL_ID) new_img_path = os.path.join(img_dir, new_img) if fetch and (not os.path.exists(new_img_path)): VolMgr.log_debug("fetching new image to %s", new_img_path) k = CloudHost.pull_file_from_s3(bucket, new_img_path) if k is not None: VolMgr.log_debug("fetched new user home image") if os.path.exists(new_img_path): VolMgr.log_debug("set new image to %s", new_img_path) JBoxVol.USER_HOME_IMG = new_img_path return True return False
def update_user_home_image(fetch=True): img_dir, curr_img = os.path.split(JBoxVol.USER_HOME_IMG) bucket, new_img = JBoxDynConfig.get_user_home_image( CloudHost.INSTALL_ID) new_img_path = os.path.join(img_dir, new_img) if fetch and (not os.path.exists(new_img_path)): VolMgr.log_debug("fetching new image to %s", new_img_path) k = CloudHost.pull_file_from_s3(bucket, new_img_path) if k is not None: VolMgr.log_debug("fetched new user home image") if os.path.exists(new_img_path): VolMgr.log_debug("set new image to %s", new_img_path) JBoxVol.USER_HOME_IMG = new_img_path return True return False
def pull_backup(user_email): sessname = unique_sessname(user_email) S3Disk.log_info("pulling %s.tar.gz from %s", sessname, JBoxVol.BACKUP_BUCKET) CloudHost.pull_file_from_s3(JBoxVol.BACKUP_BUCKET, sessname + ".tar.gz", metadata_only=False)
def pull_from_s3(local_file, metadata_only=False): if JBoxVol.BACKUP_BUCKET is None: return None return CloudHost.pull_file_from_s3(JBoxVol.BACKUP_BUCKET, local_file, metadata_only=metadata_only)
def pull_from_s3(local_file, metadata_only=False): if JBoxVol.BACKUP_BUCKET is None: return None return CloudHost.pull_file_from_s3(JBoxVol.BACKUP_BUCKET, local_file, metadata_only=metadata_only)