Package ganeti :: Package rapi :: Module rlib2
[hide private]
[frames] | no frames]

Module rlib2

source code

Remote API version 2 baserlib.library.

PUT or POST?

According to RFC2616 the main difference between PUT and POST is that POST can create new resources but PUT can only create the resource the URI was pointing to on the PUT request.

To be in context of this module for instance creation POST on /2/instances is legitim while PUT would be not, due to it does create a new entity and not just replace /2/instances with it.

So when adding new methods, if they are operating on the URI entity itself, PUT should be prefered over POST.

Classes [hide private]
  R_version
/version resource.
  R_2_info
Cluster info.
  R_2_features
/2/features resource.
  R_2_os
/2/os resource.
  R_2_redist_config
/2/redistribute-config resource.
  R_2_jobs
/2/jobs resource.
  R_2_jobs_id
/2/jobs/[job_id] resource.
  R_2_jobs_id_wait
/2/jobs/[job_id]/wait resource.
  R_2_nodes
/2/nodes resource.
  R_2_nodes_name
/2/nodes/[node_name] resources.
  R_2_nodes_name_role
/2/nodes/[node_name]/role resource.
  R_2_nodes_name_evacuate
/2/nodes/[node_name]/evacuate resource.
  R_2_nodes_name_migrate
/2/nodes/[node_name]/migrate resource.
  R_2_nodes_name_storage
/2/nodes/[node_name]/storage ressource.
  R_2_nodes_name_storage_modify
/2/nodes/[node_name]/storage/modify ressource.
  R_2_nodes_name_storage_repair
/2/nodes/[node_name]/storage/repair ressource.
  R_2_instances
/2/instances resource.
  R_2_instances_name
/2/instances/[instance_name] resources.
  R_2_instances_name_info
/2/instances/[instance_name]/info resource.
  R_2_instances_name_reboot
/2/instances/[instance_name]/reboot resource.
  R_2_instances_name_startup
/2/instances/[instance_name]/startup resource.
  R_2_instances_name_shutdown
/2/instances/[instance_name]/shutdown resource.
  R_2_instances_name_reinstall
/2/instances/[instance_name]/reinstall resource.
  R_2_instances_name_replace_disks
/2/instances/[instance_name]/replace-disks resource.
  R_2_instances_name_activate_disks
/2/instances/[instance_name]/activate-disks resource.
  R_2_instances_name_deactivate_disks
/2/instances/[instance_name]/deactivate-disks resource.
  R_2_instances_name_prepare_export
/2/instances/[instance_name]/prepare-export resource.
  R_2_instances_name_export
/2/instances/[instance_name]/export resource.
  R_2_instances_name_migrate
/2/instances/[instance_name]/migrate resource.
  R_2_instances_name_rename
/2/instances/[instance_name]/rename resource.
  R_2_instances_name_modify
/2/instances/[instance_name]/modify resource.
  _R_Tags
Quasiclass for tagging resources
  R_2_instances_name_tags
/2/instances/[instance_name]/tags resource.
  R_2_nodes_name_tags
/2/nodes/[node_name]/tags resource.
  R_2_tags
/2/instances/tags resource.
Functions [hide private]
opcodes.OpCreateInstance
_ParseInstanceCreateRequestVersion1(data, dry_run)
Parses an instance creation request version 1.
source code
opcodes.OpExportInstance
_ParseExportInstanceRequest(name, data)
Parses a request for an instance export.
source code
opcodes.OpMigrateInstance
_ParseMigrateInstanceRequest(name, data)
Parses a request for an instance migration.
source code
opcodes.OpRenameInstance
_ParseRenameInstanceRequest(name, data)
Parses a request for renaming an instance.
source code
opcodes.OpSetInstanceParams
_ParseModifyInstanceRequest(name, data)
Parses a request for modifying an instance.
source code
Variables [hide private]
  _COMMON_FIELDS = ["ctime", "mtime", "uuid", "serial_no", "tags"]
  I_FIELDS = ["name", "admin_state", "os", "pnode", "snodes", "d...
  N_FIELDS = ["name", "offline", "master_candidate", "drained", ...
  _NR_DRAINED = "drained"
  _NR_MASTER_CANDIATE = "master-candidate"
  _NR_MASTER = "master"
  _NR_OFFLINE = "offline"
  _NR_REGULAR = "regular"
  _NR_MAP = {"M": _NR_MASTER, "C": _NR_MASTER_CANDIATE, "D": _NR...
  _REQ_DATA_VERSION = "__version__"
  _INST_CREATE_REQV1 = "instance-create-reqv1"
  _WFJC_TIMEOUT = 10

Imports: opcodes, http, constants, cli, utils, rapi, baserlib


Function Details [hide private]

_ParseInstanceCreateRequestVersion1(data, dry_run)

source code 

Parses an instance creation request version 1.

Returns: opcodes.OpCreateInstance
Instance creation opcode

_ParseExportInstanceRequest(name, data)

source code 

Parses a request for an instance export.

Returns: opcodes.OpExportInstance
Instance export opcode

_ParseMigrateInstanceRequest(name, data)

source code 

Parses a request for an instance migration.

Returns: opcodes.OpMigrateInstance
Instance migration opcode

_ParseRenameInstanceRequest(name, data)

source code 

Parses a request for renaming an instance.

Returns: opcodes.OpRenameInstance
Instance rename opcode

_ParseModifyInstanceRequest(name, data)

source code 

Parses a request for modifying an instance.

Returns: opcodes.OpSetInstanceParams
Instance modify opcode

Variables Details [hide private]

I_FIELDS

Value:
["name", "admin_state", "os", "pnode", "snodes", "disk_template", "nic\
.ips", "nic.macs", "nic.modes", "nic.links", "nic.bridges", "network_p\
ort", "disk.sizes", "disk_usage", "beparams", "hvparams", "oper_state"\
, "oper_ram", "oper_vcpus", "status",]+ _COMMON_FIELDS

N_FIELDS

Value:
["name", "offline", "master_candidate", "drained", "dtotal", "dfree", \
"mtotal", "mnode", "mfree", "pinst_cnt", "sinst_cnt", "ctotal", "cnode\
s", "csockets", "pip", "sip", "role", "pinst_list", "sinst_list",]+ _C\
OMMON_FIELDS

_NR_MAP

Value:
{"M": _NR_MASTER, "C": _NR_MASTER_CANDIATE, "D": _NR_DRAINED, "O": _NR\
_OFFLINE, "R": _NR_REGULAR,}