Revision f9193417

b/lib/cmdlib.py
2713 2713
                           logical_id=(vgname, names[1]),
2714 2714
                           iv_name = "sdb")
2715 2715
    disks = [sda_dev, sdb_dev]
2716
  elif template_name == constants.DT_LOCAL_RAID1:
2717
    if len(secondary_nodes) != 0:
2718
      raise errors.ProgrammerError("Wrong template configuration")
2719

  
2720

  
2721
    names = _GenerateUniqueNames(cfg, [".sda_m1", ".sda_m2",
2722
                                       ".sdb_m1", ".sdb_m2"])
2723
    sda_dev_m1 = objects.Disk(dev_type=constants.LD_LV, size=disk_sz,
2724
                              logical_id=(vgname, names[0]))
2725
    sda_dev_m2 = objects.Disk(dev_type=constants.LD_LV, size=disk_sz,
2726
                              logical_id=(vgname, names[1]))
2727
    md_sda_dev = objects.Disk(dev_type=constants.LD_MD_R1, iv_name = "sda",
2728
                              size=disk_sz,
2729
                              children = [sda_dev_m1, sda_dev_m2])
2730
    sdb_dev_m1 = objects.Disk(dev_type=constants.LD_LV, size=swap_sz,
2731
                              logical_id=(vgname, names[2]))
2732
    sdb_dev_m2 = objects.Disk(dev_type=constants.LD_LV, size=swap_sz,
2733
                              logical_id=(vgname, names[3]))
2734
    md_sdb_dev = objects.Disk(dev_type=constants.LD_MD_R1, iv_name = "sdb",
2735
                              size=swap_sz,
2736
                              children = [sdb_dev_m1, sdb_dev_m2])
2737
    disks = [md_sda_dev, md_sdb_dev]
2738
  elif template_name == constants.DT_REMOTE_RAID1:
2739
    if len(secondary_nodes) != 1:
2740
      raise errors.ProgrammerError("Wrong template configuration")
2741
    remote_node = secondary_nodes[0]
2742
    names = _GenerateUniqueNames(cfg, [".sda_data", ".sda_meta",
2743
                                       ".sdb_data", ".sdb_meta"])
2744
    drbd_sda_dev = _GenerateMDDRBDBranch(cfg, primary_node, remote_node,
2745
                                         disk_sz, names[0:2])
2746
    md_sda_dev = objects.Disk(dev_type=constants.LD_MD_R1, iv_name="sda",
2747
                              children = [drbd_sda_dev], size=disk_sz)
2748
    drbd_sdb_dev = _GenerateMDDRBDBranch(cfg, primary_node, remote_node,
2749
                                         swap_sz, names[2:4])
2750
    md_sdb_dev = objects.Disk(dev_type=constants.LD_MD_R1, iv_name="sdb",
2751
                              children = [drbd_sdb_dev], size=swap_sz)
2752
    disks = [md_sda_dev, md_sdb_dev]
2753 2716
  elif template_name == constants.DT_DRBD8:
2754 2717
    if len(secondary_nodes) != 1:
2755 2718
      raise errors.ProgrammerError("Wrong template configuration")
......
2960 2923
    req_size_dict = {
2961 2924
      constants.DT_DISKLESS: None,
2962 2925
      constants.DT_PLAIN: self.op.disk_size + self.op.swap_size,
2963
      constants.DT_LOCAL_RAID1: (self.op.disk_size + self.op.swap_size) * 2,
2964 2926
      # 256 MB are added for drbd metadata, 128MB for each drbd device
2965
      constants.DT_REMOTE_RAID1: self.op.disk_size + self.op.swap_size + 256,
2966 2927
      constants.DT_DRBD8: self.op.disk_size + self.op.swap_size + 256,
2967 2928
    }
2968 2929

  
b/man/gnt-instance.sgml
85 85
          <arg choice="req">-t<group>
86 86
              <arg>diskless</arg>
87 87
              <arg>plain</arg>
88
              <arg>local_raid1</arg>
89
              <arg>remote_raid1</arg>
90 88
              <arg>drbd</arg>
91 89
            </group>
92 90
          </arg>
......
237 235
              </listitem>
238 236
            </varlistentry>
239 237
            <varlistentry>
240
              <term>local_raid1</term>
241
              <listitem>
242
                <para>
243
                  Disk devices will be md raid1 arrays over two local
244
                  logical volumes.
245
                </para>
246
              </listitem>
247
            </varlistentry>
248
            <varlistentry>
249
              <term>remote_raid1</term>
250
              <listitem>
251
                <para>
252
                  Disk devices will be md raid1 arrays with one
253
                  component (so it's not actually raid1): a drbd
254
                  (0.7.x) device between the instance's primary node
255
                  and the node given by the second value of the
256
                  <option>--node</option> option.
257
                </para>
258
              </listitem>
259
            </varlistentry>
260
            <varlistentry>
261 238
              <term>drbd</term>
262 239
              <listitem>
263 240
                <para>
264 241
                  Disk devices will be drbd (version 8.x) on top of
265
                  lvm volumes. They are equivalent in functionality to
266
                  <replaceable>remote_raid1</replaceable>, but are
267
                  recommended for new instances (if you have drbd 8.x
268
                  installed).
242
                  lvm volumes.
269 243
                </para>
270 244
              </listitem>
271 245
            </varlistentry>
......
288 262
          <screen>
289 263
# gnt-instance add -t plain -s 30g -m 512 -o debian-etch \
290 264
  -n node1.example.com instance1.example.com
291
# gnt-instance add -t remote_raid1 -s 30g -m 512 -o debian-etch \
265
# gnt-instance add -t drbd -s 30g -m 512 -o debian-etch \
292 266
  -n node1.example.com:node2.example.com instance2.example.com
293 267
          </screen>
294 268
        </para>
b/qa/ganeti-qa.py
268 268
      RunTest(qa_instance.TestInstanceRemove, instance)
269 269
      del instance
270 270

  
271
    if qa_config.TestEnabled('instance-add-local-mirror-disk'):
272
      instance = RunTest(qa_instance.TestInstanceAddWithLocalMirrorDisk, pnode)
273
      RunCommonInstanceTests(instance)
274
      RunExportImportTests(instance, pnode)
275
      RunTest(qa_instance.TestInstanceRemove, instance)
276
      del instance
277

  
278 271
    multinode_tests = [
279
      ('instance-add-remote-raid-disk',
280
       qa_instance.TestInstanceAddWithRemoteRaidDisk),
281 272
      ('instance-add-drbd-disk',
282 273
       qa_instance.TestInstanceAddWithDrbdDisk),
283 274
    ]
b/qa/qa-sample.yaml
49 49
  node-failover: False
50 50

  
51 51
  instance-add-plain-disk: True
52
  instance-add-local-mirror-disk: True
53

  
54
  # Requires DRBD 0.7.x
55
  instance-add-remote-raid-disk: True
56 52

  
57 53
  # Requires DRBD 8.x
58
  instance-add-drbd-disk: False
54
  instance-add-drbd-disk: True
59 55

  
60 56
  instance-list: True
61 57
  instance-failover: True
......
76 72
# Other settings
77 73
options:
78 74
  burnin-instances: 2
79
  burnin-disk-template: remote_raid1
75
  burnin-disk-template: drbd
80 76

  
81 77
  # Directory containing QA hooks
82 78
  #hooks-dir: hooks/
b/qa/qa_cluster.py
156 156
  master = qa_config.GetMasterNode()
157 157

  
158 158
  disk_template = (qa_config.get('options', {}).
159
                   get('burnin-disk-template', 'remote_raid1'))
159
                   get('burnin-disk-template', 'drbd'))
160 160

  
161 161
  # Get as many instances as we need
162 162
  instances = []
b/qa/qa_config.py
54 54
  if len(cfg['instances']) < 1:
55 55
    raise qa_error.Error("Need at least one instance")
56 56

  
57
  if (TestEnabled('instance-add-remote-raid-disk') and
58
      TestEnabled('instance-add-drbd-disk')):
59
    raise qa_error.Error('Tests for disk templates remote_raid1 and drbd'
60
                         ' cannot be enabled at the same time.')
61

  
62 57

  
63 58
def get(name, default=None):
64 59
  return cfg.get(name, default)
b/qa/qa_instance.py
72 72
  return _DiskTest(node['primary'], 'plain')
73 73

  
74 74

  
75
@qa_utils.DefineHook('instance-add-local-mirror-disk')
76
def TestInstanceAddWithLocalMirrorDisk(node):
77
  """gnt-instance add -t local_raid1"""
78
  return _DiskTest(node['primary'], 'local_raid1')
79

  
80

  
81
@qa_utils.DefineHook('instance-add-remote-raid-disk')
82
def TestInstanceAddWithRemoteRaidDisk(node, node2):
83
  """gnt-instance add -t remote_raid1"""
