Revision 2ff6426b lib/cmdlib/common.py

b/lib/cmdlib/common.py
1285 1285
  ((crypto_type, new_digest), ) = result.payload
1286 1286
  assert crypto_type == constants.CRYPTO_TYPE_SSL_DIGEST
1287 1287
  return new_digest
1288

  
1289

  
1290
def OpAddInstanceCommunicationNetwork(network):
1291
  """Create OpCode that adds the instance communication network.
1292

  
1293
  This OpCode contains the configuration necessary for the instance
1294
  communication network.
1295

  
1296
  @type network: string
1297
  @param network: name or UUID of the instance communication network
1298

  
1299
  @rtype: L{ganeti.opcodes.OpCode}
1300
  @return: OpCode that creates the instance communication network
1301

  
1302
  """
1303
  return opcodes.OpNetworkAdd(
1304
    network_name=network,
1305
    gateway=None,
1306
    network=constants.INSTANCE_COMMUNICATION_NETWORK4,
1307
    gateway6=None,
1308
    network6=constants.INSTANCE_COMMUNICATION_NETWORK6,
1309
    mac_prefix=constants.INSTANCE_COMMUNICATION_MAC_PREFIX,
1310
    add_reserved_ips=None,
1311
    conflicts_check=True,
1312
    tags=[])
1313

  
1314

  
1315
def OpConnectInstanceCommunicationNetwork(group_uuid, network):
1316
  """Create OpCode that connects a group to the instance communication
1317
  network.
1318

  
1319
  This OpCode contains the configuration necessary for the instance
1320
  communication network.
1321

  
1322
  @type group_uuid: string
1323
  @param group_uuid: UUID of the group to connect
1324

  
1325
  @type network: string
1326
  @param network: name or UUID of the network to connect to, i.e., the
1327
                  instance communication network
1328

  
1329
  @rtype: L{ganeti.opcodes.OpCode}
1330
  @return: OpCode that connects the group to the instance
1331
           communication network
1332

  
1333
  """
1334
  return opcodes.OpNetworkConnect(
1335
    group_name=group_uuid,
1336
    network_name=network,
1337
    network_mode=constants.NIC_MODE_ROUTED,
1338
    network_link=constants.INSTANCE_COMMUNICATION_NETWORK_LINK,
1339
    conflicts_check=True)

Also available in: Unified diff