def fix_private_images_without_repr(private_images, prov, accounts):
    """
    See if image has a machine request
    See if we can 'piece it together'
    """
    for img in private_images:
        machine_requests = MachineRequest.objects.filter(
            new_machine_provider=prov, new_machine_name=img.name)
        for mr in machine_requests:
            print "Machine Request found matching name %s of image %s" \
                    % (img.name, img.id)
            if mr.status != 'completed':
                print "Processing machine with image %s" % img.id
                process_machine_request(mr, img.id)
            pm = mr.new_machine
            if mr.new_machine_visibility.lower() == 'public':
                make_public(accounts.image_manager, img, pm)
                continue
            #Private or selected access..
            access_list = parse_list(mr.access_list, prov.id)
            #Fix on the image
            tenant_list = sync_image_access_list(accounts,
                                                 img,
                                                 names=access_list)
            #Fix on the database
            make_private(accounts.image_manager, img, pm, tenant_list)
def fix_private_images_without_repr(private_images, prov, accounts):
    """
    See if image has a machine request
    See if we can 'piece it together'
    """
    for img in private_images:
        machine_requests = MachineRequest.objects.filter(
                new_machine_provider=prov,
                new_machine_name=img.name)
        for mr in machine_requests:
            print "Machine Request found matching name %s of image %s" \
                    % (img.name, img.id)
            if mr.status != 'completed':
                print "Processing machine with image %s" % img.id
                process_machine_request(mr, img.id)
            pm = mr.new_machine
            if mr.new_machine_visibility.lower() == 'public':
                make_public(accounts.image_manager, img, pm)
                continue
            #Private or selected access..
            access_list  = parse_list(mr.access_list, prov.id)
            #Fix on the image
            tenant_list = sync_image_access_list(
                    accounts, img, names=access_list)
            #Fix on the database
            make_private(accounts.image_manager, img, pm, tenant_list)
Exemple #3
0
def process_request(new_image_id, machine_request_id):
    # if ipdb:
    #    ipdb.set_trace()
    machine_request = MachineRequest.objects.get(id=machine_request_id)
    invalidate_machine_cache(machine_request)
    set_machine_request_metadata(machine_request, new_image_id)
    process_machine_request(machine_request, new_image_id)
    send_image_request_email(
        machine_request.new_machine_owner, machine_request.new_machine, machine_request.new_machine_name
    )
Exemple #4
0
def process_request(new_image_id, machine_request_id):
    #if ipdb:
    #    ipdb.set_trace()
    machine_request = MachineRequest.objects.get(id=machine_request_id)
    machine_request.status = 'processing - %s' % new_image_id
    machine_request.save()
    invalidate_machine_cache(machine_request)
    set_machine_request_metadata(machine_request, new_image_id)
    process_machine_request(machine_request, new_image_id)
    send_image_request_email(machine_request.new_machine_owner,
                             machine_request.new_machine,
                             machine_request.new_machine_name)
 def _process_new_update_request(self, machine, 
         new_name, new_version, uuid_suffix, update_date=None):
     if not update_date:
         update_date = self.start_time
     instance = self._new_instance_of(machine, update_date)
     update_request_helper = CoreMachineRequestHelper(
             new_name, update_date, new_version, False, instance)
     core_request = update_request_helper.to_core_machine_request()
     process_machine_request(core_request, 'machine-%s' % uuid_suffix,
             update_cloud=False)
     new_machine = core_request.new_machine
     return new_machine
 def _process_new_fork_request(self, machine,
         new_name, new_version, uuid_suffix, fork_date=None):
     if not fork_date:
         fork_date = self.start_time
     instance = self._new_instance_of(machine, fork_date)
     #Create a MachineRequest for newly created Instance
     new_app_request_helper = CoreMachineRequestHelper(
             new_name, fork_date, new_version, True, instance)
     new_app_request = new_app_request_helper.to_core_machine_request()
     process_machine_request(new_app_request, 'machine-%s' % uuid_suffix,
             update_cloud=False)
     new_machine = new_app_request.new_machine
     return new_machine
Exemple #7
0
def process_request(new_image_id, machine_request_id):
    """
    First, save the new image id so we can resume in case of failure.
    Then, Invalidate the machine cache to avoid a cache miss.
    Then, process the request by creating/updating all core objects related
    to this specific machine request.
    Finally, update the metadata on the provider.
    """
    machine_request = MachineRequest.objects.get(id=machine_request_id)
    machine_request.status = 'processing - %s' % new_image_id
    machine_request.save()
    # TODO: Best if we could 'broadcast' this to all running
    # Apache WSGI procs && celery 'imaging' procs
    process_machine_request(machine_request, new_image_id)
    return new_image_id
Exemple #8
0
def process_request(new_image_id, machine_request_id):
    """
    First, save the new image id so we can resume in case of failure.
    Then, Invalidate the machine cache to avoid a cache miss.
    Then, process the request by creating/updating all core objects related
    to this specific machine request.
    Finally, update the metadata on the provider.
    """
    machine_request = MachineRequest.objects.get(id=machine_request_id)
    machine_request.status = 'processing - %s' % new_image_id
    machine_request.save()
    #TODO: Best if we could 'broadcast' this to all running
    # Apache WSGI procs && celery 'imaging' procs
    invalidate_machine_cache(machine_request)
    process_machine_request(machine_request, new_image_id)
    return new_image_id
Exemple #9
0
def process_request(new_image_id, machine_request_id):
    # if ipdb:
    #    ipdb.set_trace()
    machine_request = MachineRequest.objects.get(id=machine_request_id)
    machine_request.status = "processing - %s" % new_image_id
    machine_request.save()
    invalidate_machine_cache(machine_request)

    # NOTE: This is taken care of indirectly by process_machine_request
    # and more directly by core/application.py:save_app_data
    # set_machine_request_metadata(machine_request, new_image_id)

    process_machine_request(machine_request, new_image_id)
    send_image_request_email(
        machine_request.new_machine_owner, machine_request.new_machine, machine_request.new_machine_name
    )
    return new_image_id
 def _process_new_update_request(self,
                                 machine,
                                 new_name,
                                 new_version,
                                 uuid_suffix,
                                 update_date=None):
     if not update_date:
         update_date = self.start_time
     instance = self._new_instance_of(machine, update_date)
     update_request_helper = CoreMachineRequestHelper(
         new_name, update_date, new_version, False, instance)
     core_request = update_request_helper.to_core_machine_request()
     process_machine_request(core_request,
                             'machine-%s' % uuid_suffix,
                             update_cloud=False)
     new_machine = core_request.new_machine
     return new_machine
Exemple #11
0
def process_request(new_image_id, machine_request_id):
    #if ipdb:
    #    ipdb.set_trace()
    machine_request = MachineRequest.objects.get(id=machine_request_id)
    machine_request.status = 'processing - %s' % new_image_id
    machine_request.save()
    invalidate_machine_cache(machine_request)

    #NOTE: This is taken care of indirectly by process_machine_request
    # and more directly by core/application.py:save_app_data
    #set_machine_request_metadata(machine_request, new_image_id)

    process_machine_request(machine_request, new_image_id)
    send_image_request_email(machine_request.new_machine_owner,
                             machine_request.new_machine,
                             machine_request.new_machine_name)
    return new_image_id
 def _process_new_fork_request(self,
                               machine,
                               new_name,
                               new_version,
                               uuid_suffix,
                               fork_date=None):
     if not fork_date:
         fork_date = self.start_time
     instance = self._new_instance_of(machine, fork_date)
     #Create a MachineRequest for newly created Instance
     new_app_request_helper = CoreMachineRequestHelper(
         new_name, fork_date, new_version, True, instance)
     new_app_request = new_app_request_helper.to_core_machine_request()
     process_machine_request(new_app_request,
                             'machine-%s' % uuid_suffix,
                             update_cloud=False)
     new_machine = new_app_request.new_machine
     return new_machine