Skip to content

Decorators

The Virtualization SDK exposes decorators to be able to annotate functions that correspond to each Plugin Operation. In the example below, it first instantiates a Plugin() object, that can then be used to tag plugin operations.

from dlpx.virtualization.platform import Plugin

# Initialize a plugin object
plugin = Plugin()

# Use the decorator to annotate the function that corresponds to the "Virtual Source Start" Plugin Operation
@plugin.virtual_source.start()
def my_start(virtual_source, repository, source_config):
  print "running start" 

Info

Decorators exposed by the Virtualization SDK are inherently python function calls and needs parentheses () appended at the end.

Assuming the name of the object, is plugin as above, the table below lists the corresponding decorators for each plugin operation.

Plugin Operation Decorator
Repository Discovey @plugin.discovery.repository()
Source Config Discovey @plugin.discovery.source_config()
Direct Linked Source Pre-Snapshot @plugin.linked.pre_snapshot()
Direct Linked Source Post-Snapshot @plugin.linked.post_snapshot()
Staged Linked Source Pre-Snapshot @plugin.linked.pre_snapshot()
Staged Linked Source Post-Snapshot @plugin.linked.post_snapshot()
Staged Linked Source Start-Staging @plugin.linked.start_staging()
Staged Linked Source Stop-Staging @plugin.linked.stop_staging()
Staged Linked Source Status @plugin.linked.status()
Staged Linked Source Worker @plugin.linked.worker()
Staged Linked Source Mount Specification @plugin.linked.mount_specification()
Virtual Source Configure @plugin.virtual.configure()
Virtual Source Unconfigure @plugin.virtual.unconfigure()
Virtual Source Reconfigure @plugin.virtual.reconfigure()
Virtual Source Start @plugin.virtual.start()
Virtual Source Stop @plugin.virtual.stop()
VirtualSource Pre-Snapshot @plugin.virtual.pre_snapshot()
Virtual Source Post-Snapshot @plugin.virtual.post_snapshot()
Virtual Source Mount Specification @plugin.virtual.mount_specification()
Virtual Source Status @plugin.virtual.status()

Warning

A plugin should only implement the direct operations or the staged operations based on the plugin type