mirror of
https://github.com/rancher/os.git
synced 2025-07-13 06:34:04 +00:00
Merge pull request #445 from imikushin/xhyve
xhyve: cloud-config support
This commit is contained in:
commit
dbae0a6012
@ -24,6 +24,14 @@ func Main() {
|
||||
HideHelp: true,
|
||||
Subcommands: configSubcommands(),
|
||||
},
|
||||
{
|
||||
Name: "dev",
|
||||
ShortName: "d",
|
||||
Usage: "dev spec",
|
||||
HideHelp: true,
|
||||
SkipFlagParsing: true,
|
||||
Action: devAction,
|
||||
},
|
||||
{
|
||||
Name: "env",
|
||||
ShortName: "e",
|
||||
|
11
cmd/control/dev.go
Normal file
11
cmd/control/dev.go
Normal file
@ -0,0 +1,11 @@
|
||||
package control
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/rancherio/os/util"
|
||||
)
|
||||
|
||||
func devAction(c *cli.Context) {
|
||||
fmt.Println(util.ResolveDevice(c.Args()[0]))
|
||||
}
|
@ -4,6 +4,15 @@
|
||||
: ${BUILD:=$(pwd)/build}
|
||||
: ${DIST:=$(pwd)/dist}
|
||||
|
||||
# PREREQ: brew install coreutils
|
||||
path()
|
||||
{
|
||||
local UNAME=$(uname)
|
||||
if [ "$UNAME" == "Darwin" ]; then greadlink -f "$1"
|
||||
elif [ "$UNAME" == "Linux" ]; then readlink -f "$1";
|
||||
fi
|
||||
}
|
||||
|
||||
write_base()
|
||||
{
|
||||
DOCKER_BASE=${DOCKER_BASE:?"DOCKER_BASE not defined"}
|
||||
|
11
scripts/run
11
scripts/run
@ -26,7 +26,7 @@ while [ "$#" -gt 0 ]; do
|
||||
;;
|
||||
--cloud-config)
|
||||
shift 1
|
||||
CLOUD_CONFIG=$(readlink -f "$1") || :
|
||||
CLOUD_CONFIG=$(path "$1") || :
|
||||
if [ ! -f ${CLOUD_CONFIG} ]; then
|
||||
echo No such file: "'"${CLOUD_CONFIG}"'" 1>&2
|
||||
exit 1
|
||||
@ -90,12 +90,19 @@ KERNEL_ARGS="rancher.password=rancher console=ttyS0 ${QEMU_APPEND}"
|
||||
|
||||
if [ "$UNAME" == "Darwin" ] && [ -x $(which xhyve) ]; then
|
||||
|
||||
CLOUD_CONFIG_ISO="$(pwd)/cloud-config.iso"
|
||||
rm -rf ${CLOUD_CONFIG_ISO}
|
||||
|
||||
# PREREQ: brew install cdrtools
|
||||
mkisofs -R -V config-2 -o "${CLOUD_CONFIG_ISO}" "$(pwd)/cloud-init"
|
||||
|
||||
echo PWD=`pwd`
|
||||
exec sudo xhyve -H -P \
|
||||
-m 2G \
|
||||
-m 4G \
|
||||
-s 0:0,hostbridge -s 31,lpc \
|
||||
-l com1,stdio \
|
||||
-s 2:0,virtio-net \
|
||||
-s 3,ahci-cd,${CLOUD_CONFIG_ISO} \
|
||||
-U a01fb25c-3a19-4759-a47a-2e353e51807d \
|
||||
-f kexec,${KERNEL},${INITRD_TEST},"earlyprintk=serial acpi=off elevator=noop ${KERNEL_ARGS}"
|
||||
|
||||
|
10
scripts/ssh
10
scripts/ssh
@ -5,4 +5,12 @@ cd $(dirname $0)/..
|
||||
|
||||
chmod 0600 ./assets/rancher.key
|
||||
|
||||
exec ssh -p 2222 -F ./assets/scripts_ssh_config -i ./assets/rancher.key rancher@localhost "$@"
|
||||
UNAME=$(uname)
|
||||
|
||||
if [ "$UNAME" == "Darwin" ]; then
|
||||
HOST=192.168.64.2 # consult `/var/db/dhcpd_leases` or delete it
|
||||
exec ssh -F ./assets/scripts_ssh_config -i ./assets/rancher.key rancher@${HOST} "$@"
|
||||
elif [ "$UNAME" == "Linux" ]; then
|
||||
exec ssh -p 2222 -F ./assets/scripts_ssh_config -i ./assets/rancher.key rancher@localhost "$@"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user