Esempio n. 1
0
 def __update_meta(self, master_image, images_dict, regionobj):
     image = images_dict[master_image.name]
     glancesync_ami.update_kernelramdisk_id(
         image, master_image, images_dict)
     metadata_set = regionobj.target['metadata_set']
     if metadata_set:
         for prop in metadata_set:
             if prop in master_image.user_properties:
                 # This values are already updated
                 if prop == 'kernel_id' or prop == 'ramdisk_id':
                     continue
                 image.user_properties[prop] = \
                     master_image.user_properties[prop]
             else:
                 if prop in image.user_properties:
                     del image.user_properties[prop]
     image.is_public = master_image.is_public
     regionobj.target['facade'].update_metadata(regionobj, image)
Esempio n. 2
0
 def __update_meta(self, master_image, images_dict, regionobj):
     image = images_dict[master_image.name]
     glancesync_ami.update_kernelramdisk_id(image, master_image,
                                            images_dict)
     metadata_set = regionobj.target['metadata_set']
     if metadata_set:
         for prop in metadata_set:
             if prop in master_image.user_properties:
                 # This values are already updated
                 if prop == 'kernel_id' or prop == 'ramdisk_id':
                     continue
                 image.user_properties[prop] = \
                     master_image.user_properties[prop]
             else:
                 if prop in image.user_properties:
                     del image.user_properties[prop]
     image.is_public = master_image.is_public
     regionobj.target['facade'].update_metadata(regionobj, image)
Esempio n. 3
0
    def __upload_image(self, master_image, images_dict, regionobj):
        new_image = copy.deepcopy(master_image)
        # update kernel_id & ramdisk_id if necessary.
        glancesync_ami.update_kernelramdisk_id(new_image, master_image,
                                               images_dict)
        # filter properties to upload
        metadata_set = set(regionobj.target['metadata_set'])
        properties = set(new_image.user_properties.keys())
        if len(metadata_set) > 0:
            diff = properties - metadata_set - set(['kernel_id', 'ramdisk_id'])
            for p in diff:
                del new_image.user_properties[p]

        # upload
        uuid = regionobj.target['facade'].upload_image(regionobj, new_image)

        # update images_dict with the new image (needed for pending_ami images)
        images_dict[new_image.name] = GlanceSyncImage(new_image.name, uuid,
                                                      regionobj.fullname)
Esempio n. 4
0
    def __upload_image(self, master_image, images_dict, regionobj):
        new_image = copy.deepcopy(master_image)
        # update kernel_id & ramdisk_id if necessary.
        glancesync_ami.update_kernelramdisk_id(
            new_image, master_image, images_dict)
        # filter properties to upload
        metadata_set = regionobj.target['metadata_set']
        properties = list(new_image.user_properties.keys())
        for p in properties:
            if p not in metadata_set:
                del new_image.user_properties[p]

        # upload
        uuid = regionobj.target['facade'].upload_image(
            regionobj, new_image)

        # update images_dict with the new image (needed for pending_ami images)
        images_dict[new_image.name] = GlanceSyncImage(
            new_image.name, uuid, regionobj.fullname)