On Fri, Jan 31, 2014 at 11:46 AM, Jose A. Lopes <[email protected]> wrote:
> When an instance is being created, add an extra NIC (if necessary)
> which is meant to be used by the instance communication.
>
> Signed-off-by: Jose A. Lopes <[email protected]>
> ---
>  lib/cmdlib/instance.py | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/lib/cmdlib/instance.py b/lib/cmdlib/instance.py
> index 573892f..03f4583 100644
> --- a/lib/cmdlib/instance.py
> +++ b/lib/cmdlib/instance.py
> @@ -1,7 +1,7 @@
>  #
>  #
>
> -# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google Inc.
> +# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Google 
> Inc.
>  #
>  # This program is free software; you can redistribute it and/or modify
>  # it under the terms of the GNU General Public License as published by
> @@ -431,6 +431,17 @@ class LUInstanceCreate(LogicalUnit):
>        raise errors.OpPrereqError("Cannot do IP address check without a name"
>                                   " check", errors.ECODE_INVAL)
>
> +    # add nic for instance communication
> +    if self.op.instance_communication:
> +      nic_name = "%s%s" % (constants.INSTANCE_COMMUNICATION_NIC_PREFIX,
> +                           self.op.instance_name)
> +      communication_network = constants.INSTANCE_COMMUNICATION_NETWORK
> +
> +      self.op.nics.append({constants.INIC_NAME: nic_name,
> +                           constants.INIC_MAC: constants.VALUE_GENERATE,
> +                           constants.INIC_IP: constants.NIC_IP_POOL,
> +                           constants.INIC_NETWORK: communication_network})
> +
>      # check nics' parameter names
>      for nic in self.op.nics:
>        utils.ForceDictType(nic, constants.INIC_PARAMS_TYPES)
> --
> 1.8.5.3
>

LGTM, thanks.
Michele

-- 
Google Germany GmbH
Dienerstr. 12
80331 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores

Reply via email to