From 58acb49d898c37312a8f18214f7f2792ff19ab6a Mon Sep 17 00:00:00 2001 From: Alexander Schreiber <als@google.com> Date: Mon, 17 Dec 2007 14:53:35 +0000 Subject: [PATCH] Add instance port support. Extends the instance object by adding a port item, also adds changes to print this port via gnt-instance info. Reviewed-by: iustinp --- lib/cmdlib.py | 4 ++++ lib/constants.py | 2 +- lib/objects.py | 1 + scripts/gnt-instance | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index e2374dbc6..c1aa0630e 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -3028,6 +3028,8 @@ class LUCreateInstance(LogicalUnit): if self.inst_ip is not None: nic.ip = self.inst_ip + network_port = None # placeholder assignment for later + disks = _GenerateDiskTemplate(self.cfg, self.op.disk_template, instance, pnode_name, @@ -3041,6 +3043,7 @@ class LUCreateInstance(LogicalUnit): nics=[nic], disks=disks, disk_template=self.op.disk_template, status=self.instance_status, + network_port=network_port, ) feedback_fn("* creating instance disks...") @@ -4001,6 +4004,7 @@ class LUQueryInstanceData(NoHooksLU): "memory": instance.memory, "nics": [(nic.mac, nic.ip, nic.bridge) for nic in instance.nics], "disks": disks, + "network_port": instance.network_port, "vcpus": instance.vcpus, } diff --git a/lib/constants.py b/lib/constants.py index fc5b88596..6c6598342 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -25,7 +25,7 @@ from ganeti import _autoconf # various versions CONFIG_VERSION = 3 -PROTOCOL_VERSION = 8 +PROTOCOL_VERSION = 9 RELEASE_VERSION = _autoconf.PACKAGE_VERSION OS_API_VERSION = 5 EXPORT_VERSION = 0 diff --git a/lib/objects.py b/lib/objects.py index 507e43d55..0629529b0 100644 --- a/lib/objects.py +++ b/lib/objects.py @@ -490,6 +490,7 @@ class Instance(TaggableObject): "nics", "disks", "disk_template", + "network_port", ] def _ComputeSecondaryNodes(self): diff --git a/scripts/gnt-instance b/scripts/gnt-instance index b4ce4caf5..fd6f48d6a 100755 --- a/scripts/gnt-instance +++ b/scripts/gnt-instance @@ -596,6 +596,7 @@ def ShowInstanceConfig(opts, args): buf.write(" - primary: %s\n" % instance["pnode"]) buf.write(" - secondaries: %s\n" % ", ".join(instance["snodes"])) buf.write(" Operating system: %s\n" % instance["os"]) + buf.write(" Allocated network port: %s\n" % instance["network_port"]) buf.write(" Hardware:\n") buf.write(" - VCPUs: %d\n" % instance["vcpus"]) buf.write(" - memory: %dMiB\n" % instance["memory"]) -- GitLab