labs: fix Windows batch file creation

This changeset reverts "labs: temporary wbatch fix" and replaces it with
a proper fix, allowing the creation of correct Windows batch files on
build hosts without VirtualBox.

Change-Id: Iad005ce9f0dcecb910fc09b2c43385dd42992eda
This commit is contained in:
Roger Luethi 2014-11-27 13:42:29 +01:00
parent b1a907e782
commit 67db6e7aa3
7 changed files with 9 additions and 2746 deletions

View File

@ -129,11 +129,13 @@ function create_hostonlyif {
function create_network { function create_network {
local ip=$1 local ip=$1
# XXX We need host-only interface names as identifiers for wbatch; by # If we are here only for wbatch, ignore actual network interfaces; just
# always executing VBoxManage calls to ip_to_hostonlyif and # return a unique identifier (so it can be replaced with the interface
# create_hostonlyif we avoid the need to invent fake interface names # name used by Windows).
${OSBASH:+:} mktemp -u XXXXXXXX
${OSBASH:+:} return 0
local if_name="$(OSBASH=exec_cmd ip_to_hostonlyif "$ip")" local if_name="$(ip_to_hostonlyif "$ip")"
if [ -n "$if_name" ]; then if [ -n "$if_name" ]; then
if hostonlyif_in_use "$if_name"; then if hostonlyif_in_use "$if_name"; then
echo >&2 "Host-only interface $if_name ($ip) is in use." \ echo >&2 "Host-only interface $if_name ($ip) is in use." \
@ -141,7 +143,7 @@ function create_network {
fi fi
else else
echo >&2 "Creating host-only interface" echo >&2 "Creating host-only interface"
if_name=$(OSBASH=exec_cmd create_hostonlyif) if_name=$(create_hostonlyif)
fi fi
echo >&2 "Configuring host-only network $ip ($if_name)" echo >&2 "Configuring host-only network $ip ($if_name)"

File diff suppressed because it is too large Load Diff

View File

@ -1,293 +0,0 @@
@ECHO OFF
REM This is an automatically generated Windows batch file. It creates the
REM compute VM for an OpenStack training-labs setup.
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO.
ECHO OpenStack labs for VirtualBox on Windows
ECHO Generated by osbash
ECHO.
ECHO Create compute VM
ECHO.
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
REM VBoxManage is not in PATH, but this is a good guess
IF EXIST %ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe (
SET PATH=%PATH%;%ProgramFiles%\Oracle\VirtualBox
ECHO.
ECHO %time% Found %ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe
ECHO.
GOTO :vbm_found
)
ECHO.
ECHO %time% Searching %SystemDrive% for VBoxManage, this may take a while
ECHO.
FOR /r %SystemDrive% %%a IN (*) DO (
IF "%%~nxa"=="VBoxManage.exe" (
SET PATH=%PATH%;%%~dpa
ECHO %time% Found %%~dpnxa
GOTO :vbm_found
)
)
ECHO.
ECHO %time% Cannot find VBoxManage.exe (part of VirtualBox) on %SystemDrive%.
ECHO %time% Program stops.
ECHO.
GOTO :terminate
:vbm_found
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
SET BATDIR=%~dp0
PUSHD %BATDIR%..
SET TOPDIR=%cd%
POPD
SET AUTODIR=%TOPDIR%\autostart
SET IMGDIR=%TOPDIR%\img
SET LOGDIR=%TOPDIR%\log
SET STATUSDIR=%TOPDIR%\log\status
SET SHAREDIR=%TOPDIR%
ECHO %time% Creating directories (if needed)
IF NOT EXIST %AUTODIR% mkdir %AUTODIR%
IF NOT EXIST %IMGDIR% mkdir %IMGDIR%
IF NOT EXIST %LOGDIR% mkdir %LOGDIR%
IF NOT EXIST %SHAREDIR% mkdir %SHAREDIR%
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
ECHO %time% Cleaning up autostart and log directories
DEL /S /Q %AUTODIR%
DEL /S /Q %LOGDIR%
ECHO %time% Looking for %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
IF EXIST %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi goto got_base_disk
ECHO.
ECHO base-vbadd-ubuntu-14.04-server-amd64.vdi not found in %IMGDIR%.
ECHO.
ECHO You need to build a base disk before you can create node VMs.
ECHO.
goto :terminate
:got_base_disk
ECHO.
ECHO %time% Found %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
ECHO.
ECHO %time% Initialization done. Hit any key to continue.
ECHO.
PAUSE
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
CALL :vm_exists compute
ECHO VBoxManage createvm --name compute --register --ostype Ubuntu_64 --groups /oslabs
VBoxManage createvm --name compute --register --ostype Ubuntu_64 --groups /oslabs
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm compute --rtcuseutc on
VBoxManage modifyvm compute --rtcuseutc on
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm compute --biosbootmenu disabled
VBoxManage modifyvm compute --biosbootmenu disabled
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm compute --largepages on
VBoxManage modifyvm compute --largepages on
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm compute --boot1 disk
VBoxManage modifyvm compute --boot1 disk
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storagectl compute --name SATA --add sata --portcount 1
VBoxManage storagectl compute --name SATA --add sata --portcount 1
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storagectl compute --name SATA --hostiocache on
VBoxManage storagectl compute --name SATA --hostiocache on
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storagectl compute --name IDE --add ide
VBoxManage storagectl compute --name IDE --add ide
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm compute --memory 1024
VBoxManage modifyvm compute --memory 1024
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm compute --cpus 2
VBoxManage modifyvm compute --cpus 2
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm compute --nictype1 virtio --nic1 nat
VBoxManage modifyvm compute --nictype1 virtio --nic1 nat
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm compute --nictype2 virtio --nic2 hostonly --hostonlyadapter2 "VirtualBox Host-Only Ethernet Adapter" --nicpromisc2 allow-all
VBoxManage modifyvm compute --nictype2 virtio --nic2 hostonly --hostonlyadapter2 "VirtualBox Host-Only Ethernet Adapter" --nicpromisc2 allow-all
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm compute --nictype3 virtio --nic3 hostonly --hostonlyadapter3 "VirtualBox Host-Only Ethernet Adapter #2" --nicpromisc3 allow-all
VBoxManage modifyvm compute --nictype3 virtio --nic3 hostonly --hostonlyadapter3 "VirtualBox Host-Only Ethernet Adapter #2" --nicpromisc3 allow-all
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm compute --natpf1 ssh,tcp,127.0.0.1,2232,,22
VBoxManage modifyvm compute --natpf1 ssh,tcp,127.0.0.1,2232,,22
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage sharedfolder add compute --name osbash --hostpath %SHAREDIR%
VBoxManage sharedfolder add compute --name osbash --hostpath %SHAREDIR%
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyhd --type multiattach %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
VBoxManage modifyhd --type multiattach %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storageattach compute --storagectl SATA --port 0 --device 0 --type hdd --medium %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
VBoxManage storageattach compute --storagectl SATA --port 0 --device 0 --type hdd --medium %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
IF %errorlevel% NEQ 0 GOTO :vbm_error
COPY %TOPDIR%\scripts\osbash\init_xxx_node.sh %AUTODIR%\00_init_compute_node.sh
COPY %TOPDIR%\scripts\etc_hosts.sh %AUTODIR%\01_etc_hosts.sh
COPY %TOPDIR%\scripts\osbash\enable_vagrant_ssh_keys.sh %AUTODIR%\02_enable_vagrant_ssh_keys.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\03_shutdown.sh
ECHO VBoxManage startvm compute --type headless
VBoxManage startvm compute --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM compute to power off.
CALL :wait_poweroff compute
ECHO %time% VM compute powered off.
ECHO VBoxManage snapshot compute take network_configured
VBoxManage snapshot compute take network_configured
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\setup_nova_compute.sh %AUTODIR%\00_setup_nova_compute.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\01_shutdown.sh
ECHO VBoxManage startvm compute --type headless
VBoxManage startvm compute --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM compute to power off.
CALL :wait_poweroff compute
ECHO %time% VM compute powered off.
ECHO VBoxManage snapshot compute take nova-compute_installed
VBoxManage snapshot compute take nova-compute_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\setup_neutron_compute.sh %AUTODIR%\00_setup_neutron_compute.sh
COPY %TOPDIR%\scripts\setup_cinder_volumes.sh %AUTODIR%\01_setup_cinder_volumes.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\02_shutdown.sh
ECHO VBoxManage startvm compute --type headless
VBoxManage startvm compute --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM compute to power off.
CALL :wait_poweroff compute
ECHO %time% VM compute powered off.
ECHO VBoxManage snapshot compute take compute_node_installed
VBoxManage snapshot compute take compute_node_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\shutdown_controller.sh %AUTODIR%\00_shutdown_controller.sh
ECHO VBoxManage startvm compute --type headless
VBoxManage startvm compute --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take compute_node_installed
VBoxManage snapshot controller take compute_node_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO.
ECHO %time% Batch script seems to have succeeded.
ECHO.
GOTO :terminate
REM Note: vbm_error falls through to terminate
:vbm_error
ECHO.
ECHO %time% VBoxManage returned with an error. Aborting.
ECHO.
:terminate
ENDLOCAL
PAUSE
EXIT
GOTO :eof
REM ============================================================================
REM
REM End of program, function definitions follow
REM
REM ============================================================================
:wait_auto
IF EXIST %STATUSDIR%\done (
DEL %STATUSDIR%\done
GOTO :eof
)
IF EXIST %STATUSDIR%\error (
ECHO.
ECHO %time% ERROR Script returned error:
ECHO.
TYPE %STATUSDIR%\error
ECHO.
ECHO %time% Aborting.
ECHO.
DEL %STATUSDIR%\error
GOTO :terminate
)
TIMEOUT /T 5 /NOBREAK
GOTO :wait_auto
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:wait_poweroff
VBoxManage showvminfo %~1 --machinereadable|findstr poweroff
IF %errorlevel% EQU 0 GOTO :eof
TIMEOUT /T 2 /NOBREAK
GOTO :wait_poweroff
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:vm_exists
VBoxManage list vms|findstr %~1
IF %errorlevel% NEQ 0 GOTO :eof
ECHO.
ECHO %time% VM %~1 already exists. Aborting.
ECHO.
GOTO :terminate
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REM vim: set ai ts=4 sw=4 et ft=dosbatch:

View File

@ -1,385 +0,0 @@
@ECHO OFF
REM This is an automatically generated Windows batch file. It creates the
REM controller VM for an OpenStack training-labs setup.
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO.
ECHO OpenStack labs for VirtualBox on Windows
ECHO Generated by osbash
ECHO.
ECHO Create controller VM
ECHO.
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
REM VBoxManage is not in PATH, but this is a good guess
IF EXIST %ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe (
SET PATH=%PATH%;%ProgramFiles%\Oracle\VirtualBox
ECHO.
ECHO %time% Found %ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe
ECHO.
GOTO :vbm_found
)
ECHO.
ECHO %time% Searching %SystemDrive% for VBoxManage, this may take a while
ECHO.
FOR /r %SystemDrive% %%a IN (*) DO (
IF "%%~nxa"=="VBoxManage.exe" (
SET PATH=%PATH%;%%~dpa
ECHO %time% Found %%~dpnxa
GOTO :vbm_found
)
)
ECHO.
ECHO %time% Cannot find VBoxManage.exe (part of VirtualBox) on %SystemDrive%.
ECHO %time% Program stops.
ECHO.
GOTO :terminate
:vbm_found
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
SET BATDIR=%~dp0
PUSHD %BATDIR%..
SET TOPDIR=%cd%
POPD
SET AUTODIR=%TOPDIR%\autostart
SET IMGDIR=%TOPDIR%\img
SET LOGDIR=%TOPDIR%\log
SET STATUSDIR=%TOPDIR%\log\status
SET SHAREDIR=%TOPDIR%
ECHO %time% Creating directories (if needed)
IF NOT EXIST %AUTODIR% mkdir %AUTODIR%
IF NOT EXIST %IMGDIR% mkdir %IMGDIR%
IF NOT EXIST %LOGDIR% mkdir %LOGDIR%
IF NOT EXIST %SHAREDIR% mkdir %SHAREDIR%
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
ECHO %time% Cleaning up autostart and log directories
DEL /S /Q %AUTODIR%
DEL /S /Q %LOGDIR%
ECHO %time% Looking for %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
IF EXIST %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi goto got_base_disk
ECHO.
ECHO base-vbadd-ubuntu-14.04-server-amd64.vdi not found in %IMGDIR%.
ECHO.
ECHO You need to build a base disk before you can create node VMs.
ECHO.
goto :terminate
:got_base_disk
ECHO.
ECHO %time% Found %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
ECHO.
ECHO %time% Initialization done. Hit any key to continue.
ECHO.
PAUSE
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
CALL :vm_exists controller
ECHO VBoxManage createvm --name controller --register --ostype Ubuntu_64 --groups /oslabs
VBoxManage createvm --name controller --register --ostype Ubuntu_64 --groups /oslabs
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --rtcuseutc on
VBoxManage modifyvm controller --rtcuseutc on
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --biosbootmenu disabled
VBoxManage modifyvm controller --biosbootmenu disabled
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --largepages on
VBoxManage modifyvm controller --largepages on
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --boot1 disk
VBoxManage modifyvm controller --boot1 disk
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storagectl controller --name SATA --add sata --portcount 1
VBoxManage storagectl controller --name SATA --add sata --portcount 1
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storagectl controller --name SATA --hostiocache on
VBoxManage storagectl controller --name SATA --hostiocache on
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storagectl controller --name IDE --add ide
VBoxManage storagectl controller --name IDE --add ide
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --memory 1024
VBoxManage modifyvm controller --memory 1024
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --cpus 1
VBoxManage modifyvm controller --cpus 1
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --nictype1 virtio --nic1 nat
VBoxManage modifyvm controller --nictype1 virtio --nic1 nat
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --nictype2 virtio --nic2 hostonly --hostonlyadapter2 "VirtualBox Host-Only Ethernet Adapter" --nicpromisc2 allow-all
VBoxManage modifyvm controller --nictype2 virtio --nic2 hostonly --hostonlyadapter2 "VirtualBox Host-Only Ethernet Adapter" --nicpromisc2 allow-all
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --nictype3 virtio --nic3 hostonly --hostonlyadapter3 "VirtualBox Host-Only Ethernet Adapter #3" --nicpromisc3 allow-all
VBoxManage modifyvm controller --nictype3 virtio --nic3 hostonly --hostonlyadapter3 "VirtualBox Host-Only Ethernet Adapter #3" --nicpromisc3 allow-all
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --natpf1 ssh,tcp,127.0.0.1,2230,,22
VBoxManage modifyvm controller --natpf1 ssh,tcp,127.0.0.1,2230,,22
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm controller --natpf1 http,tcp,127.0.0.1,8888,,80
VBoxManage modifyvm controller --natpf1 http,tcp,127.0.0.1,8888,,80
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage sharedfolder add controller --name osbash --hostpath %SHAREDIR%
VBoxManage sharedfolder add controller --name osbash --hostpath %SHAREDIR%
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyhd --type multiattach %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
VBoxManage modifyhd --type multiattach %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storageattach controller --storagectl SATA --port 0 --device 0 --type hdd --medium %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
VBoxManage storageattach controller --storagectl SATA --port 0 --device 0 --type hdd --medium %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
IF %errorlevel% NEQ 0 GOTO :vbm_error
COPY %TOPDIR%\scripts\osbash\init_xxx_node.sh %AUTODIR%\00_init_controller_node.sh
COPY %TOPDIR%\scripts\etc_hosts.sh %AUTODIR%\01_etc_hosts.sh
COPY %TOPDIR%\scripts\osbash\enable_vagrant_ssh_keys.sh %AUTODIR%\02_enable_vagrant_ssh_keys.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\03_shutdown.sh
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take network_configured
VBoxManage snapshot controller take network_configured
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\apt_install_mysql.sh %AUTODIR%\00_apt_install_mysql.sh
COPY %TOPDIR%\scripts\install_rabbitmq.sh %AUTODIR%\01_install_rabbitmq.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\02_shutdown.sh
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take pre-openstack_installed
VBoxManage snapshot controller take pre-openstack_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\setup_keystone.sh %AUTODIR%\00_setup_keystone.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\01_shutdown.sh
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take keystone_installed
VBoxManage snapshot controller take keystone_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\setup_glance.sh %AUTODIR%\00_setup_glance.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\01_shutdown.sh
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take glance_installed
VBoxManage snapshot controller take glance_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\setup_nova_controller.sh %AUTODIR%\00_setup_nova_controller.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\01_shutdown.sh
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take nova-controller_installed
VBoxManage snapshot controller take nova-controller_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\setup_neutron_controller.sh %AUTODIR%\00_setup_neutron_controller.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\01_shutdown.sh
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take neutron-controller_installed
VBoxManage snapshot controller take neutron-controller_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\setup_cinder_controller.sh %AUTODIR%\00_setup_cinder_controller.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\01_shutdown.sh
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take cinder_installed
VBoxManage snapshot controller take cinder_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\setup_horizon.sh %AUTODIR%\00_setup_horizon.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\01_shutdown.sh
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take horizon_installed
VBoxManage snapshot controller take horizon_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\config_external_network.sh %AUTODIR%\00_config_external_network.sh
COPY %TOPDIR%\scripts\config_demo_user.sh %AUTODIR%\01_config_demo_user.sh
COPY %TOPDIR%\scripts\config_tenant_network.sh %AUTODIR%\02_config_tenant_network.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\03_shutdown.sh
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take controller_node_installed
VBoxManage snapshot controller take controller_node_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO.
ECHO %time% Batch script seems to have succeeded.
ECHO.
GOTO :terminate
REM Note: vbm_error falls through to terminate
:vbm_error
ECHO.
ECHO %time% VBoxManage returned with an error. Aborting.
ECHO.
:terminate
ENDLOCAL
PAUSE
EXIT
GOTO :eof
REM ============================================================================
REM
REM End of program, function definitions follow
REM
REM ============================================================================
:wait_auto
IF EXIST %STATUSDIR%\done (
DEL %STATUSDIR%\done
GOTO :eof
)
IF EXIST %STATUSDIR%\error (
ECHO.
ECHO %time% ERROR Script returned error:
ECHO.
TYPE %STATUSDIR%\error
ECHO.
ECHO %time% Aborting.
ECHO.
DEL %STATUSDIR%\error
GOTO :terminate
)
TIMEOUT /T 5 /NOBREAK
GOTO :wait_auto
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:wait_poweroff
VBoxManage showvminfo %~1 --machinereadable|findstr poweroff
IF %errorlevel% EQU 0 GOTO :eof
TIMEOUT /T 2 /NOBREAK
GOTO :wait_poweroff
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:vm_exists
VBoxManage list vms|findstr %~1
IF %errorlevel% NEQ 0 GOTO :eof
ECHO.
ECHO %time% VM %~1 already exists. Aborting.
ECHO.
GOTO :terminate
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REM vim: set ai ts=4 sw=4 et ft=dosbatch:

View File

@ -1,162 +0,0 @@
@ECHO OFF
REM This is an automatically generated Windows batch file. It creates the
REM host-only networks for an OpenStack training-labs setup.
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO.
ECHO OpenStack labs for VirtualBox on Windows
ECHO Generated by osbash
ECHO.
ECHO Create host-only networks
ECHO.
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
REM Elevate credentials, code courtesy of Matthew Newton
REM http://blog.mnewton.com/articles/Windows-Installer-Batch-Script-Revisited.html
REM Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
echo Requesting administrative privileges...
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
REM we are done, exiting recursive call
exit /B
:gotAdmin
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
echo We have admin privileges, proceeding...
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
REM VBoxManage is not in PATH, but this is a good guess
IF EXIST %ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe (
SET PATH=%PATH%;%ProgramFiles%\Oracle\VirtualBox
ECHO.
ECHO %time% Found %ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe
ECHO.
GOTO :vbm_found
)
ECHO.
ECHO %time% Searching %SystemDrive% for VBoxManage, this may take a while
ECHO.
FOR /r %SystemDrive% %%a IN (*) DO (
IF "%%~nxa"=="VBoxManage.exe" (
SET PATH=%PATH%;%%~dpa
ECHO %time% Found %%~dpnxa
GOTO :vbm_found
)
)
ECHO.
ECHO %time% Cannot find VBoxManage.exe (part of VirtualBox) on %SystemDrive%.
ECHO %time% Program stops.
ECHO.
GOTO :terminate
:vbm_found
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
ECHO.
ECHO %time% Initialization done. Hit any key to continue.
ECHO.
PAUSE
ECHO VBoxManage hostonlyif create
VBoxManage hostonlyif create
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage hostonlyif ipconfig "VirtualBox Host-Only Ethernet Adapter" --ip 10.10.10.1 --netmask 255.255.255.0
VBoxManage hostonlyif ipconfig "VirtualBox Host-Only Ethernet Adapter" --ip 10.10.10.1 --netmask 255.255.255.0
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage hostonlyif create
VBoxManage hostonlyif create
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage hostonlyif ipconfig "VirtualBox Host-Only Ethernet Adapter #2" --ip 10.20.20.1 --netmask 255.255.255.0
VBoxManage hostonlyif ipconfig "VirtualBox Host-Only Ethernet Adapter #2" --ip 10.20.20.1 --netmask 255.255.255.0
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage hostonlyif create
VBoxManage hostonlyif create
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage hostonlyif ipconfig "VirtualBox Host-Only Ethernet Adapter #3" --ip 192.168.100.1 --netmask 255.255.255.0
VBoxManage hostonlyif ipconfig "VirtualBox Host-Only Ethernet Adapter #3" --ip 192.168.100.1 --netmask 255.255.255.0
IF %errorlevel% NEQ 0 GOTO :vbm_error
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
ECHO.
ECHO %time% Batch script seems to have succeeded.
ECHO.
GOTO :terminate
REM Note: vbm_error falls through to terminate
:vbm_error
ECHO.
ECHO %time% VBoxManage returned with an error. Aborting.
ECHO.
:terminate
ENDLOCAL
PAUSE
EXIT
GOTO :eof
REM ============================================================================
REM
REM End of program, function definitions follow
REM
REM ============================================================================
:wait_auto
IF EXIST %STATUSDIR%\done (
DEL %STATUSDIR%\done
GOTO :eof
)
IF EXIST %STATUSDIR%\error (
ECHO.
ECHO %time% ERROR Script returned error:
ECHO.
TYPE %STATUSDIR%\error
ECHO.
ECHO %time% Aborting.
ECHO.
DEL %STATUSDIR%\error
GOTO :terminate
)
TIMEOUT /T 5 /NOBREAK
GOTO :wait_auto
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:wait_poweroff
VBoxManage showvminfo %~1 --machinereadable|findstr poweroff
IF %errorlevel% EQU 0 GOTO :eof
TIMEOUT /T 2 /NOBREAK
GOTO :wait_poweroff
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:vm_exists
VBoxManage list vms|findstr %~1
IF %errorlevel% NEQ 0 GOTO :eof
ECHO.
ECHO %time% VM %~1 already exists. Aborting.
ECHO.
GOTO :terminate
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REM vim: set ai ts=4 sw=4 et ft=dosbatch:

View File

@ -1,279 +0,0 @@
@ECHO OFF
REM This is an automatically generated Windows batch file. It creates the
REM network VM for an OpenStack training-labs setup.
SETLOCAL ENABLEDELAYEDEXPANSION
ECHO.
ECHO OpenStack labs for VirtualBox on Windows
ECHO Generated by osbash
ECHO.
ECHO Create network VM
ECHO.
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
REM VBoxManage is not in PATH, but this is a good guess
IF EXIST %ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe (
SET PATH=%PATH%;%ProgramFiles%\Oracle\VirtualBox
ECHO.
ECHO %time% Found %ProgramFiles%\Oracle\VirtualBox\VBoxManage.exe
ECHO.
GOTO :vbm_found
)
ECHO.
ECHO %time% Searching %SystemDrive% for VBoxManage, this may take a while
ECHO.
FOR /r %SystemDrive% %%a IN (*) DO (
IF "%%~nxa"=="VBoxManage.exe" (
SET PATH=%PATH%;%%~dpa
ECHO %time% Found %%~dpnxa
GOTO :vbm_found
)
)
ECHO.
ECHO %time% Cannot find VBoxManage.exe (part of VirtualBox) on %SystemDrive%.
ECHO %time% Program stops.
ECHO.
GOTO :terminate
:vbm_found
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
SET BATDIR=%~dp0
PUSHD %BATDIR%..
SET TOPDIR=%cd%
POPD
SET AUTODIR=%TOPDIR%\autostart
SET IMGDIR=%TOPDIR%\img
SET LOGDIR=%TOPDIR%\log
SET STATUSDIR=%TOPDIR%\log\status
SET SHAREDIR=%TOPDIR%
ECHO %time% Creating directories (if needed)
IF NOT EXIST %AUTODIR% mkdir %AUTODIR%
IF NOT EXIST %IMGDIR% mkdir %IMGDIR%
IF NOT EXIST %LOGDIR% mkdir %LOGDIR%
IF NOT EXIST %SHAREDIR% mkdir %SHAREDIR%
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
ECHO %time% Cleaning up autostart and log directories
DEL /S /Q %AUTODIR%
DEL /S /Q %LOGDIR%
ECHO %time% Looking for %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
IF EXIST %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi goto got_base_disk
ECHO.
ECHO base-vbadd-ubuntu-14.04-server-amd64.vdi not found in %IMGDIR%.
ECHO.
ECHO You need to build a base disk before you can create node VMs.
ECHO.
goto :terminate
:got_base_disk
ECHO.
ECHO %time% Found %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
ECHO.
ECHO %time% Initialization done. Hit any key to continue.
ECHO.
PAUSE
REM vim: set ai ts=4 sw=4 et ft=dosbatch:
CALL :vm_exists network
ECHO VBoxManage createvm --name network --register --ostype Ubuntu_64 --groups /oslabs
VBoxManage createvm --name network --register --ostype Ubuntu_64 --groups /oslabs
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --rtcuseutc on
VBoxManage modifyvm network --rtcuseutc on
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --biosbootmenu disabled
VBoxManage modifyvm network --biosbootmenu disabled
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --largepages on
VBoxManage modifyvm network --largepages on
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --boot1 disk
VBoxManage modifyvm network --boot1 disk
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storagectl network --name SATA --add sata --portcount 1
VBoxManage storagectl network --name SATA --add sata --portcount 1
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storagectl network --name SATA --hostiocache on
VBoxManage storagectl network --name SATA --hostiocache on
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storagectl network --name IDE --add ide
VBoxManage storagectl network --name IDE --add ide
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --memory 512
VBoxManage modifyvm network --memory 512
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --cpus 1
VBoxManage modifyvm network --cpus 1
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --nictype1 virtio --nic1 nat
VBoxManage modifyvm network --nictype1 virtio --nic1 nat
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --nictype2 virtio --nic2 hostonly --hostonlyadapter2 "VirtualBox Host-Only Ethernet Adapter" --nicpromisc2 allow-all
VBoxManage modifyvm network --nictype2 virtio --nic2 hostonly --hostonlyadapter2 "VirtualBox Host-Only Ethernet Adapter" --nicpromisc2 allow-all
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --nictype3 virtio --nic3 hostonly --hostonlyadapter3 "VirtualBox Host-Only Ethernet Adapter #2" --nicpromisc3 allow-all
VBoxManage modifyvm network --nictype3 virtio --nic3 hostonly --hostonlyadapter3 "VirtualBox Host-Only Ethernet Adapter #2" --nicpromisc3 allow-all
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --nictype4 virtio --nic4 hostonly --hostonlyadapter4 "VirtualBox Host-Only Ethernet Adapter #3" --nicpromisc4 allow-all
VBoxManage modifyvm network --nictype4 virtio --nic4 hostonly --hostonlyadapter4 "VirtualBox Host-Only Ethernet Adapter #3" --nicpromisc4 allow-all
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyvm network --natpf1 ssh,tcp,127.0.0.1,2231,,22
VBoxManage modifyvm network --natpf1 ssh,tcp,127.0.0.1,2231,,22
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage sharedfolder add network --name osbash --hostpath %SHAREDIR%
VBoxManage sharedfolder add network --name osbash --hostpath %SHAREDIR%
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage modifyhd --type multiattach %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
VBoxManage modifyhd --type multiattach %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO VBoxManage storageattach network --storagectl SATA --port 0 --device 0 --type hdd --medium %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
VBoxManage storageattach network --storagectl SATA --port 0 --device 0 --type hdd --medium %IMGDIR%\base-vbadd-ubuntu-14.04-server-amd64.vdi
IF %errorlevel% NEQ 0 GOTO :vbm_error
COPY %TOPDIR%\scripts\osbash\init_xxx_node.sh %AUTODIR%\00_init_network_node.sh
COPY %TOPDIR%\scripts\etc_hosts.sh %AUTODIR%\01_etc_hosts.sh
COPY %TOPDIR%\scripts\osbash\enable_vagrant_ssh_keys.sh %AUTODIR%\02_enable_vagrant_ssh_keys.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\03_shutdown.sh
ECHO VBoxManage startvm network --type headless
VBoxManage startvm network --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM network to power off.
CALL :wait_poweroff network
ECHO %time% VM network powered off.
ECHO VBoxManage snapshot network take network_configured
VBoxManage snapshot network take network_configured
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\setup_neutron_network.sh %AUTODIR%\00_setup_neutron_network.sh
COPY %TOPDIR%\scripts\osbash\shutdown.sh %AUTODIR%\01_shutdown.sh
ECHO VBoxManage startvm network --type headless
VBoxManage startvm network --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM network to power off.
CALL :wait_poweroff network
ECHO %time% VM network powered off.
ECHO VBoxManage snapshot network take network_node_installed
VBoxManage snapshot network take network_node_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
COPY %TOPDIR%\scripts\shutdown_controller.sh %AUTODIR%\00_shutdown_controller.sh
ECHO VBoxManage startvm network --type headless
VBoxManage startvm network --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO %time% Waiting for VM controller to power off.
CALL :wait_poweroff controller
ECHO %time% VM controller powered off.
ECHO VBoxManage snapshot controller take network_node_installed
VBoxManage snapshot controller take network_node_installed
IF %errorlevel% NEQ 0 GOTO :vbm_error
TIMEOUT /T 1 /NOBREAK
ECHO VBoxManage startvm controller --type headless
VBoxManage startvm controller --type headless
IF %errorlevel% NEQ 0 GOTO :vbm_error
ECHO %time% Waiting for autostart files to execute.
CALL :wait_auto
ECHO %time% All autostart files executed.
ECHO.
ECHO %time% Batch script seems to have succeeded.
ECHO.
GOTO :terminate
REM Note: vbm_error falls through to terminate
:vbm_error
ECHO.
ECHO %time% VBoxManage returned with an error. Aborting.
ECHO.
:terminate
ENDLOCAL
PAUSE
EXIT
GOTO :eof
REM ============================================================================
REM
REM End of program, function definitions follow
REM
REM ============================================================================
:wait_auto
IF EXIST %STATUSDIR%\done (
DEL %STATUSDIR%\done
GOTO :eof
)
IF EXIST %STATUSDIR%\error (
ECHO.
ECHO %time% ERROR Script returned error:
ECHO.
TYPE %STATUSDIR%\error
ECHO.
ECHO %time% Aborting.
ECHO.
DEL %STATUSDIR%\error
GOTO :terminate
)
TIMEOUT /T 5 /NOBREAK
GOTO :wait_auto
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:wait_poweroff
VBoxManage showvminfo %~1 --machinereadable|findstr poweroff
IF %errorlevel% EQU 0 GOTO :eof
TIMEOUT /T 2 /NOBREAK
GOTO :wait_poweroff
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:vm_exists
VBoxManage list vms|findstr %~1
IF %errorlevel% NEQ 0 GOTO :eof
ECHO.
ECHO %time% VM %~1 already exists. Aborting.
ECHO.
GOTO :terminate
REM - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REM vim: set ai ts=4 sw=4 et ft=dosbatch:

View File

@ -38,7 +38,7 @@ commands =
mkdir -p publish-docs/training-guides mkdir -p publish-docs/training-guides
openstack-doc-test --check-build {posargs} openstack-doc-test --check-build {posargs}
bash -c "tar czf publish-docs/training-guides/labs-scripts.tgz labs" bash -c "tar czf publish-docs/training-guides/labs-scripts.tgz labs"
# bash -c "labs/osbash.sh -w cluster" bash -c "labs/osbash.sh -w cluster"
bash -c "zip -r publish-docs/training-guides/labs-scripts.zip labs" bash -c "zip -r publish-docs/training-guides/labs-scripts.zip labs"
[testenv:publishdocs] [testenv:publishdocs]
@ -52,7 +52,7 @@ commands =
# We only publish changed manuals. # We only publish changed manuals.
openstack-doc-test --check-build --publish openstack-doc-test --check-build --publish
bash -c "tar czf publish-docs/training-guides/labs-scripts.tgz labs" bash -c "tar czf publish-docs/training-guides/labs-scripts.tgz labs"
# bash -c "labs/osbash.sh -w cluster" bash -c "labs/osbash.sh -w cluster"
bash -c "zip -r publish-docs/training-guides/labs-scripts.zip labs" bash -c "zip -r publish-docs/training-guides/labs-scripts.zip labs"
[testenv:checklang] [testenv:checklang]