Commit 87001920 authored by Iustin Pop's avatar Iustin Pop
Browse files

Allow creating the DRBD metadev in a different VG



This is a simple change to allow specifying a different VG for the
meta device during the creation of instances and addition of disks via
gnt-instance modify.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent c260fa25
......@@ -6592,9 +6592,10 @@ def _GenerateDiskTemplate(lu, template_name,
names.append(lv_prefix + "_meta")
for idx, disk in enumerate(disk_info):
disk_index = idx + base_index
vg = disk.get("vg", vgname)
data_vg = disk.get("vg", vgname)
meta_vg = disk.get("metavg", data_vg)
disk_dev = _GenerateDRBD8Branch(lu, primary_node, remote_node,
disk["size"], [vg, vg],
disk["size"], [data_vg, meta_vg],
names[idx*2:idx*2+2],
"disk/%d" % disk_index,
minors[idx*2], minors[idx*2+1])
......@@ -7477,8 +7478,9 @@ class LUInstanceCreate(LogicalUnit):
except (TypeError, ValueError):
raise errors.OpPrereqError("Invalid disk size '%s'" % size,
errors.ECODE_INVAL)
vg = disk.get("vg", self.cfg.GetVGName())
new_disk = {"size": size, "mode": mode, "vg": vg}
data_vg = disk.get("vg", self.cfg.GetVGName())
meta_vg = disk.get("metavg", data_vg)
new_disk = {"size": size, "mode": mode, "vg": data_vg, "metavg": meta_vg}
if "adopt" in disk:
new_disk["adopt"] = disk["adopt"]
self.disks.append(new_disk)
......
......@@ -729,11 +729,13 @@ IDISK_SIZE = "size"
IDISK_MODE = "mode"
IDISK_ADOPT = "adopt"
IDISK_VG = "vg"
IDISK_METAVG = "metavg"
IDISK_PARAMS_TYPES = {
IDISK_SIZE: VTYPE_SIZE,
IDISK_MODE: VTYPE_STRING,
IDISK_ADOPT: VTYPE_STRING,
IDISK_VG: VTYPE_STRING,
IDISK_METAVG: VTYPE_STRING,
}
IDISK_PARAMS = frozenset(IDISK_PARAMS_TYPES.keys())
......
......@@ -28,7 +28,7 @@ ADD
| **add**
| {-t {diskless | file \| plain \| drbd}}
| {--disk=*N*: {size=*VAL* \| adopt=*LV*}[,vg=*VG*][,mode=*ro\|rw*]
| {--disk=*N*: {size=*VAL* \| adopt=*LV*}[,vg=*VG*][,metavg=*VG*][,mode=*ro\|rw*]
| \| -s *SIZE*}
| [--no-ip-check] [--no-name-check] [--no-start] [--no-install]
| [--net=*N* [:options...] \| --no-nics]
......@@ -49,10 +49,12 @@ The ``disk`` option specifies the parameters for the disks of the
instance. The numbering of disks starts at zero, and at least one disk
needs to be passed. For each disk, either the size or the adoption
source needs to be given, and optionally the access mode (read-only or
the default of read-write) and LVM volume group can also be specified.
The size is interpreted (when no unit is given) in mebibytes. You can
also use one of the suffixes *m*, *g* or *t* to specify the exact the
units used; these suffixes map to mebibytes, gibibytes and tebibytes.
the default of read-write) and the LVM volume group can also be
specified (via the ``vg`` key). For DRBD devices, a different VG can
be specified for the metadata device using the ``metavg`` key. The
size is interpreted (when no unit is given) in mebibytes. You can also
use one of the suffixes *m*, *g* or *t* to specify the exact the units
used; these suffixes map to mebibytes, gibibytes and tebibytes.
When using the ``adopt`` key in the disk definition, Ganeti will
reuse those volumes (instead of creating new ones) as the
......@@ -857,7 +859,7 @@ MODIFY
| [-H *HYPERVISOR\_PARAMETERS*]
| [-B *BACKEND\_PARAMETERS*]
| [--net add*[:options]* \| --net remove \| --net *N:options*]
| [--disk add:size=*SIZE*[,vg=*VG*] \| --disk remove \|
| [--disk add:size=*SIZE*[,vg=*VG*][,metavg=*VG*] \| --disk remove \|
| --disk *N*:mode=*MODE*]
| [-t plain | -t drbd -n *new_secondary*]
| [--os-type=*OS* [--force-variant]]
......@@ -881,10 +883,12 @@ conversion. When changing from the plain to the drbd disk template, a
new secondary node must be specified via the ``-n`` option.
The ``--disk add:size=``*SIZE* option adds a disk to the instance. The
optional ``vg=``*VG* option specifies LVM volume group other than default
vg to create disk on. The ``--disk remove`` option will remove the last
disk of the instance. The ``--disk`` *N*``:mode=``*MODE* option will change
the mode of the Nth disk of the instance between read-only (``ro``) and
optional ``vg=``*VG* option specifies LVM volume group other than
default vg to create the disk on. For DRBD disks, the ``metavg=``*VG*
option specifies the volume group for the metadata device. The
``--disk remove`` option will remove the last disk of the
instance. The ``--disk`` *N*``:mode=``*MODE* option will change the
mode of the Nth disk of the instance between read-only (``ro``) and
read-write (``rw``).
The ``--net add:``*options* option will add a new NIC to the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment