0012-Add-image-name-as-label-when-creating-filesystem.patch
src/datastore_mad/remotes/ceph/mkfs | ||
---|---|---|
54 | 54 |
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/POOL_NAME \ |
55 | 55 |
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/STAGING_DIR \ |
56 | 56 |
/DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \ |
57 |
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE) |
|
57 |
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE \ |
|
58 |
/DS_DRIVER_ACTION_DATA/IMAGE/NAME) |
|
58 | 59 | |
59 | 60 |
unset i |
60 | 61 | |
... | ... | |
67 | 68 |
STAGING_DIR="${XPATH_ELEMENTS[i++]:-$STAGING_DIR}" |
68 | 69 |
FSTYPE="${XPATH_ELEMENTS[i++]}" |
69 | 70 |
SIZE="${XPATH_ELEMENTS[i++]}" |
71 |
NAME="${XPATH_ELEMENTS[i++]}" |
|
70 | 72 | |
71 | 73 |
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" |
72 | 74 | |
... | ... | |
85 | 87 | |
86 | 88 |
# ------------ Create the image in the repository ------------ |
87 | 89 | |
88 |
MKFS_CMD=`mkfs_command $TMP_DST $FSTYPE $SIZE` |
|
90 |
MKFS_CMD=`mkfs_command $TMP_DST $FSTYPE $SIZE $NAME`
|
|
89 | 91 | |
90 | 92 |
REGISTER_CMD=$(cat <<EOF |
91 | 93 |
set -e |
src/datastore_mad/remotes/fs/mkfs | ||
---|---|---|
50 | 50 |
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS \ |
51 | 51 |
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/UMASK \ |
52 | 52 |
/DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \ |
53 |
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE) |
|
53 |
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE \ |
|
54 |
/DS_DRIVER_ACTION_DATA/IMAGE/NAME) |
|
54 | 55 | |
55 | 56 | |
56 | 57 |
BASE_PATH="${XPATH_ELEMENTS[0]}" |
... | ... | |
59 | 60 |
UMASK="${XPATH_ELEMENTS[3]}" |
60 | 61 |
FSTYPE="${XPATH_ELEMENTS[4]}" |
61 | 62 |
SIZE="${XPATH_ELEMENTS[5]}" |
63 |
NAME="${XPATH_ELEMENTS[6]}" |
|
62 | 64 | |
63 | 65 |
mkdir -p "$BASE_PATH" |
64 | 66 |
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" |
... | ... | |
74 | 76 | |
75 | 77 |
# ------------ Create the image to the repository ------------ |
76 | 78 | |
77 |
MKFS_CMD=`mkfs_command $DST $FSTYPE $SIZE` |
|
79 |
MKFS_CMD=`mkfs_command $DST $FSTYPE $SIZE $NAME`
|
|
78 | 80 | |
79 | 81 |
exec_and_log "$DD if=/dev/zero of=$DST bs=1 count=1 seek=${SIZE}M" \ |
80 | 82 |
"Could not create image $DST" |
src/datastore_mad/remotes/iscsi/mkfs | ||
---|---|---|
54 | 54 |
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VG_NAME \ |
55 | 55 |
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/BASE_IQN \ |
56 | 56 |
/DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \ |
57 |
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE) |
|
57 |
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE \ |
|
58 |
/DS_DRIVER_ACTION_DATA/IMAGE/NAME) |
|
58 | 59 | |
59 | 60 |
BASE_PATH="${XPATH_ELEMENTS[0]}" |
60 | 61 |
RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}" |
... | ... | |
65 | 66 |
BASE_IQN="${XPATH_ELEMENTS[6]:-$BASE_IQN}" |
66 | 67 |
FSTYPE="${XPATH_ELEMENTS[7]}" |
67 | 68 |
SIZE="${XPATH_ELEMENTS[8]:-0}" |
69 |
NAME="${XPATH_ELEMENTS[9]}" |
|
68 | 70 | |
69 | 71 |
# Check if 'TGTSETUPLUN' is installed |
70 | 72 |
tgt_setup_lun_install "$DST_HOST" "$BASE_PATH" |
... | ... | |
83 | 85 |
$SUDO $(tgt_admin_dump_config "$TARGET_CONF") |
84 | 86 | |
85 | 87 |
if [ "$FSTYPE" != "save_as" ]; then |
86 |
$SUDO $(mkfs_command "$DEV" "$FSTYPE") |
|
88 |
$SUDO $(mkfs_command "$DEV" "$FSTYPE" "" "$NAME")
|
|
87 | 89 |
fi |
88 | 90 |
EOF |
89 | 91 |
) |
src/datastore_mad/remotes/lvm/mkfs | ||
---|---|---|
53 | 53 |
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/HOST \ |
54 | 54 |
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/VG_NAME \ |
55 | 55 |
/DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \ |
56 |
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE) |
|
56 |
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE \ |
|
57 |
/DS_DRIVER_ACTION_DATA/IMAGE/NAME) |
|
57 | 58 | |
58 | 59 |
BASE_PATH="${XPATH_ELEMENTS[0]}" |
59 | 60 |
RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}" |
... | ... | |
63 | 64 |
VG_NAME="${XPATH_ELEMENTS[5]:-$VG_NAME}" |
64 | 65 |
FSTYPE="${XPATH_ELEMENTS[6]}" |
65 | 66 |
SIZE="${XPATH_ELEMENTS[7]}" |
67 |
NAME="${XPATH_ELEMENTS[8]}" |
|
66 | 68 | |
67 | 69 |
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" |
68 | 70 | |
... | ... | |
73 | 75 |
REGISTER_CMD=$(cat <<EOF |
74 | 76 |
set -e |
75 | 77 |
$SUDO $LVCREATE -L${SIZE}M ${VG_NAME} -n ${LV_NAME} |
76 |
$SUDO $(mkfs_command "$DEV" "$FSTYPE") |
|
78 |
$SUDO $(mkfs_command "$DEV" "$FSTYPE" "" "$NAME")
|
|
77 | 79 |
EOF |
78 | 80 |
) |
79 | 81 |
src/datastore_mad/remotes/vmware/mkfs | ||
---|---|---|
50 | 50 |
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/SAFE_DIRS \ |
51 | 51 |
/DS_DRIVER_ACTION_DATA/DATASTORE/TEMPLATE/UMASK \ |
52 | 52 |
/DS_DRIVER_ACTION_DATA/IMAGE/FSTYPE \ |
53 |
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE) |
|
53 |
/DS_DRIVER_ACTION_DATA/IMAGE/SIZE \ |
|
54 |
/DS_DRIVER_ACTION_DATA/IMAGE/NAME) |
|
54 | 55 | |
55 | 56 |
BASE_PATH="${XPATH_ELEMENTS[0]}" |
56 | 57 |
RESTRICTED_DIRS="${XPATH_ELEMENTS[1]}" |
... | ... | |
58 | 59 |
UMASK="${XPATH_ELEMENTS[3]}" |
59 | 60 |
FSTYPE="${XPATH_ELEMENTS[4]}" |
60 | 61 |
SIZE="${XPATH_ELEMENTS[5]}" |
62 |
NAME="${XPATH_ELEMENTS[6]}" |
|
61 | 63 | |
62 | 64 |
mkdir -p "$BASE_PATH" |
63 | 65 |
set_up_datastore "$BASE_PATH" "$RESTRICTED_DIRS" "$SAFE_DIRS" "$UMASK" |
... | ... | |
78 | 80 | |
79 | 81 |
IMAGE_FORMAT=vmdk |
80 | 82 | |
81 |
MKFS_CMD=`mkfs_command $DISK_TMP $FSTYPE` |
|
83 |
MKFS_CMD=`mkfs_command $DISK_TMP $FSTYPE "" $NAME`
|
|
82 | 84 | |
83 | 85 |
exec_and_log "mkdir -p $DST" \ |
84 | 86 |
"Could not create disk directory $DST" |
src/mad/sh/scripts_common.sh | ||
---|---|---|
254 | 254 |
DST=$1 |
255 | 255 |
FSTYPE=${2:-ext3} |
256 | 256 |
SIZE=${3:-0} |
257 |
NAME=$4 |
|
257 | 258 | |
258 | 259 |
# Specific options for different FS |
259 | 260 |
case "$FSTYPE" in |
... | ... | |
292 | 293 |
OPTS="" |
293 | 294 |
;; |
294 | 295 |
esac |
296 |
if [ -n "$NAME" ] |
|
297 |
then |
|
298 |
case "$FSTYPE" in |
|
299 |
"reiserfs") |
|
300 |
OPTS="$OPTS -l $NAME" |
|
301 |
;; |
|
302 |
*) |
|
303 |
OPTS="$OPTS -L $NAME" |
|
304 |
;; |
|
305 |
esac |
|
306 |
fi |
|
295 | 307 | |
296 | 308 |
echo "$MKFS -t $FSTYPE $OPTS $DST" |
297 | 309 |
} |
298 |
- |