Hi,

A bit late for this patch, but it causes problems right now...

See the comments inline please:


On Sun, Jul 14, 2013 at 5:05 PM, Sebastian Gebhard <[email protected]>wrote:

> This parameter is used to store the vlans each nic is connected to.
> It is only used if the network is in openvswitch mode.
>
> Signed-off-by: Sebastian Gebhard <[email protected]>
> ---
>  lib/constants.py      | 5 +++++
>  src/Ganeti/Objects.hs | 1 +
>  2 files changed, 6 insertions(+)
>
> diff --git a/lib/constants.py b/lib/constants.py
> index 8844791..9866ed5 100644
> --- a/lib/constants.py
> +++ b/lib/constants.py
> @@ -1315,6 +1315,7 @@ PP_DEFAULT = "default"
>  # NIC_* constants are used inside the ganeti config
>  NIC_MODE = "mode"
>  NIC_LINK = "link"
> +NIC_VLAN = "vlan"
>

Why do we need this constant? As far as I can see, only required parameters
are listed here, and that's mode and link. So why do we need vlan here, but
not things like ip, name, network, etc.?


>
>  NIC_MODE_BRIDGED = "bridged"
>  NIC_MODE_ROUTED = "routed"
> @@ -1333,6 +1334,7 @@ RELEASE_ACTION = "release"
>  NICS_PARAMETER_TYPES = {
>    NIC_MODE: VTYPE_STRING,
>    NIC_LINK: VTYPE_STRING,
> +  NIC_VLAN: VTYPE_MAYBE_STRING,
>

Adding this here breaks instance import for instances which were exported
with older Ganeti versions because...


>    }
>
>  NICS_PARAMETERS = frozenset(NICS_PARAMETER_TYPES.keys())
>

... the keys of this dict are used here, and that's the required parameters
for nic during instance import.

Any comments?

Cheers,
Thomas


> @@ -1365,6 +1367,7 @@ INIC_MODE = "mode"
>  INIC_LINK = "link"
>  INIC_NETWORK = "network"
>  INIC_NAME = "name"
> +INIC_VLAN = "vlan"
>  INIC_PARAMS_TYPES = {
>    INIC_IP: VTYPE_MAYBE_STRING,
>    INIC_LINK: VTYPE_STRING,
> @@ -1372,6 +1375,7 @@ INIC_PARAMS_TYPES = {
>    INIC_MODE: VTYPE_STRING,
>    INIC_NETWORK: VTYPE_MAYBE_STRING,
>    INIC_NAME: VTYPE_MAYBE_STRING,
> +  INIC_VLAN: VTYPE_MAYBE_STRING,
>    }
>  INIC_PARAMS = frozenset(INIC_PARAMS_TYPES.keys())
>
> @@ -2255,6 +2259,7 @@ del _LV_DEFAULTS, _DRBD_DEFAULTS
>  NICC_DEFAULTS = {
>    NIC_MODE: NIC_MODE_BRIDGED,
>    NIC_LINK: DEFAULT_BRIDGE,
> +  NIC_VLAN: "",
>    }
>
>  # All of the following values are quite arbitrarily - there are no
> diff --git a/src/Ganeti/Objects.hs b/src/Ganeti/Objects.hs
> index 021a860..c6c8c0f 100644
> --- a/src/Ganeti/Objects.hs
> +++ b/src/Ganeti/Objects.hs
> @@ -277,6 +277,7 @@ instance UuidObject Network where
>  $(buildParam "Nic" "nicp"
>    [ simpleField "mode" [t| NICMode |]
>    , simpleField "link" [t| String  |]
> +  , simpleField "vlan" [t| Maybe String  |]
>    ])
>
>  $(buildObject "PartialNic" "nic" $
> --
> 1.8.1.2
>
>


-- 
Thomas Thrainer | Software Engineer | [email protected] |

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