LGTM, thanks

On Tue, Apr 15, 2014 at 2:38 PM, Jose A. Lopes <[email protected]> wrote:

> * 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: Jose A. Lopes <[email protected]>
> ---
>  lib/hypervisor/hv_xen.py | 28 ++++++++++++++++++++++++++++
>  lib/pathutils.py         |  1 +
>  2 files changed, 29 insertions(+)
>
> diff --git a/lib/hypervisor/hv_xen.py b/lib/hypervisor/hv_xen.py
> index af13df8..4ea4fa6 100644
> --- a/lib/hypervisor/hv_xen.py
> +++ b/lib/hypervisor/hv_xen.py
> @@ -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.
> diff --git a/lib/pathutils.py b/lib/pathutils.py
> index 6ef1ca7..67ac41d 100644
> --- a/lib/pathutils.py
> +++ b/lib/pathutils.py
> @@ -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"
> --
> 1.9.1.423.g4596e3a
>
>

Reply via email to