Brian Candler (b.candler) writes:
> Looking into this a bit more (with 2.15.2):
>
> - an instance must have a single disk_template: there is not a separate
> template for each disk
That's right, but you can mix ext provider when using ext as the
template -- so you can create an instance with one disk with one
provider, and the second disk using another provider (both ext):
# gnt-instance add -n vm1 -o noop --no-start --no-install --no-name-check --no-ip-check -t ext --disk 0:size=1G,provider=rbd-ssd,access=userspace disk-dummy
Thu Feb 11 10:39:52 2021 * disk 0, size 1.0G
Thu Feb 11 10:39:52 2021 * creating instance disks...
Thu Feb 11 10:39:53 2021 adding instance disk-dummy to cluster config
Thu Feb 11 10:39:53 2021 adding disks to cluster config
Thu Feb 11 10:39:54 2021 - INFO: Waiting for instance disk-dummy to sync disks
Thu Feb 11 10:39:54 2021 - INFO: Instance disk-dummy's disks are in sync
# gnt-instance modify --disk 1:add,provider=zfs,size=2G disk-dummy
Thu Feb 11 10:40:51 2021 * disk 1, size 2.0G
Thu Feb 11 10:40:52 2021 - INFO: Waiting for instance disk-dummy to sync disks
Thu Feb 11 10:40:52 2021 - INFO: Instance disk-dummy's disks are in sync
Modified instance disk-dummy
- disk/1 -> add:size=2048,mode=rw
# gnt-instance info disk-dummy
[...]
Disks:
- disk/0: ext, size 1.0G
access mode: rw
logical_id: ['rbd-ssd', 'fa7955f5-ca8b-4e11-8221-238818597de4.ext.disk0']
on primary: /dev/rbd7 (252:112)
name: None
UUID: 1ea0ae4a-33a2-4407-8d5e-f0559382c8d3
- disk/1: ext, size 2.0G
access mode: rw
logical_id: ['zfs', 'ca727632-cfc8-4b0b-a50d-c3c26fad11d3.ext.disk1']
on primary: /dev/zvol/zfs/vm/ca727632-cfc8-4b0b-a50d-c3c26fad11d3.ext.disk1 (230:0)
name: None
UUID: bd5a42fc-42b4-436a-bd1d-2f0485251837
[...]
# gnt-instance list -o name,disk_template,disk.size/0,disk.size/1 disk-dummy
Instance Disk_template Disk/0 Disk/1
disk-dummy ext 1.0G 2.0G
... and yes, it starts fine, I use this in production :) It's actually a simple
way to work around the limitations of the disk architecture in Ganeti,
assuming you don't want that instance to have both DRBD and ext (which
could be useful: system disk on drbd SSD, data disk on RBD CEPH).
Side note: when modifying an instance to add disks, say:
1. gnt-instance create ... --disk 0:size=1G
2. gnt-instance modify --disk add 1:size=2G
3. gnt-instance modify --disk add 1:size=3G
... and you specify disk 1 twice as above, you end up with:
Instance Disk_template Disk/0 Disk/1 Disk/2
disk-dummy ext 1.0G 3.0G 2.0G
This is actually consistent with 'gnt-instance modify disk X:remove' which
will also renumber the disk units and shift all X+n disks one down -- but
better be careful when adding/removing disks which disk you are
manipulating :)
> So the only way to find the UUID of my missing disk seems to be "jq .disks
> /var/lib/ganeti/config.data"
>
> OK, I found it. Can I reattach it? Nope, because the instance is now
> using the "diskless" template:
Ah that's interesting.
> Neither can I attach it to some other instance whose existing template is
> "ext":
>
> root@nuc1:~# *gnt-instance modify --disk
> 1:attach,uuid=31cf98b3-e5b1-4823-843b-30659a2c9f65
elk.home.example.net*
> Failure: prerequisites not met for this operation:
> error type: wrong_input, error details:
> Missing provider for template 'ext'
... but that's becase you didn't specify the ext provider template ?
What storage template is '
elk.home.example.net' using ?
> But I *can* attach it to some other instance which already has a disk *and*
> is using template "plain":
>
> root@nuc1:~# *gnt-instance modify --disk
> 1:attach,uuid=31cf98b3-e5b1-4823-843b-30659a2c9f65 bar*
Ok, that's somewhat useful.
> So I'd say that the disk design document
> <
https://docs.ganeti.org/docs/ganeti/3.0/html/design-disks.html> has only
> been partially implemented. In particular:
>
> - you can't mix disks of different types on an instance
> - unless it's lurking in a non-obvious place, you can't list detached disks
> - you can't do other operations on detached disks (e.g. create them, delete
> them, tag them, change their type)
I think some of this work happened around the time the internal Ganeti
group at Google was being reassigned to other tasks, and it was never
finalized.
Cheers,
Phil