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
/2/info resource.
  R_2_features
/2/features resource.
  R_2_os
/2/os resource.
  R_2_redist_config
/2/redistribute-config resource.
  R_2_cluster_modify
/2/modify 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] resource.
  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 resource.
  R_2_nodes_name_storage_modify
/2/nodes/[node_name]/storage/modify resource.
  R_2_nodes_name_storage_repair
/2/nodes/[node_name]/storage/repair resource.
  R_2_groups
/2/groups resource.
  R_2_groups_name
/2/groups/[group_name] resource.
  R_2_groups_name_modify
/2/groups/[group_name]/modify resource.
  R_2_groups_name_rename
/2/groups/[group_name]/rename resource.
  R_2_groups_name_assign_nodes
/2/groups/[group_name]/assign-nodes resource.
  R_2_instances
/2/instances resource.
  R_2_instances_name
/2/instances/[instance_name] resource.
  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_2_instances_name_disk_grow
/2/instances/[instance_name]/disk/[disk_index]/grow resource.
  R_2_instances_name_console
/2/instances/[instance_name]/console 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/tags resource.
Functions [hide private]
opcodes.OpGroupAdd
_ParseCreateGroupRequest(data, dry_run)
Parses a request for creating a node group.
source code
opcodes.OpGroupSetParams
_ParseModifyGroupRequest(name, data)
Parses a request for modifying a node group.
source code
opcodes.OpGroupRename
_ParseRenameGroupRequest(name, data, dry_run)
Parses a request for renaming a node group.
source code
opcodes.OpInstanceCreate
_ParseInstanceCreateRequestVersion1(data, dry_run)
Parses an instance creation request version 1.
source code
 
_ParseInstanceReinstallRequest(name, data)
Parses a request for reinstalling an instance.
source code
opcodes.OpBackupExport
_ParseExportInstanceRequest(name, data)
Parses a request for an instance export.
source code
opcodes.OpInstanceMigrate
_ParseMigrateInstanceRequest(name, data)
Parses a request for an instance migration.
source code
opcodes.OpInstanceRename
_ParseRenameInstanceRequest(name, data)
Parses a request for renaming an instance.
source code
opcodes.OpInstanceSetParams
_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", ...
  G_FIELDS = ["name", "uuid", "alloc_policy", "node_cnt", "node_...
  _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"
  _INST_REINSTALL_REQV1 = "instance-reinstall-reqv1"
  _WFJC_TIMEOUT = 10

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


Function Details [hide private]

_ParseCreateGroupRequest(data, dry_run)

source code 

Parses a request for creating a node group.

Returns: opcodes.OpGroupAdd
Group creation opcode

_ParseModifyGroupRequest(name, data)

source code 

Parses a request for modifying a node group.

Returns: opcodes.OpGroupSetParams
Group modify opcode

_ParseRenameGroupRequest(name, data, dry_run)

source code 

Parses a request for renaming a node group.

Parameters:
  • name (string) - name of the node group to rename
  • data (dict) - the body received by the rename request
  • dry_run (bool) - whether to perform a dry run
Returns: opcodes.OpGroupRename
Node group rename opcode

_ParseInstanceCreateRequestVersion1(data, dry_run)

source code 

Parses an instance creation request version 1.

Returns: opcodes.OpInstanceCreate
Instance creation opcode

_ParseExportInstanceRequest(name, data)

source code 

Parses a request for an instance export.

Returns: opcodes.OpBackupExport
Instance export opcode

_ParseMigrateInstanceRequest(name, data)

source code 

Parses a request for an instance migration.

Returns: opcodes.OpInstanceMigrate
Instance migration opcode

_ParseRenameInstanceRequest(name, data)

source code 

Parses a request for renaming an instance.

Returns: opcodes.OpInstanceRename
Instance rename opcode

_ParseModifyInstanceRequest(name, data)

source code 

Parses a request for modifying an instance.

Returns: opcodes.OpInstanceSetParams
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", "custom_hvparams", "custom_bepar\
ams", "custom_nicparams",]+ _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", "mas\
ter_capable", "vm_capable", "group.uuid",]+ _COMMON_FIELDS

G_FIELDS

Value:
["name", "uuid", "alloc_policy", "node_cnt", "node_list", "ctime", "mt\
ime", "serial_no",]

_NR_MAP

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