コード例 #1
0
ファイル: action.py プロジェクト: mgrygoriev/CloudFerry
 def dump_actions(self):
     """
         This method writes all actions on the current step to database
     """
     data_storage.put(self.key, json.dumps(self.data))
     self.new_step()
     self.iteration += 1
コード例 #2
0
 def dump_actions(self):
     """
         This method writes all actions on the current step to database
     """
     data_storage.put(self.key, json.dumps(self.data))
     self.new_step()
     self.iteration += 1
コード例 #3
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)
コード例 #4
0
ファイル: make_filters.py プロジェクト: mgrygoriev/CloudFerry
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)