Commit 3fd7f652 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

RAPI server: Drop support for instance creation format 0

Ganeti 2.1.3, released in June 2010, added support for a new, extensible
instance creation request format, called version 1. This patch removes
support for the old and undocumented version 0 format.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent d914c76f
......@@ -13,6 +13,9 @@ Version 2.5.0 beta1
parameter no longer defaults to ``loop`` and must be specified
- The deprecated "bridge" nic parameter is no longer supported. Use
"link" instead.
- Support for the undocumented and deprecated RAPI instance creation
request format version 0 has been dropped. Use version 1, supported
since Ganeti 2.1.3 and :doc:`documented <rapi>`, instead.
Version 2.4.0
......@@ -568,8 +568,8 @@ Body parameters:
``__version__`` (int, required)
Must be ``1`` (older Ganeti versions used a different format for
instance creation requests, version ``0``, but that format is not
documented and should no longer be used).
instance creation requests, version ``0``, but that format is no
longer supported)
.. opcode_params:: OP_INSTANCE_CREATE
......@@ -751,65 +751,6 @@ class R_2_instances(baserlib.R_Generic):
return baserlib.BuildUriList(instanceslist, "/2/instances/%s",
uri_fields=("id", "uri"))
def _ParseVersion0CreateRequest(self):
"""Parses an instance creation request version 0.
Request data version 0 is deprecated and should not be used anymore.
@rtype: L{opcodes.OpInstanceCreate}
@return: Instance creation opcode
# Do not modify anymore, request data version 0 is deprecated
beparams = baserlib.MakeParamsDict(self.request_body,
hvparams = baserlib.MakeParamsDict(self.request_body,
fn = self.getBodyParameter
# disk processing
disk_data = fn('disks')
if not isinstance(disk_data, list):
raise http.HttpBadRequest("The 'disks' parameter should be a list")
disks = []
for idx, d in enumerate(disk_data):
if not isinstance(d, int):
raise http.HttpBadRequest("Disk %d specification wrong: should"
" be an integer" % idx)
disks.append({"size": d})
# nic processing (one nic only)
nics = [{"mac": fn("mac", constants.VALUE_AUTO)}]
if fn("ip", None) is not None:
nics[0]["ip"] = fn("ip")
if fn("mode", None) is not None:
nics[0]["mode"] = fn("mode")
if fn("link", None) is not None:
nics[0]["link"] = fn("link")
# Do not modify anymore, request data version 0 is deprecated
return opcodes.OpInstanceCreate(
pnode=fn('pnode', None),
snode=fn('snode', None),
iallocator=fn('iallocator', None),
start=fn('start', True),
ip_check=fn('ip_check', True),
name_check=fn('name_check', True),
hypervisor=fn('hypervisor', None),
file_storage_dir=fn('file_storage_dir', None),
file_driver=fn('file_driver', constants.FD_LOOP),
def POST(self):
"""Create an instance.
......@@ -823,7 +764,8 @@ class R_2_instances(baserlib.R_Generic):
data_version = self.getBodyParameter(_REQ_DATA_VERSION, 0)
if data_version == 0:
op = self._ParseVersion0CreateRequest()
raise http.HttpBadRequest("Instance creation request version 0 is no"
" longer supported")
elif data_version == 1:
data = self.request_body.copy()
# Remove "__version__"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment