Revision fe96220b lib/objects.py

b/lib/objects.py
314 314

  
315 315
  def CreateOnSecondary(self):
316 316
    """Test if this device needs to be created on a secondary node."""
317
    return self.dev_type in ("drbd", "lvm")
317
    return self.dev_type in (constants.LD_DRBD7, constants.LD_LV)
318 318

  
319 319
  def AssembleOnSecondary(self):
320 320
    """Test if this device needs to be assembled on a secondary node."""
321
    return self.dev_type in ("drbd", "lvm")
321
    return self.dev_type in (constants.LD_DRBD7, constants.LD_LV)
322 322

  
323 323
  def OpenOnSecondary(self):
324 324
    """Test if this device needs to be opened on a secondary node."""
325
    return self.dev_type in ("lvm",)
325
    return self.dev_type in (constants.LD_LV,)
326 326

  
327 327
  def GetNodes(self, node):
328 328
    """This function returns the nodes this device lives on.
......
333 333
    devices needs to (or can) be assembled.
334 334

  
335 335
    """
336
    if self.dev_type == "lvm" or self.dev_type == "md_raid1":
336
    if self.dev_type == constants.LD_LV or self.dev_type == constants.LD_MD_R1:
337 337
      result = [node]
338
    elif self.dev_type == "drbd":
338
    elif self.dev_type == constants.LD_DRBD7:
339 339
      result = [self.logical_id[0], self.logical_id[1]]
340 340
      if node not in result:
341 341
        raise errors.ConfigurationError("DRBD device passed unknown node")
......
436 436
    """
437 437
    def _Helper(primary, sec_nodes, device):
438 438
      """Recursively computes secondary nodes given a top device."""
439
      if device.dev_type == 'drbd':
439
      if device.dev_type == constants.LD_DRBD7:
440 440
        nodea, nodeb, dummy = device.logical_id
441 441
        if nodea == primary:
442 442
          candidate = nodeb
......
485 485
      devs = self.disks
486 486

  
487 487
    for dev in devs:
488
      if dev.dev_type == "lvm":
488
      if dev.dev_type == constants.LD_LV:
489 489
        lvmap[node].append(dev.logical_id[1])
490 490

  
491
      elif dev.dev_type == "drbd":
491
      elif dev.dev_type == constants.LD_DRBD7:
492 492
        if dev.logical_id[0] not in lvmap:
493 493
          lvmap[dev.logical_id[0]] = []
494 494

  

Also available in: Unified diff