Project

General

Profile

Actions

Bug #13784

open

zoneadm clone does not respect "-m copy" parameter

Added by Stephan Althaus 7 months ago. Updated 7 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

zoneadm does not properly parse the command line parameters.

  1. zoneadm -z mail2 clone -m copy mail
    /usr/lib/brand/ipkg/clone: -m: 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.

Actions #1

Updated by Stephan Althaus 7 months ago

As the "zfs clone" is carried out in the brand-specific script, i think

/usr/src/lib/brand/solaris10/zone/clone.ksh

is not capable of a zfs copy at the moment.

Actions #2

Updated by Stephan Althaus 7 months ago

Ok, i am thinking of this:
->clone.ksh ( origin: local OI installation )

...
  1. Other brand clone options are invalid for this brand.
    while getopts "R:s:Xz:m:" opt; do
    case $opt in
    R) ZONEPATH="$OPTARG" ;;
    s) case "$OPTARG" in
    *@*) # Full snapshot name was provided, or just "@snap" # Split this into dataset name (even if empty) and # snapshot name (also may be empty)
    SNAPNAME="`echo "$OPTARG" | sed 's/^[^]*//'`"
    REQUESTED_DS="`echo "$OPTARG" | sed 's/\([^]*\).*$/\1/'`"
    ;;
    */*) # Only dataset name was passed, so we will make a # snapshot there automatically and clone off it
    SNAPNAME=""
    REQUESTED_DS="$OPTARG"
    ;;
    *) # Only snapshot name was passed, so we will clone # the source zone's active ZBE and this snapshot
    SNAPNAME="$OPTARG"
    REQUESTED_DS=""
    ;;
    esac
    ;;
    X) NO_SYSUNCONFIG=yes ;;
    z) ZONENAME="$OPTARG" ;;
    m) DOZFSCOPY=yes ;;
    *) fail_usage "";;
    esac
    done

...

  1. do clone
    BENAME=zbe
    BENUM=0
    while [ $BENUM lt 100 ]; do
    if [ -z "$DOZFSCOPY" ]; then
    /usr/sbin/zfs clone $ACTIVE_DS@$SNAPNAME $zpds/$zpname/ROOT/$BENAME ;
    else
    /usr/sbin/zfs send $ACTIVE_DS@$SNAPNAME | /usr/sbin/zfs receive -v $zpds/$zpname/ROOT/$BENAME ;
    fi
    if [ $? = 0 ]; then
    break
    fi
    BENUM=`expr $BENUM + 1`
    BENAME="zbe
    $BENUM"
    done
Actions #3

Updated by Stephan Althaus 7 months ago

hmm. it seems that i can't find the correct source of my local file

/usr/lib/brand/ipkg/clone

it is NOT

illumos-gate/usr/src/lib/brand/solaris10/zone/clone.ksh

??

Actions

Also available in: Atom PDF