Commit 749a2b90 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Add instance communication for Xen



* add path to the 'xen-ifup-os' script that configures interfaces
* fix if-elif construct
* generate names of the form 'gnt.com.%d' for instance communication TAP interfaces
* add 'vifname' property to the 'vif' field of the configuration of a domain
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarHrvoje Ribicic <riba@google.com>
parent aa21546b
......@@ -365,6 +365,24 @@ def _QuoteCpuidField(data):
return "'%s'" % data if data.startswith("host") else data
def _ConfigureNIC(instance, seq, nic, tap):
"""Run the network configuration script for a specified NIC
See L{hv_base.ConfigureNIC}.
@type instance: instance object
@param instance: instance we're acting on
@type seq: int
@param seq: nic sequence number
@type nic: nic object
@param nic: nic we're acting on
@type tap: str
@param tap: the host's tap interface this NIC corresponds to
"""
hv_base.ConfigureNIC(pathutils.XEN_IFUP_OS, instance, seq, nic, tap)
class XenHypervisor(hv_base.BaseHypervisor):
"""Xen generic hypervisor interface
......@@ -547,6 +565,12 @@ class XenHypervisor(hv_base.BaseHypervisor):
if nic.nicparams[constants.NIC_VLAN]:
nic_str += "%s" % nic.nicparams[constants.NIC_VLAN]
if nic.name and \
nic.name.startswith(constants.INSTANCE_COMMUNICATION_NIC_PREFIX):
tap = hv_base.GenerateTapName()
nic_str += ", vifname=%s" % tap
nic.name = tap
if hvp[constants.HV_VIF_SCRIPT]:
nic_str += ", script=%s" % hvp[constants.HV_VIF_SCRIPT]
......@@ -692,6 +716,10 @@ class XenHypervisor(hv_base.BaseHypervisor):
(instance.name, result.fail_reason,
result.output, stashed_config))
for nic_seq, nic in enumerate(instance.nics):
if nic.name and nic.name.startswith("gnt.com."):
_ConfigureNIC(instance, nic_seq, nic, nic.name)
def StopInstance(self, instance, force=False, retry=False, name=None,
timeout=None):
"""Stop an instance.
......
......@@ -100,6 +100,7 @@ RAPI_USERS_FILE = DATA_DIR + "/rapi/users"
QUEUE_DIR = DATA_DIR + "/queue"
INTENT_TO_UPGRADE = DATA_DIR + "/intent-to-upgrade"
CONF_DIR = SYSCONFDIR + "/ganeti"
XEN_IFUP_OS = CONF_DIR + "/xen-ifup-os"
USER_SCRIPTS_DIR = CONF_DIR + "/scripts"
VNC_PASSWORD_FILE = CONF_DIR + "/vnc-cluster-password"
HOOKS_BASE_DIR = CONF_DIR + "/hooks"
......
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