Commit 495cfdf0 authored by Guido Trotter's avatar Guido Trotter
Browse files

RAPI: move to nic parameters

In query we ask for nic.links, rather than nic.bridges
In create we accept both "link" and "bridge" and let the opcode deal
with it. Note that we still can create only one nic per instance.
Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parent 7d713344
...@@ -34,7 +34,7 @@ from ganeti.rapi import baserlib ...@@ -34,7 +34,7 @@ from ganeti.rapi import baserlib
I_FIELDS = ["name", "admin_state", "os", I_FIELDS = ["name", "admin_state", "os",
"pnode", "snodes", "pnode", "snodes",
"disk_template", "disk_template",
"nic.ips", "nic.macs", "nic.bridges", "nic.ips", "nic.macs", "nic.modes", "nic.links",
"network_port", "network_port",
"disk.sizes", "disk_usage", "disk.sizes", "disk_usage",
"beparams", "hvparams", "beparams", "hvparams",
...@@ -236,9 +236,15 @@ class R_2_instances(baserlib.R_Generic): ...@@ -236,9 +236,15 @@ class R_2_instances(baserlib.R_Generic):
" be an integer") " be an integer")
disks.append({"size": d}) disks.append({"size": d})
# nic processing (one nic only) # nic processing (one nic only)
nics = [{"mac": fn("mac", constants.VALUE_AUTO), nics = [{"mac": fn("mac", constants.VALUE_AUTO)}]
"ip": fn("ip", None), if fn("ip", None) is not None:
"bridge": fn("bridge", 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")
if fn("bridge", None) is not None:
nics[0]["bridge"] = fn("bridge")
op = opcodes.OpCreateInstance( op = opcodes.OpCreateInstance(
mode=constants.INSTANCE_CREATE, mode=constants.INSTANCE_CREATE,
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