Beispiel #1
0
def get_freed_nodes(iteration):
    try:
        condense_data = json.loads(
            data_storage.get(get_key(iteration, 'source')))
        return condense_data.get(TRANSFER, [])
    except (TypeError, ValueError):
        LOG.error("Something went wrong while retrieving freed nodes from DB, "
                  "check iteration value passed")
Beispiel #2
0
def get_freed_nodes(iteration):
    try:
        condense_data = json.loads(
            data_storage.get(get_key(iteration, 'source')))
        return condense_data.get(TRANSFER, [])
    except (TypeError, ValueError):
        LOG.error("Something went wrong while retrieving freed nodes from DB, "
                  "check iteration value passed")
Beispiel #3
0
    def run(self, **kwargs):
        compute_resource = self.cloud.resources['compute']
        cloud = process.SOURCE
        LOG.debug("getting info on cloud {cloud} "
                  "iteration {iteration} from db".format(
                      cloud=cloud, iteration=self.iteration))
        info = data_storage.get(c_action.get_key(self.iteration, cloud))
        if not info:
            LOG.info("cannot find info in db on {cloud}-{iteration}".format(
                cloud=cloud, iteration=self.iteration))
            return {}

        actions = json.loads(info).get(c_action.CONDENSE)
        LOG.debug("live-migrating vm one by one")
        for vm_id, dest_host in actions:
            compute_resource.live_migrate_vm(vm_id, dest_host)
        return {}
Beispiel #4
0
    def run(self, **kwargs):
        compute_resource = self.cloud.resources['compute']
        cloud = process.SOURCE
        LOG.debug("getting info on cloud {cloud} "
                  "iteration {iteration} from db".format(
                      cloud=cloud,
                      iteration=self.iteration))
        info = data_storage.get(
            c_action.get_key(self.iteration, cloud))
        if not info:
            LOG.info("cannot find info in db on {cloud}-{iteration}".format(
                cloud=cloud,
                iteration=self.iteration))
            return {}

        actions = json.loads(info).get(c_action.CONDENSE)
        LOG.debug("live-migrating vm one by one")
        for vm_id, dest_host in actions:
            compute_resource.live_migrate_vm(vm_id, dest_host)
        return {}
Beispiel #5
0
def make(filter_folder, images_date):
    delete_relations()
    check_filter_folder(filter_folder)
    LOG.info("started creating filter files and all needed resources")
    cursor = 0
    while True:
        step = data_storage.get("%s_source" % cursor)
        if step is None:
            break
        cursor += 1
        ids = []
        for migrate in json.loads(step)['migrate']:
            vm_id = migrate[0]
            ids.append(vm_id)
            data_storage.put(MIGRATE_VM_PREFIX + vm_id, migrate[1])
        vm_filter = {'images': {'date': images_date}, 'instances': {'id': ids}}
        with file("%s/filter_%s.yaml" % (filter_folder, cursor), 'w') as \
                filter_file:
            filter_file.write(yaml.safe_dump(vm_filter))
    LOG.info("Creating filter files done. %s filters was created." % cursor)
Beispiel #6
0
def make(filter_folder, images_date):
    delete_relations()
    check_filter_folder(filter_folder)
    LOG.info("started creating filter files and all needed resources")
    cursor = 0
    while True:
        step = data_storage.get("%s_source" % cursor)
        if step is None:
            break
        cursor += 1
        ids = []
        for migrate in json.loads(step)['migrate']:
            vm_id = migrate[0]
            ids.append(vm_id)
            data_storage.put(MIGRATE_VM_PREFIX + vm_id, migrate[1])
        vm_filter = {'images': {'date': images_date},
                     'instances': {'id': ids}}
        with file("%s/filter_%s.yaml" % (filter_folder, cursor), 'w') as \
                filter_file:
            filter_file.write(yaml.safe_dump(vm_filter))
    LOG.info("Creating filter files done. %s filters was created." % cursor)