Example #1
0
def get_latest_resource(context, row):
    try:
        driver = base_driver.get_driver(row.object_type)
    except exceptions.ResourceNotRegistered:
        raise exceptions.UnsupportedResourceType(resource=row.object_type)

    return driver.get_resource_for_recovery(context, row)
 def test_get_resource_driver(self):
     for resource, resource_suffix in self.test_driver.RESOURCES.items():
         driver = base_driver.get_driver(resource)
         self.assertEqual(driver, self.test_driver)
         self.assertEqual(driver.plugin_type, helper.TEST_PLUGIN)
         self.assertEqual(self.test_driver.RESOURCES.get(resource),
                          resource_suffix)
Example #3
0
def sync_resources(context, resource_type):
    driver = base_driver.get_driver(resource_type)
    resources = driver.get_resources_for_full_sync(context, resource_type)
    with db_api.CONTEXT_WRITER.savepoint.using(context):
        for resource in resources:
            journal.record(context, resource_type, resource['id'],
                           odl_const.ODL_CREATE, resource)
Example #4
0
def sync_resources(context, resource_type):
    driver = base_driver.get_driver(resource_type)
    resources = driver.get_resources_for_full_sync(context, resource_type)
    with db_api.autonested_transaction(context.session):
        for resource in resources:
            journal.record(context, resource_type, resource['id'],
                           odl_const.ODL_CREATE, resource)
def get_latest_resource(context, row):
    try:
        driver = base_driver.get_driver(row.object_type)
    except exceptions.ResourceNotRegistered:
        raise exceptions.UnsupportedResourceType(resource=row.object_type)

    return driver.get_resource_for_recovery(context, row)
 def test_get_resource_driver(self):
     for resource, resource_suffix in self.test_driver.RESOURCES.items():
         driver = base_driver.get_driver(resource)
         self.assertEqual(driver, self.test_driver)
         self.assertEqual(driver.plugin_type, helper.TEST_PLUGIN)
         self.assertEqual(self.test_driver.RESOURCES.get(resource),
                          resource_suffix)