Revision b2fbea47

b/lib/cmdlib/node.py
1312 1312
  REQ_BGL = False
1313 1313

  
1314 1314
  def CheckArguments(self):
1315
    _CheckOutputFields(utils.FieldSet("node", "phys", "vg", "name", "size",
1316
                                      "instance"),
1315
    _CheckOutputFields(utils.FieldSet(constants.VF_NODE, constants.VF_PHYS,
1316
                                      constants.VF_VG, constants.VF_NAME,
1317
                                      constants.VF_SIZE, constants.VF_INSTANCE),
1317 1318
                       self.op.output_fields)
1318 1319

  
1319 1320
  def ExpandNames(self):
......
1351 1352
        continue
1352 1353

  
1353 1354
      node_vols = sorted(nresult.payload,
1354
                         key=operator.itemgetter("dev"))
1355
                         key=operator.itemgetter(constants.VF_DEV))
1355 1356

  
1356 1357
      for vol in node_vols:
1357 1358
        node_output = []
1358 1359
        for field in self.op.output_fields:
1359
          if field == "node":
1360
          if field == constants.VF_NODE:
1360 1361
            val = self.cfg.GetNodeName(node_uuid)
1361
          elif field == "phys":
1362
            val = vol["dev"]
1363
          elif field == "vg":
1364
            val = vol["vg"]
1365
          elif field == "name":
1366
            val = vol["name"]
1367
          elif field == "size":
1368
            val = int(float(vol["size"]))
1369
          elif field == "instance":
1370
            inst = vol2inst.get((node_uuid, vol["vg"] + "/" + vol["name"]),
1371
                                None)
1362
          elif field == constants.VF_PHYS:
1363
            val = vol[constants.VF_DEV]
1364
          elif field == constants.VF_VG:
1365
            val = vol[constants.VF_VG]
1366
          elif field == constants.VF_NAME:
1367
            val = vol[constants.VF_NAME]
1368
          elif field == constants.VF_SIZE:
1369
            val = int(float(vol[constants.VF_SIZE]))
1370
          elif field == constants.VF_INSTANCE:
1371
            inst = vol2inst.get((node_uuid, vol[constants.VF_VG] + "/" +
1372
                                 vol[constants.VF_NAME]), None)
1372 1373
            if inst is not None:
1373 1374
              val = inst.name
1374 1375
            else:
b/lib/constants.py
433 433
  ST_LVM_VG: frozenset([SO_FIX_CONSISTENCY]),
434 434
  }
435 435

  
436
# Volume fields
437
VF_DEV = "dev"
438
VF_INSTANCE = "instance"
439
VF_NAME = "name"
440
VF_NODE = "node"
441
VF_PHYS = "phys"
442
VF_SIZE = "size"
443
VF_VG = "vg"
444

  
436 445
# Local disk status
437 446
# Note: Code depends on LDS_OKAY < LDS_UNKNOWN < LDS_FAULTY
438 447
(LDS_OKAY,

Also available in: Unified diff