84
  return _DiskTest("%s:%s" % (node['primary'], node2['primary']),
85
                   'remote_raid1')
86

  
87

  
88 75
@qa_utils.DefineHook('instance-add-drbd-disk')
89 76
def TestInstanceAddWithDrbdDisk(node, node2):
90 77
  """gnt-instance add -t drbd"""
b/scripts/gnt-instance
726 726
  make_option("-p", "--cpu", dest="vcpus", help="Number of virtual CPUs",
727 727
              default=1, type="int", metavar="<PROC>"),
728 728
  make_option("-t", "--disk-template", dest="disk_template",
729
              help="Custom disk setup (diskless, plain, local_raid1,"
730
              " remote_raid1 or drbd)", default=None, metavar="TEMPL"),
729
              help="Custom disk setup (diskless, plain, or drbd)",
730
              default=None, metavar="TEMPL"),
731 731
  make_option("-i", "--ip", dest="ip",
732 732
              help="IP address ('none' [default], 'auto', or specify address)",
733 733
              default='none', type="string", metavar="<ADDRESS>"),
b/tools/burnin
131 131
                      help="Skip instance stop/start", action="store_false",
132 132
                      default=True)
133 133
    parser.add_option("-t", "--disk-template", dest="disk_template",
134
                      choices=("diskless", "plain", "remote_raid1", "drbd"),
135
                      default="remote_raid1",
136
                      help="Template type for network mirroring (remote_raid1"
137
                      " or drbd) [remote_raid1]")
134
                      choices=("diskless", "plain", "drbd"),
135
                      default="drbd",
136
                      help="Disk template (diskless, plain or drbd) [drbd]")
138 137
    parser.add_option("-n", "--nodes", dest="nodes", default="",
139 138
                      help="Comma separated list of nodes to perform"
140 139
                      " the burnin on (defaults to all nodes)")
......
143 142
    if len(args) < 1 or options.os is None:
144 143
      Usage()
145 144

  
146
    supported_disk_templates = (constants.DT_DISKLESS, constants.DT_PLAIN,
147
                                constants.DT_REMOTE_RAID1,
145
    supported_disk_templates = (constants.DT_DISKLESS,
146
                                constants.DT_PLAIN,
148 147
                                constants.DT_DRBD8)
149 148
    if options.disk_template not in supported_disk_templates:
150 149
      Log("Unknown disk template '%s'" % options.disk_template)
......
219 218
      self.ExecOp(op)
220 219
      self.to_rem.append(instance)
221 220

  
222
  def ReplaceDisks1R1(self):
223
    """Replace disks with the same secondary for rr1."""
224
    # replace all, both disks
225
    for instance in self.instances:
226
      op = opcodes.OpReplaceDisks(instance_name=instance,
227
                                  remote_node=None,
228
                                  mode=constants.REPLACE_DISK_ALL,
229
                                  disks=["sda", "sdb"])
230

  
231
      Log("- Replace disks for instance %s" % (instance))
232
      self.ExecOp(op)
233

  
234 221
  def ReplaceDisks1D8(self):
235 222
    """Replace disks on primary and secondary for drbd8."""
236 223
    for instance in self.instances:
......
243 230

  
244 231
  def ReplaceDisks2(self):
245 232
    """Replace secondary node."""
246
    if self.opts.disk_template == constants.DT_REMOTE_RAID1:
247
      mode = constants.REPLACE_DISK_ALL
248
    else:
249
      mode = constants.REPLACE_DISK_SEC
233
    mode = constants.REPLACE_DISK_SEC
250 234

  
251 235
    mytor = izip(islice(cycle(self.nodes), 2, None),
252 236
                 self.instances)
......
352 336
    try:
353 337
      self.CreateInstances()
354 338
      if opts.do_replace1 and opts.disk_template in constants.DTS_NET_MIRROR:
355
        if opts.disk_template == constants.DT_REMOTE_RAID1:
356
          self.ReplaceDisks1R1()
357
        elif opts.disk_template == constants.DT_DRBD8:
358
          self.ReplaceDisks1D8()
339
        self.ReplaceDisks1D8()
359 340
      if (opts.do_replace2 and len(self.nodes) > 2 and
360 341
          opts.disk_template in constants.DTS_NET_MIRROR) :
361 342
        self.ReplaceDisks2()

Also available in: Unified diff