Revision 88f8f0f7

b/lib/client/gnt_instance.py
341 341
                                   required_field, errors.ECODE_INVAL)
342 342
    # Validate special fields
343 343
    if spec['primary_node'] is not None:
344
      if (spec['template'] in constants.DTS_NET_MIRROR and
344
      if (spec['template'] in constants.DTS_INT_MIRROR and
345 345
          spec['secondary_node'] is None):
346 346
        raise errors.OpPrereqError('Template requires secondary node, but'
347 347
                                   ' there was no secondary provided.',
......
1291 1291
      disk_dict['size'] = utils.ParseUnit(disk_dict['size'])
1292 1292

  
1293 1293
  if (opts.disk_template and
1294
      opts.disk_template in constants.DTS_NET_MIRROR and
1294
      opts.disk_template in constants.DTS_INT_MIRROR and
1295 1295
      not opts.node):
1296 1296
    ToStderr("Changing the disk template to a mirrored one requires"
1297 1297
             " specifying a secondary node")
b/lib/cmdlib.py
2316 2316
               utils.CommaJoin(inst_config.secondary_nodes),
2317 2317
               code=self.ETYPE_WARNING)
2318 2318

  
2319
      if inst_config.disk_template in constants.DTS_NET_MIRROR:
2319
      if inst_config.disk_template in constants.DTS_INT_MIRROR:
2320 2320
        pnode = inst_config.primary_node
2321 2321
        instance_nodes = utils.NiceSort(inst_config.all_nodes)
2322 2322
        instance_groups = {}
......
4369 4369
      if self.needed_locks[locking.LEVEL_NODE] is not locking.ALL_SET:
4370 4370
        for instance_name in self.acquired_locks[locking.LEVEL_INSTANCE]:
4371 4371
          instance = self.context.cfg.GetInstanceInfo(instance_name)
4372
          i_mirrored = instance.disk_template in constants.DTS_NET_MIRROR
4372
          i_mirrored = instance.disk_template in constants.DTS_INT_MIRROR
4373 4373
          if i_mirrored and self.op.node_name in instance.all_nodes:
4374 4374
            instances_keep.append(instance_name)
4375 4375
            self.affected_instances.append(instance)
......
5709 5709
      "NEW_PRIMARY": self.op.target_node,
5710 5710
      }
5711 5711

  
5712
    if instance.disk_template in constants.DTS_NET_MIRROR:
5712
    if instance.disk_template in constants.DTS_INT_MIRROR:
5713 5713
      env["OLD_SECONDARY"] = instance.secondary_nodes[0]
5714 5714
      env["NEW_SECONDARY"] = source_node
5715 5715
    else:
......
5935 5935
        "NEW_PRIMARY": target_node,
5936 5936
        })
5937 5937

  
5938
    if instance.disk_template in constants.DTS_NET_MIRROR:
5938
    if instance.disk_template in constants.DTS_INT_MIRROR:
5939 5939
      env["OLD_SECONDARY"] = target_node
5940 5940
      env["NEW_SECONDARY"] = source_node
5941 5941
    else:
......
6434 6434
                       " primary node (%s)" % source_node)
6435 6435
      demoted_node = target_node
6436 6436

  
6437
    if instance.disk_template in constants.DTS_NET_MIRROR:
6437
    if instance.disk_template in constants.DTS_INT_MIRROR:
6438 6438
      self._EnsureSecondary(demoted_node)
6439 6439
      try:
6440 6440
        self._WaitUntilSync()
......
6594 6594
    self.source_node = self.instance.primary_node
6595 6595

  
6596 6596
    # FIXME: if we implement migrate-to-any in DRBD, this needs fixing
6597
    if self.instance.disk_template in constants.DTS_NET_MIRROR:
6597
    if self.instance.disk_template in constants.DTS_INT_MIRROR:
6598 6598
      self.target_node = self.instance.secondary_nodes[0]
6599 6599
      # Otherwise self.target_node has been populated either
6600 6600
      # directly, or through an iallocator.
......
7204 7204
    _CheckIAllocatorOrNode(self, "iallocator", "pnode")
7205 7205

  
7206 7206
    if self.op.pnode is not None:
7207
      if self.op.disk_template in constants.DTS_NET_MIRROR:
7207
      if self.op.disk_template in constants.DTS_INT_MIRROR:
7208 7208
        if self.op.snode is None:
7209 7209
          raise errors.OpPrereqError("The networked disk templates need"
7210 7210
                                     " a mirror node", errors.ECODE_INVAL)
......
7764 7764
    self.secondaries = []
7765 7765

  
7766 7766
    # mirror node verification
7767
    if self.op.disk_template in constants.DTS_NET_MIRROR:
7767
    if self.op.disk_template in constants.DTS_INT_MIRROR:
7768 7768
      if self.op.snode == pnode.name:
7769 7769
        raise errors.OpPrereqError("The secondary node cannot be the"
7770 7770
                                   " primary node.", errors.ECODE_INVAL)
......
7971 7971

  
7972 7972
    if self.op.wait_for_sync:
7973 7973
      disk_abort = not _WaitForSync(self, iobj)
7974
    elif iobj.disk_template in constants.DTS_NET_MIRROR:
7974
    elif iobj.disk_template in constants.DTS_INT_MIRROR:
7975 7975
      # make sure the disks are not degraded (still sync-ing is ok)
7976 7976
      time.sleep(15)
7977 7977
      feedback_fn("* checking mirrors status")
......
9296 9296
                                 errors.ECODE_INVAL)
9297 9297

  
9298 9298
    if (self.op.disk_template and
9299
        self.op.disk_template in constants.DTS_NET_MIRROR and
9299
        self.op.disk_template in constants.DTS_INT_MIRROR and
9300 9300
        self.op.remote_node is None):
9301 9301
      raise errors.OpPrereqError("Changing the disk template to a mirrored"
9302 9302
                                 " one requires specifying a secondary node",
......
9456 9456
                                                  self.op.disk_template),
9457 9457
                                   errors.ECODE_INVAL)
9458 9458
      _CheckInstanceDown(self, instance, "cannot change disk template")
9459
      if self.op.disk_template in constants.DTS_NET_MIRROR:
9459
      if self.op.disk_template in constants.DTS_INT_MIRROR:
9460 9460
        if self.op.remote_node == pnode:
9461 9461
          raise errors.OpPrereqError("Given new secondary node %s is the same"
9462 9462
                                     " as the primary node of the instance" %
......
10445 10445
    In particular, it returns information about newly split instances, and
10446 10446
    instances that were already split, and remain so after the change.
10447 10447

  
10448
    Only instances whose disk template is listed in constants.DTS_NET_MIRROR are
10448
    Only instances whose disk template is listed in constants.DTS_INT_MIRROR are
10449 10449
    considered.
10450 10450

  
10451 10451
    @type changes: list of (node_name, new_group_uuid) pairs.
......
10468 10468
      return [instance.primary_node] + list(instance.secondary_nodes)
10469 10469

  
10470 10470
    for inst in instance_data.values():
10471
      if inst.disk_template not in constants.DTS_NET_MIRROR:
10471
      if inst.disk_template not in constants.DTS_INT_MIRROR:
10472 10472
        continue
10473 10473

  
10474 10474
      instance_nodes = InstanceNodes(inst)
......
11376 11376
    """
11377 11377
    disk_space = _ComputeDiskSize(self.disk_template, self.disks)
11378 11378

  
11379
    if self.disk_template in constants.DTS_NET_MIRROR:
11379
    if self.disk_template in constants.DTS_INT_MIRROR:
11380 11380
      self.required_nodes = 2
11381 11381
    else:
11382 11382
      self.required_nodes = 1
......
11413 11413
      raise errors.OpPrereqError("Can't relocate non-mirrored instances",
11414 11414
                                 errors.ECODE_INVAL)
11415 11415

  
11416
    if instance.disk_template in constants.DTS_NET_MIRROR and \
11416
    if instance.disk_template in constants.DTS_INT_MIRROR and \
11417 11417
        len(instance.secondary_nodes) != 1:
11418 11418
      raise errors.OpPrereqError("Instance has not exactly one secondary node",
11419 11419
                                 errors.ECODE_STATE)
b/lib/constants.py
367 367
DT_BLOCK = "blockdev"
368 368

  
369 369
# the set of network-mirrored disk templates
370
DTS_NET_MIRROR = frozenset([DT_DRBD8])
370
DTS_INT_MIRROR = frozenset([DT_DRBD8])
371 371

  
372 372
# the set of externally-mirrored disk templates (e.g. SAN, NAS)
373 373
DTS_EXT_MIRROR = frozenset([DT_SHARED_FILE, DT_BLOCK])
......
385 385
DTS_MUST_ADOPT = frozenset([DT_BLOCK])
386 386

  
387 387
# the set of disk templates that allow migrations
388
DTS_MIRRORED = frozenset.union(DTS_NET_MIRROR, DTS_EXT_MIRROR)
388
DTS_MIRRORED = frozenset.union(DTS_INT_MIRROR, DTS_EXT_MIRROR)
389 389

  
390 390

  
391 391
# logical disk types
b/tools/burnin
552 552
      if self.opts.iallocator:
553 553
        pnode = snode = None
554 554
        msg = "with iallocator %s" % self.opts.iallocator
555
      elif self.opts.disk_template not in constants.DTS_NET_MIRROR:
555
      elif self.opts.disk_template not in constants.DTS_INT_MIRROR:
556 556
        snode = None
557 557
        msg = "on %s" % pnode
558 558
      else:
......
700 700
        import_log_msg = ("import from %s"
701 701
                          " with iallocator %s" %
702 702
                          (enode, self.opts.iallocator))
703
      elif self.opts.disk_template not in constants.DTS_NET_MIRROR:
703
      elif self.opts.disk_template not in constants.DTS_INT_MIRROR:
704 704
        snode = None
705 705
        import_log_msg = ("import from %s to %s" %
706 706
                          (enode, pnode))
......
990 990
    has_err = True
991 991
    try:
992 992
      self.BurnCreateInstances()
993
      if opts.do_replace1 and opts.disk_template in constants.DTS_NET_MIRROR:
993
      if opts.do_replace1 and opts.disk_template in constants.DTS_INT_MIRROR:
994 994
        self.BurnReplaceDisks1D8()
995 995
      if (opts.do_replace2 and len(self.nodes) > 2 and
996
          opts.disk_template in constants.DTS_NET_MIRROR) :
996
          opts.disk_template in constants.DTS_INT_MIRROR) :
997 997
        self.BurnReplaceDisks2()
998 998

  
999 999
      if (opts.disk_template in constants.DTS_GROWABLE and

Also available in: Unified diff