From 495cfdf0f4fc1bea9efce0ec1d03fff46fbb90be Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Tue, 16 Jun 2009 15:40:22 +0100 Subject: [PATCH] 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: Guido Trotter <ultrotter@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- lib/rapi/rlib2.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/rapi/rlib2.py b/lib/rapi/rlib2.py index c4b2d3ec8..3e5208518 100644 --- a/lib/rapi/rlib2.py +++ b/lib/rapi/rlib2.py @@ -34,7 +34,7 @@ from ganeti.rapi import baserlib I_FIELDS = ["name", "admin_state", "os", "pnode", "snodes", "disk_template", - "nic.ips", "nic.macs", "nic.bridges", + "nic.ips", "nic.macs", "nic.modes", "nic.links", "network_port", "disk.sizes", "disk_usage", "beparams", "hvparams", @@ -236,9 +236,15 @@ class R_2_instances(baserlib.R_Generic): " be an integer") disks.append({"size": d}) # nic processing (one nic only) - nics = [{"mac": fn("mac", constants.VALUE_AUTO), - "ip": fn("ip", None), - "bridge": fn("bridge", None)}] + 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") + if fn("bridge", None) is not None: + nics[0]["bridge"] = fn("bridge") op = opcodes.OpCreateInstance( mode=constants.INSTANCE_CREATE, -- GitLab