Revision a4ebd726 scripts/gnt-node

b/scripts/gnt-node
46 46
  ]
47 47

  
48 48

  
49
#: Default field list for L{ListVolumes}
50
_LIST_VOL_DEF_FIELDS = ["node", "phys", "vg", "name", "size", "instance"]
51

  
52

  
49 53
#: default list of field for L{ListStorage}
50 54
_LIST_STOR_DEF_FIELDS = [
51 55
  constants.SF_NODE,
......
188 192
  @return: the desired exit code
189 193

  
190 194
  """
191
  if opts.output is None:
192
    selected_fields = _LIST_DEF_FIELDS
193
  elif opts.output.startswith("+"):
194
    selected_fields = _LIST_DEF_FIELDS + opts.output[1:].split(",")
195
  else:
196
    selected_fields = opts.output.split(",")
195
  selected_fields = ParseFields(opts.output, _LIST_DEF_FIELDS)
197 196

  
198 197
  output = GetClient().QueryNodes(args, selected_fields, opts.do_locking)
199 198

  
......
466 465
  @return: the desired exit code
467 466

  
468 467
  """
469
  if opts.output is None:
470
    selected_fields = ["node", "phys", "vg",
471
                       "name", "size", "instance"]
472
  else:
473
    selected_fields = opts.output.split(",")
468
  selected_fields = ParseFields(opts.output, _LIST_VOL_DEF_FIELDS)
474 469

  
475 470
  op = opcodes.OpQueryNodeVolumes(nodes=args, output_fields=selected_fields)
476 471
  output = SubmitOpCode(op, opts=opts)
......
514 509

  
515 510
  storage_type = ConvertStorageType(opts.user_storage_type)
516 511

  
517
  if opts.output is None:
518
    selected_fields = _LIST_STOR_DEF_FIELDS
519
  elif opts.output.startswith("+"):
520
    selected_fields = _LIST_STOR_DEF_FIELDS + opts.output[1:].split(",")
521
  else:
522
    selected_fields = opts.output.split(",")
512
  selected_fields = ParseFields(opts.output, _LIST_STOR_DEF_FIELDS)
523 513

  
524 514
  op = opcodes.OpQueryNodeStorage(nodes=args,
525 515
                                  storage_type=storage_type,

Also available in: Unified diff