Bug #1204
closedzoneadm cannot create clone of zone from snapshot
100%
Description
Bug from https://defect.opensolaris.org/bz/show_bug.cgi?id=5940 still exist, i.e.:
~# zoneadm -z test2 clone -s rpool/zones/test/ROOT/zbe-1@test_snap
/usr/lib/brand/ipkg/clone: -s: unknown option
brand-specific usage: clone {sourcezone}
usage: clone [-m method] [-s <ZFS snapshot>] [brand-specific args] zonename
Clone the installation of another zone. The -m option can be used to
specify 'copy' which forces a copy of the source zone. The -s option
can be used to specify the name of a ZFS snapshot that was taken from
a previous clone command. The snapshot will be used as the source
instead of creating a new ZFS snapshot. All other arguments are passed
to the brand clone function; see brands(5) for more information.
Files
Updated by Alexander Eremin almost 12 years ago
while pkg doesn't provide these options in brand "clone" script, we must do not use brand hook or remove this call from zoneadm..
Updated by Rich Lowe almost 12 years ago
- Project changed from illumos gate to OpenIndiana Distribution
Most of the ipkg brand (including this bit) is in the pkg-gate, not illumos.
Updated by Chris Jordan almost 12 years ago
- Category set to PKG (Image Packaging System)
- Assignee set to OI PKG
- Tags changed from needs-triage to clone
Updated by Jim Klimov over 9 years ago
This patch was made and tested in OI 151a8, works for both specified full snapshot names (dataset part loudly ignored) or just snapshot name.
Patch markup is mangled by the tracker, so uploading as file.
Updated by Jim Klimov over 9 years ago
- File ips-clone.patch ips-clone.patch added
- Status changed from New to Feedback
- % Done changed from 0 to 80
Awaiting comments on mailing list...
Updated by Jim Klimov over 9 years ago
Test results:
- Make origin, prepare zone configs beforehand
- zfs snapshot -r pond/zones/_ips/DUMMY/DUMMY-fullroot@20131109-02
- Clone by snapshot name
- zoneadm -z ns-master clone -s 20131109-02 DUMMY-fullroot
- Clone by dataset@snap (dataset ignored, because active dataset is found automatically)
- zoneadm -z mysql3 clone -s rpool@20131109-02 DUMMY-fullroot
WARNING: Ignoring dataset, using only snapshot name
- zfs list
o origin,name -r pond/zones/_ips/dbms/mysql3pond/zones/_ips/dbms/mysql3
ORIGIN NAME
- pond/zones/_ips/dbms/mysql3/ROOT
pond/zones/_ips/DUMMY/DUMMY-fullroot/ROOT/zbe@20131109-02 pond/zones/_ips/dbms/mysql3/ROOT/zbe
It may be argued that the dataset part should not be ignored, and not the "active" zone root should be cloned but literally the provided dataset (should then be "$ZONENAME/ROOT/zbe-*"). This is not currently implemented, but can be done with little effort if deemed desirable.
Updated by Jim Klimov over 9 years ago
- File ips-clone.patch ips-clone.patch added
- % Done changed from 80 to 90
Updated the patch. Now it supports cloning from a different zone boot environment of the same zone by accepting the following values for "-s" (snapshot):
1) @* - such strings are interpreted as dataset@snapname, including an empty dataset part (only "@snapname" is then accepted for currently active source ZBE)
2) */ - such strings specify the dataset, of which a snapshot will be made and used automatically
3) * - any other strings specify the snapshot name, which should exist of the currently active source zone root
Sanity checks are done that the specified source dataset (if specified) conforms to the naming and attributes of ZBE's, and is a ZBE of the specified source zone, and that a snapshot (if specified) exists in the selected source dataset.
Also added is a "-X" 'brand-specific argument' which allows to disable "sys-unconfig" in the newly cloned zone. Sometimes admins and their carefully prepared template zones know better ;)
I did not find the relevant manpages where these bits of information could be added; otherwise the task is tested and complete as far as I am concerned.
Updated by Jim Klimov over 9 years ago
- File ips-clone.patch ips-clone.patch added
After addressing some review by Cedric Blancher (mostly to add comments, ultimately) and applying a few minor fixes such as ensuring that the new zone stays mounted even if it was not sys-unconfig'ed, I made this new patch.
Updated by Jim Klimov over 9 years ago
- File sol10-clone.patch sol10-clone.patch added
On a related note, here is a similar patch for "solaris10" branded zones (/usr/lib/brand/solaris10/clone which should be part of illumos-gate). Unfortunately, I can't create and test a solaris10 zone at the moment, so this patch is "theoretical" and untested. It supports the same logic for source snapshot naming and for optional avoidance of sys-unconfig (-X).
Updated by Jon Tibble over 9 years ago
- Status changed from Feedback to Resolved
- % Done changed from 90 to 100
Fixed in a9.