예제 #1
0
def ConnectNetwork(opts, args):
    """Map a network to a node group.

  @param opts: the command line options selected by the user
  @type args: list
  @param args: Network, mode, physlink and node groups
  @rtype: int
  @return: the desired exit code

  """
    cl = GetClient()

    network = args[0]
    nicparams = objects.FillDict(constants.NICC_DEFAULTS, opts.nicparams)

    groups = _GetDefaultGroups(cl, args[1:])

    # TODO: Change logic to support "--submit"
    for group in groups:
        op = opcodes.OpNetworkConnect(
            group_name=group,
            network_name=network,
            network_mode=nicparams[constants.NIC_MODE],
            network_link=nicparams[constants.NIC_LINK],
            network_vlan=nicparams[constants.NIC_VLAN],
            conflicts_check=opts.conflicts_check)
        SubmitOpCode(op, opts=opts, cl=cl)
예제 #2
0
def ConnectNetwork(opts, args):
  """Map a network to a node group.

  @param opts: the command line options selected by the user
  @type args: list
  @param args: Network, mode, physlink and node groups
  @rtype: int
  @return: the desired exit code

  """
  cl = GetClient()

  (network, mode, link) = args[:3]
  groups = _GetDefaultGroups(cl, args[3:])

  # TODO: Change logic to support "--submit"
  for group in groups:
    op = opcodes.OpNetworkConnect(group_name=group,
                                  network_name=network,
                                  network_mode=mode,
                                  network_link=link,
                                  conflicts_check=opts.conflicts_check)
    SubmitOpCode(op, opts=opts, cl=cl)