mirror of
https://github.com/rancher/os.git
synced 2025-09-04 08:14:21 +00:00
Remove rancher.state.formatzero kernel parameter
This commit is contained in:
@@ -160,7 +160,6 @@ type StateConfig struct {
|
|||||||
Wait bool `yaml:"wait,omitempty"`
|
Wait bool `yaml:"wait,omitempty"`
|
||||||
Required bool `yaml:"required,omitempty"`
|
Required bool `yaml:"required,omitempty"`
|
||||||
Autoformat []string `yaml:"autoformat,omitempty"`
|
Autoformat []string `yaml:"autoformat,omitempty"`
|
||||||
FormatZero bool `yaml:"formatzero,omitempty"`
|
|
||||||
MdadmScan bool `yaml:"mdadm_scan,omitempty"`
|
MdadmScan bool `yaml:"mdadm_scan,omitempty"`
|
||||||
Script string `yaml:"script,omitempty"`
|
Script string `yaml:"script,omitempty"`
|
||||||
OemFsType string `yaml:"oem_fstype,omitempty"`
|
OemFsType string `yaml:"oem_fstype,omitempty"`
|
||||||
|
@@ -2,10 +2,7 @@
|
|||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
MAGIC=${MAGIC:-"boot2docker, please format-me"}
|
MAGIC=${MAGIC:-"boot2docker, please format-me"}
|
||||||
|
|
||||||
AUTOFORMAT=${AUTOFORMAT:-"/dev/sda /dev/vda"}
|
|
||||||
DEVS=(${AUTOFORMAT})
|
DEVS=(${AUTOFORMAT})
|
||||||
FORMATZERO=${FORMATZERO:-false}
|
|
||||||
|
|
||||||
for dev in ${DEVS[@]}; do
|
for dev in ${DEVS[@]}; do
|
||||||
if [ -b "${dev}" ]; then
|
if [ -b "${dev}" ]; then
|
||||||
@@ -16,9 +13,6 @@ for dev in ${DEVS[@]}; do
|
|||||||
if [ "$HEADER" = "$MAGIC" ]; then
|
if [ "$HEADER" = "$MAGIC" ]; then
|
||||||
# save the preload userdata.tar file
|
# save the preload userdata.tar file
|
||||||
dd if=${dev} of=/userdata.tar bs=1 count=8192
|
dd if=${dev} of=/userdata.tar bs=1 count=8192
|
||||||
elif [ "${FORMATZERO}" != "true" ]; then
|
|
||||||
# do not try to guess whether to auto-format a disk beginning with 1MB filled with 00
|
|
||||||
continue
|
|
||||||
elif ! od -A d -N 1048576 ${dev} | head -n 3 | diff ./od-1m0 - >/dev/null 2>&1; then
|
elif ! od -A d -N 1048576 ${dev} | head -n 3 | diff ./od-1m0 - >/dev/null 2>&1; then
|
||||||
# do not auto-format if the disk does not begin with 1MB filled with 00
|
# do not auto-format if the disk does not begin with 1MB filled with 00
|
||||||
continue
|
continue
|
||||||
|
@@ -3,7 +3,6 @@ package init
|
|||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"fmt"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
log "github.com/Sirupsen/logrus"
|
log "github.com/Sirupsen/logrus"
|
||||||
@@ -18,9 +17,8 @@ func autoformat(cfg *config.CloudConfig) (*config.CloudConfig, error) {
|
|||||||
return cfg, nil
|
return cfg, nil
|
||||||
}
|
}
|
||||||
AUTOFORMAT := "AUTOFORMAT=" + strings.Join(cfg.Rancher.State.Autoformat, " ")
|
AUTOFORMAT := "AUTOFORMAT=" + strings.Join(cfg.Rancher.State.Autoformat, " ")
|
||||||
FORMATZERO := "FORMATZERO=" + fmt.Sprint(cfg.Rancher.State.FormatZero)
|
|
||||||
t := *cfg
|
t := *cfg
|
||||||
t.Rancher.Autoformat["autoformat"].Environment = []string{AUTOFORMAT, FORMATZERO}
|
t.Rancher.Autoformat["autoformat"].Environment = []string{AUTOFORMAT}
|
||||||
log.Info("Running Autoformat services")
|
log.Info("Running Autoformat services")
|
||||||
_, err := compose.RunServiceSet("autoformat", &t, t.Rancher.Autoformat)
|
_, err := compose.RunServiceSet("autoformat", &t, t.Rancher.Autoformat)
|
||||||
return &t, err
|
return &t, err
|
||||||
|
@@ -83,7 +83,7 @@ fi
|
|||||||
|
|
||||||
KERNEL_ARGS="${DEFAULT_KERNEL_ARGS} ${QEMU_APPEND}"
|
KERNEL_ARGS="${DEFAULT_KERNEL_ARGS} ${QEMU_APPEND}"
|
||||||
if [ "$FORMAT" == "1" ]; then
|
if [ "$FORMAT" == "1" ]; then
|
||||||
KERNEL_ARGS="${KERNEL_ARGS} rancher.state.dev=LABEL=RANCHER_STATE rancher.state.formatzero=true rancher.state.autoformat=[/dev/sda,/dev/vda]"
|
KERNEL_ARGS="${KERNEL_ARGS} rancher.state.dev=LABEL=RANCHER_STATE rancher.state.autoformat=[/dev/sda,/dev/vda]"
|
||||||
fi
|
fi
|
||||||
if [ "$RM_USR" == "1" ]; then
|
if [ "$RM_USR" == "1" ]; then
|
||||||
KERNEL_ARGS="${KERNEL_ARGS} rancher.rm_usr"
|
KERNEL_ARGS="${KERNEL_ARGS} rancher.rm_usr"
|
||||||
|
Reference in New Issue
Block a user