From 87e510fd8beed166f4e8471765def6e6fceddcae Mon Sep 17 00:00:00 2001
From: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Date: Mon, 26 Apr 2010 15:21:17 +0300
Subject: [PATCH] KVM: make tags available in KVM_NET_SCRIPT

Make instance tags available as a space-separated list during the execution of
the network setup script. This allows tag-based control of things like firewall
rules and/or networking setup.

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/hypervisor/hv_kvm.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index 13c09ddce..76b4a1a60 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -287,6 +287,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     if nic.nicparams[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED:
       script.write("export BRIDGE=%s\n" % nic.nicparams[constants.NIC_LINK])
     script.write("export INTERFACE=$1\n")
+    script.write("export TAGS=\"%s\"\n" % " ".join(instance.tags))
     # TODO: make this configurable at ./configure time
     script.write("if [ -x '%s' ]; then\n" % self._KVM_NETWORK_SCRIPT)
     script.write("  # Execute the user-specific vif file\n")
-- 
GitLab