Darryl L. Pierce
2009-Jul-21 16:55 UTC
[Ovirt-devel] [PATCH node-image] Adds a preserve option for autotest VMs.
If the -p option is provided, then no VMs are destroyed. Instead they, and their related networks, are left intact. Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- autotest.sh | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletions(-) diff --git a/autotest.sh b/autotest.sh index c9f8a2d..b72ec98 100755 --- a/autotest.sh +++ b/autotest.sh @@ -219,6 +219,9 @@ stop_networking () { networkname=${NETWORK_NAME-} fi + # exit if preserve was enabled + if $preserve_vm; then return; fi + if [ -n "${networkname}" ]; then debug "Destroying network interface: ${networkname}" check=$(sudo virsh net-list --all) @@ -388,6 +391,9 @@ destroy_node () { local nodename=$1 local undefine=${2-true} + # if preserving nodes then exit + if $preserve_vm; then return; fi + if [ -n "${nodename}" ]; then check=$(sudo virsh list --all) if [[ "${check}" =~ "${nodename}" ]]; then @@ -670,6 +676,7 @@ setup_for_testing () { NODE_ADDRESS=$NETWORK.100 debug "NODE_ADDRESS=${NODE_ADDRESS}" DNSMASQ_PID=0 + debug "preserve_vm=${preserve_vm}" } # cleans up any loose ends @@ -691,12 +698,14 @@ debugging=false isofile="${PWD}/ovirt-node-image.iso" show_viewer=false vm_prefix="$$" +preserve_vm=false -while getopts di:n:vwh c; do +while getopts di:n:pvwh c; do case $c in d) debugging=true;; i) isofile=($OPTARG);; n) tests=($OPTARG);; + p) preserve_vm=true;; v) set -v;; w) show_viewer=true;; h) usage; exit 0;; -- 1.6.2.5
This version is rebased against the temporary directory patch which is now pushed upstream. The difference is that the script will now check if the -p option was specified and will not delete the work directory if it's specified.
Darryl L. Pierce
2009-Jul-21 18:16 UTC
[Ovirt-devel] [PATCH node-image] Adds a preserve option for autotest VMs.
If the -p option is provided, then no VMs are destroyed. Instead they, and their related networks, are left intact. Signed-off-by: Darryl L. Pierce <dpierce at redhat.com> --- autotest.sh | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/autotest.sh b/autotest.sh index b0f0ff9..4f03f72 100755 --- a/autotest.sh +++ b/autotest.sh @@ -220,6 +220,9 @@ stop_networking () { networkname=${NETWORK_NAME-} fi + # exit if preserve was enabled + if $preserve_vm; then return; fi + if [ -n "${networkname}" ]; then debug "Destroying network interface: ${networkname}" check=$(sudo virsh net-list --all) @@ -389,6 +392,9 @@ destroy_node () { local nodename=$1 local undefine=${2-true} + # if preserving nodes then exit + if $preserve_vm; then return; fi + if [ -n "${nodename}" ]; then check=$(sudo virsh list --all) if [[ "${check}" =~ "${nodename}" ]]; then @@ -672,6 +678,7 @@ setup_for_testing () { NODE_ADDRESS=$NETWORK.100 debug "NODE_ADDRESS=${NODE_ADDRESS}" DNSMASQ_PID=0 + debug "preserve_vm=${preserve_vm}" } # cleans up any loose ends @@ -685,6 +692,10 @@ cleanup_after_testing () { destroy_node $vm done stop_networking + + # do not delete the work directory if preserve was specified + if $preserve_vm; then return; fi + rm -rf $WORKDIR } @@ -694,12 +705,14 @@ debugging=false isofile="${PWD}/ovirt-node-image.iso" show_viewer=false vm_prefix="$$" +preserve_vm=false -while getopts di:n:vwh c; do +while getopts di:n:pvwh c; do case $c in d) debugging=true;; i) isofile=($OPTARG);; n) tests=($OPTARG);; + p) preserve_vm=true;; v) set -v;; w) show_viewer=true;; h) usage; exit 0;; -- 1.6.2.5
Reasonably Related Threads
- [PATCH node] Update autobuild and autotest scripts for new build structure
- [PATCH] The autotest timeout is now a command line configurable option.
- [PATCH node-image] Moved all temporary files into a single work directory to clean up.
- [PATCH node-image] Fixing the autotest script.
- IPV6 configuration