[Ovirt-devel] [PATCH node-image] Adds a preserve option for autotest VMs.

Mike Burns mburns at redhat.com
Tue Jul 21 19:06:49 UTC 2009


On Tue, Jul 21, 2009 at 02:16:23PM -0400, Darryl L. Pierce wrote:
> 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
> 
> _______________________________________________
> Ovirt-devel mailing list
> Ovirt-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/ovirt-devel
> 


Looks good.  ACK

Mike




More information about the ovirt-devel mailing list