Commit 9a94cee3 authored by Jose A. Lopes's avatar Jose A. Lopes
Browse files

Instance comm network from config instead of predefined



* Add 'ganeti.objects.Cluster.instance_communication_network' to the
  config so the logical unit for 'OpInstanceCreate' can access the
  instance communication network which is stored in the cluster
  configuration.

* Change logical unit for 'OpInstanceCreate' to use the instance
  communication network parameter defined in the cluster configuration
  instead of using a predefined one.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarHelga Velroyen <helgav@google.com>
parent 8a5d326f
......@@ -436,12 +436,12 @@ class LUInstanceCreate(LogicalUnit):
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})
constants.INIC_NETWORK:
self.cfg.GetInstanceCommunicationNetwork()})
# check nics' parameter names
for nic in self.op.nics:
......
#
#
# 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
......@@ -1251,6 +1251,17 @@ class ConfigWriter(object):
return result
@locking.ssynchronized(_config_lock, shared=1)
def GetInstanceCommunicationNetwork(self):
"""Get cluster instance communication network
@rtype: string
@return: instance communication network, which is the name of the
network used for instance communication
"""
return self._config_data.cluster.instance_communication_network
@locking.ssynchronized(_config_lock)
def AddNodeGroup(self, group, ec_id, check_uuid=True):
"""Add a node group to the configuration.
......
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