Commit 015f1517 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Add CLI and OpCode instance communication option



* Add command-line interface flag to enable instance communication
* Add instance communication parameter to the opcode that creates an instance
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 81c222af
#
#
# 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
......@@ -115,6 +115,7 @@ __all__ = [
"IGNORE_SIZE_OPT",
"INCLUDEDEFAULTS_OPT",
"INTERVAL_OPT",
"INSTANCE_COMMUNICATION_OPT",
"MAC_PREFIX_OPT",
"MAINTAIN_NODE_HEALTH_OPT",
"MASTER_NETDEV_OPT",
......@@ -1686,6 +1687,13 @@ HOTPLUG_IF_POSSIBLE_OPT = cli_option("--hotplug-if-possible",
help="Hotplug devices in case"
" hotplug is supported")
INSTANCE_COMMUNICATION_OPT = \
cli_option("-c", "--communication",
default=False,
dest="instance_communication",
help=constants.INSTANCE_COMMUNICATION_DOC,
type="bool")
#: Options provided by all commands
COMMON_OPTS = [DEBUG_OPT, REASON_OPT]
......@@ -2727,6 +2735,7 @@ def GenericInstanceCreate(mode, opts, args):
no_install = opts.no_install
identify_defaults = False
compress = constants.IEC_NONE
instance_communication = opts.instance_communication
elif mode == constants.INSTANCE_IMPORT:
start = False
os_type = None
......@@ -2736,6 +2745,7 @@ def GenericInstanceCreate(mode, opts, args):
no_install = None
identify_defaults = opts.identify_defaults
compress = opts.compress
instance_communication = False
else:
raise errors.ProgrammerError("Invalid creation mode %s" % mode)
......@@ -2765,7 +2775,8 @@ def GenericInstanceCreate(mode, opts, args):
tags=tags,
no_install=no_install,
identify_defaults=identify_defaults,
ignore_ipolicy=opts.ignore_ipolicy)
ignore_ipolicy=opts.ignore_ipolicy,
instance_communication=instance_communication)
SubmitOrSend(op, opts)
return 0
......
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google Inc.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 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
......@@ -1479,6 +1479,7 @@ add_opts = [
FORCE_VARIANT_OPT,
NO_INSTALL_OPT,
IGNORE_IPOLICY_OPT,
INSTANCE_COMMUNICATION_OPT,
]
commands = {
......
......@@ -16,7 +16,7 @@ imported.
{-
Copyright (C) 2013 Google Inc.
Copyright (C) 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
......@@ -4764,6 +4764,10 @@ glusterPortDefault = 24007
-- * Instance communication
instanceCommunicationDoc :: String
instanceCommunicationDoc =
"Enable or disable the communication mechanism for an instance"
instanceCommunicationNetwork :: String
instanceCommunicationNetwork = "ganeti:network:communication"
......
......@@ -7,7 +7,7 @@
{-
Copyright (C) 2009, 2010, 2011, 2012, 2013 Google Inc.
Copyright (C) 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
......@@ -452,6 +452,7 @@ $(genOpCode "OpCode"
, pBackupCompress
, pStartInstance
, pInstTags
, pInstanceCommunication
],
"instance_name")
, ("OpInstanceMultiAlloc",
......
......@@ -12,7 +12,7 @@ module.
{-
Copyright (C) 2012 Google Inc.
Copyright (C) 2012, 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
......@@ -44,6 +44,7 @@ module Ganeti.OpParams
, SetParamsMods(..)
, ExportTarget(..)
, pInstanceName
, pInstanceCommunication
, pInstanceUuid
, pInstances
, pName
......@@ -985,6 +986,11 @@ pInstanceName =
withDoc "A required instance name (for single-instance LUs)" $
simpleField "instance_name" [t| String |]
pInstanceCommunication :: Field
pInstanceCommunication =
withDoc C.instanceCommunicationDoc $
defaultFalse "instance_communication"
pForceVariant :: Field
pForceVariant =
withDoc "Whether to force an unknown OS variant" $
......
......@@ -241,7 +241,8 @@ instance Arbitrary OpCodes.OpCode where
genMaybe genNodeNameNE <*> return Nothing <*> genMaybe (pure []) <*>
genMaybe genNodeNameNE <*> arbitrary <*> genMaybe genNodeNameNE <*>
return Nothing <*> genMaybe genNodeNameNE <*> genMaybe genNameNE <*>
arbitrary <*> arbitrary <*> (genTags >>= mapM mkNonEmpty)
arbitrary <*> arbitrary <*> (genTags >>= mapM mkNonEmpty) <*>
arbitrary
"OP_INSTANCE_MULTI_ALLOC" ->
OpCodes.OpInstanceMultiAlloc <$> arbitrary <*> genMaybe genNameNE <*>
pure []
......
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