karbor.services.protection package¶
Subpackages¶
- karbor.services.protection.clients package
- Submodules
- karbor.services.protection.clients.cinder module
- karbor.services.protection.clients.eisoo module
- karbor.services.protection.clients.freezer module
- karbor.services.protection.clients.glance module
- karbor.services.protection.clients.k8s module
- karbor.services.protection.clients.manila module
- karbor.services.protection.clients.neutron module
- karbor.services.protection.clients.nova module
- karbor.services.protection.clients.s3 module
- karbor.services.protection.clients.swift module
- karbor.services.protection.clients.trove module
- karbor.services.protection.clients.utils module
- Module contents
- karbor.services.protection.flows package
- Submodules
- karbor.services.protection.flows.copy module
- karbor.services.protection.flows.delete module
- karbor.services.protection.flows.protect module
- karbor.services.protection.flows.restore module
- karbor.services.protection.flows.utils module
- karbor.services.protection.flows.verify module
- karbor.services.protection.flows.worker module
- karbor.services.protection.flows.workflow module
- Module contents
Submodules¶
karbor.services.protection.api module¶
Handles all requests relating to protection service.
-
class
karbor.services.protection.api.
API
(db_driver=None)¶ Bases:
karbor.db.base.Base
API for interacting with the protection manager.
-
copy
(context, plan)¶
-
delete
(context, provider_id, checkpoint_id)¶
-
list_checkpoints
(context, provider_id, marker, limit, sort_keys, sort_dirs, filters, offset, all_tenants)¶
-
list_protectable_dependents
(context, protectable_id, protectable_type, protectable_name)¶
-
list_protectable_instances
(context, protectable_type, marker, limit, sort_keys, sort_dirs, filters, offset, parameters)¶
-
list_protectable_types
(context)¶
-
list_providers
(context, marker, limit, sort_keys, sort_dirs, filters, offset)¶
-
protect
(context, plan, checkpoint_properties)¶
-
reset_state
(context, provider_id, checkpoint_id, state)¶
-
restore
(context, restore, restore_auth)¶
-
show_checkpoint
(context, provider_id, checkpoint_id)¶
-
show_protectable_instance
(context, protectable_type, protectable_id, parameters=None)¶
-
show_protectable_type
(context, protectable_type)¶
-
show_provider
(context, provider_id)¶
-
verification
(context, verification)¶
-
karbor.services.protection.bank_plugin module¶
-
class
karbor.services.protection.bank_plugin.
Bank
(plugin)¶ Bases:
object
-
delete_object
(key, context=None)¶
-
get_object
(key, context=None)¶
-
get_owner_id
()¶
-
get_sub_section
(section, is_writable=True)¶
-
property
is_writeable
¶
-
list_objects
(prefix=None, limit=None, marker=None, sort_dir=None, context=None)¶
-
update_object
(key, value, context=None)¶
-
-
class
karbor.services.protection.bank_plugin.
BankIO
(bank_section, sorted_objects)¶ Bases:
object
-
read
(length=None)¶
-
readable
()¶
-
-
class
karbor.services.protection.bank_plugin.
BankPlugin
(config=None)¶ Bases:
object
-
abstract
delete_object
(key, context=None)¶
-
abstract
get_object
(key, context=None)¶
-
abstract
get_owner_id
(context=None)¶
-
abstract
list_objects
(prefix=None, limit=None, marker=None, sort_dir=None, context=None)¶
-
abstract
update_object
(key, value, context=None)¶
-
abstract
-
class
karbor.services.protection.bank_plugin.
BankSection
(bank, section, is_writable=True)¶ Bases:
object
Bank Section compartmentalizes a section of a bank.
Bank section is used when an object wants to pass a section of a bank to another entity and make sure it is only capable of accessing part of it.
-
property
bank
¶
-
delete_object
(key, context=None)¶
-
get_object
(key, context=None)¶
-
get_owner_id
()¶
-
get_sub_section
(prefix, is_writable=True)¶
-
property
is_writable
¶
-
list_objects
(prefix=None, limit=None, marker=None, sort_dir=None, context=None)¶
-
update_object
(key, value, context=None)¶
-
property
-
class
karbor.services.protection.bank_plugin.
LeasePlugin
¶ Bases:
object
-
abstract
acquire_lease
()¶
-
abstract
check_lease_validity
()¶
-
abstract
renew_lease
()¶
-
abstract
-
karbor.services.protection.bank_plugin.
validate_dir
(key)¶
-
karbor.services.protection.bank_plugin.
validate_key
(key)¶
karbor.services.protection.checkpoint module¶
-
class
karbor.services.protection.checkpoint.
Checkpoint
(checkpoint_section, indices_section, bank_lease, checkpoint_id)¶ Bases:
object
-
SUPPORTED_VERSIONS
= ['0.9']¶
-
VERSION
= '0.9'¶
-
property
checkpoint_section
¶
-
commit
(context=None)¶
-
classmethod
create_in_section
(checkpoints_section, indices_section, bank_lease, owner_id, plan, checkpoint_id=None, checkpoint_properties=None, context=None)¶
-
property
created_at
¶
-
delete
(context=None)¶
-
property
extra_info
¶
-
classmethod
get_by_section
(checkpoints_section, indices_section, bank_lease, checkpoint_id, context=None)¶
-
get_resource_bank_section
(resource_id)¶
-
property
id
¶
-
property
owner_id
¶
-
property
project_id
¶
-
property
protection_plan
¶
-
property
provider_id
¶
-
purge
(context=None)¶ Purge the index file of the checkpoint.
Can only be done if the checkpoint has no other files apart from the index.
-
reload_meta_data
()¶
-
property
resource_graph
¶
-
property
status
¶
-
to_dict
()¶
-
-
class
karbor.services.protection.checkpoint.
CheckpointCollection
(bank, bank_lease=None)¶ Bases:
object
-
create
(plan, checkpoint_properties=None, context=None)¶
-
get
(checkpoint_id, context=None)¶
-
list_ids
(project_id, provider_id, limit=None, marker=None, plan_id=None, start_date=None, end_date=None, sort_dir=None, context=None, all_tenants=False)¶
-
karbor.services.protection.client_factory module¶
karbor.services.protection.graph module¶
-
exception
karbor.services.protection.graph.
FoundLoopError
¶ Bases:
RuntimeError
-
class
karbor.services.protection.graph.
GraphNode
(value, child_nodes)¶ Bases:
tuple
-
child_nodes
¶ Alias for field number 1
-
value
¶ Alias for field number 0
-
-
class
karbor.services.protection.graph.
GraphWalker
¶ Bases:
object
-
register_listener
(graph_walker_listener)¶
-
unregister_listener
(graph_walker_listener)¶
-
walk_graph
(source_nodes)¶
-
-
class
karbor.services.protection.graph.
GraphWalkerListener
¶ Bases:
object
Interface for listening to GraphWaler events
Classes that want to be able to use the graph walker to iterate over a graph should implement this interface.
-
abstract
on_node_enter
(node, already_visited)¶
-
abstract
on_node_exit
(node)¶
-
abstract
-
class
karbor.services.protection.graph.
PackGraphWalker
(adjacency_list, nodes_dict)¶ Bases:
karbor.services.protection.graph.GraphWalkerListener
Pack a list of GraphNode
Allocate a serialized id (sid) for every node and build an adjacency list, suitable for graph unpacking.
-
on_node_enter
(node, already_visited)¶
-
on_node_exit
(node)¶
-
-
class
karbor.services.protection.graph.
PackedGraph
(nodes, adjacency)¶ Bases:
tuple
-
adjacency
¶ Alias for field number 1
-
nodes
¶ Alias for field number 0
-
-
karbor.services.protection.graph.
build_graph
(start_nodes, get_child_nodes_func)¶
-
karbor.services.protection.graph.
deserialize_resource_graph
(serialized_resource_graph)¶
-
karbor.services.protection.graph.
pack_graph
(start_nodes)¶ Return a PackedGraph from a list of GraphNodes
Packs a graph into a flat PackedGraph (nodes dictionary, adjacency list).
-
karbor.services.protection.graph.
serialize_resource_graph
(resource_graph)¶
-
karbor.services.protection.graph.
unpack_graph
(packed_graph)¶ Return a list of GraphNodes from a PackedGraph
Unpacks a PackedGraph, which must have the property: each parent node in the adjacency list appears after its children.
karbor.services.protection.manager module¶
Protection Service
-
class
karbor.services.protection.manager.
ProtectionManager
(service_name=None, *args, **kwargs)¶ Bases:
karbor.manager.Manager
karbor Protection Manager.
-
RPC_API_VERSION
= '1.0'¶
-
copy
(**kwargs)¶
-
delete
(**kwargs)¶
-
init_host
(**kwargs)¶ Handle initialization if this is a standalone service
-
list_checkpoints
(**kwargs)¶
-
list_protectable_dependents
(**kwargs)¶
-
list_protectable_instances
(**kwargs)¶
-
list_protectable_types
(context)¶
-
list_providers
(context, marker=None, limit=None, sort_keys=None, sort_dirs=None, filters=None)¶
-
protect
(**kwargs)¶
-
reset_state
(**kwargs)¶
-
restore
(**kwargs)¶
-
show_checkpoint
(**kwargs)¶
-
show_protectable_instance
(**kwargs)¶
-
show_protectable_type
(**kwargs)¶
-
show_provider
(**kwargs)¶
-
start
(plan)¶
-
suspend
(plan)¶
-
target
= <Target version=1.0>¶
-
validate_restore_parameters
(restore, provider)¶
-
validate_verify_parameters
(verify, provider)¶
-
verification
(**kwargs)¶
-
karbor.services.protection.protectable_plugin module¶
-
class
karbor.services.protection.protectable_plugin.
ProtectablePlugin
(context=None, conf=None)¶ Bases:
object
Base abstract class for protectable plugin.
-
abstract
get_dependent_resources
(context, parent_resource)¶ List dependent resource instances.
The listed resource instances are of type this plugin supported, and dependent by the given parent resource.
- Parameters
parent_resource (one of parent resource types.) – the parent resource instance.
- Returns
the list of dependent resource instances.
-
abstract
get_parent_resource_types
()¶ Return the possible parent resource types.
Subclasses can implement as a classmethod
-
abstract
get_resource_type
()¶ Return the resource type that this plugin supports.
Subclasses can implement as a classmethod
-
instance
(context=None, conf=None)¶
-
abstract
list_resources
(context, parameters=None)¶ List resource instances of type this plugin supported.
- Returns
The list of resource instance.
-
abstract
show_resource
(context, resource_id, parameters=None)¶ Show resource detail information.
-
abstract
karbor.services.protection.protectable_registry module¶
-
class
karbor.services.protection.protectable_registry.
ProtectableRegistry
¶ Bases:
object
-
build_graph
(context, resources)¶
-
fetch_dependent_resources
(context, resource)¶ List dependent resources under given parent resource.
- Parameters
resource – The parent resource to list dependent resources.
- Returns
The list of dependent resources.
-
get_protectable_resource_plugin
(resource_type)¶ Get the protectable plugin with the specified type.
-
list_resource_types
()¶ List all resource types supported by protectables.
- Returns
The list of supported resource types.
-
list_resources
(context, resource_type, parameters=None)¶ List resource instances of given type.
- Parameters
resource_type – The resource type to list instance.
- Returns
The list of resource instance.
-
load_plugins
()¶ Load all protectable plugins configured and register them.
-
register_plugin
(plugin)¶
-
show_resource
(context, resource_type, resource_id, parameters=None)¶ List resource instances of given type.
- Parameters
resource_type – The resource type of instance.
resource_id – The resource id of instance.
- Returns
The show of resource instance.
-
karbor.services.protection.protection_plugin module¶
-
class
karbor.services.protection.protection_plugin.
Operation
¶ Bases:
object
-
on_complete
(checkpoint, resource, context, parameters, **kwargs)¶ on_complete hook runs after all dependent resource’s hooks
Optional :param checkpoint: checkpoint object for this operation :param resource: a resource object for this operation :param context: current operation context (viable for clients) :param parameters: dictionary representing operation parameters :param restore: Restore object for restore operation only
-
on_main
(checkpoint, resource, context, parameters, **kwargs)¶ on_main hook runs in parallel to other resources’ on_main hooks
Your main operation heavy lifting should probably be here. Optional :param checkpoint: checkpoint object for this operation :param resource: a resource object for this operation :param context: current operation context (viable for clients) :param parameters: dictionary representing operation parameters :param restore: Restore object for restore operation only
-
on_prepare_begin
(checkpoint, resource, context, parameters, **kwargs)¶ on_prepare_begin hook runs before any child resource’s hooks run
Optional :param checkpoint: checkpoint object for this operation :param resource: a resource object for this operation :param context: current operation context (viable for clients) :param parameters: dictionary representing operation parameters :param restore: Restore object for restore operation only
-
on_prepare_finish
(checkpoint, resource, context, parameters, **kwargs)¶ on_prepare_finish hook runs after all child resources’ prepare hooks
Optional :param checkpoint: checkpoint object for this operation :param resource: a resource object for this operation :param context: current operation context (viable for clients) :param parameters: dictionary representing operation parameters :param restore: Restore object for restore operation only
-
-
class
karbor.services.protection.protection_plugin.
ProtectionPlugin
(config=None)¶ Bases:
object
-
get_copy_operation
(resource)¶ Returns the copy Operation for this resource
- Returns
Operation for the resource
-
get_delete_operation
(resource)¶ Returns the delete Operation for this resource
- Returns
Operation for the resource
-
classmethod
get_options_schema
(resource_type)¶ Returns the protect options schema for a resource type
- Returns
a dictionary representing the schema
-
get_protect_operation
(resource)¶ Returns the protect Operation for this resource
- Returns
Operation for the resource
-
get_restore_operation
(resource)¶ Returns the restore Operation for this resource
- Returns
Operation for the resource
-
classmethod
get_restore_schema
(resource_type)¶ Returns the restore schema for a resource type
- Returns
a dictionary representing the schema
-
classmethod
get_saved_info
(metadata_store, resource)¶ Returns the saved info for a resource
- Returns
a dictionary representing the saved info
-
classmethod
get_saved_info_schema
(resource_type)¶ Returns the saved info schema for a resource type
- Returns
a dictionary representing the schema
-
classmethod
get_supported_resources_types
()¶ Returns a list of resource types this plugin supports
- Returns
a list of resource types
-
get_verify_operation
(resource)¶ Returns the verify Operation for this resource
- Returns
Operation for the resource
-
classmethod
get_verify_schema
(resource_type)¶ Returns the verify schema for a resource type
- Returns
a dictionary representing the schema
-
karbor.services.protection.provider module¶
-
class
karbor.services.protection.provider.
PluggableProtectionProvider
(provider_config)¶ Bases:
object
-
property
bank
¶
-
property
description
¶
-
property
extended_info_schema
¶
-
get_checkpoint
(checkpoint_id, context=None)¶
-
get_checkpoint_collection
()¶
-
property
id
¶
-
list_checkpoints
(project_id, provider_id, limit=None, marker=None, plan_id=None, start_date=None, end_date=None, sort_dir=None, context=None, all_tenants=False)¶
-
load_plugins
()¶
-
property
name
¶
-
property
plugins
¶
-
property
karbor.services.protection.resource_flow module¶
-
class
karbor.services.protection.resource_flow.
ResourceFlowGraphWalkerListener
(resource_flow, operation_type, context, parameters, plugins, workflow_engine)¶ Bases:
karbor.services.protection.graph.GraphWalkerListener
-
on_node_enter
(node, already_visited)¶
-
on_node_exit
(node)¶
-
-
class
karbor.services.protection.resource_flow.
ResourceHooks
(on_prepare_begin, on_prepare_finish, on_main, on_complete)¶ Bases:
tuple
-
on_complete
¶ Alias for field number 3
-
on_main
¶ Alias for field number 2
-
on_prepare_begin
¶ Alias for field number 0
-
on_prepare_finish
¶ Alias for field number 1
-
-
karbor.services.protection.resource_flow.
build_resource_flow
(operation_type, context, workflow_engine, plugins, resource_graph, parameters)¶
-
karbor.services.protection.resource_flow.
noop_handle
(*args, **kwargs)¶
karbor.services.protection.rpcapi module¶
Client side of the protection manager RPC API.
-
class
karbor.services.protection.rpcapi.
ProtectionAPI
¶ Bases:
object
Client side of the protection rpc API.
API version history:
1.0 - Initial version.
-
RPC_API_VERSION
= '1.0'¶
-
copy
(ctxt, plan=None)¶
-
delete
(ctxt, provider_id, checkpoint_id)¶
-
list_checkpoints
(ctxt, provider_id, marker=None, limit=None, sort_keys=None, sort_dirs=None, filters=None, all_tenants=False)¶
-
list_protectable_dependents
(ctxt, protectable_id=None, protectable_type=None, protectable_name=None)¶
-
list_protectable_instances
(ctxt, protectable_type=None, marker=None, limit=None, sort_keys=None, sort_dirs=None, filters=None, parameters=None)¶
-
list_protectable_types
(ctxt)¶
-
list_providers
(ctxt, marker=None, limit=None, sort_keys=None, sort_dirs=None, filters=None)¶
-
protect
(ctxt, plan=None, checkpoint_properties=None)¶
-
reset_state
(ctxt, provider_id, checkpoint_id, state)¶
-
restore
(ctxt, restore=None, restore_auth=None)¶
-
show_checkpoint
(ctxt, provider_id, checkpoint_id)¶
-
show_protectable_instance
(ctxt, protectable_type=None, protectable_id=None, parameters=None)¶
-
show_protectable_type
(ctxt, protectable_type=None)¶
-
show_provider
(ctxt, provider_id=None)¶
-
verification
(ctxt, verification=None)¶
-