tests: VMware - delete only VMs named Composer-Test-*

- change VM name for consistency sake
- change vmdk file name also for consistency
This commit is contained in:
Alexander Todorov 2019-12-20 12:25:20 +02:00 committed by Alexander Todorov
parent d1d30bb974
commit 06d727e4fd
2 changed files with 5 additions and 4 deletions

View File

@ -55,8 +55,8 @@ rlJournalStart
rlRun -t -c 'python3 $SCRIPT_DIR/vmware_list_vms.py --host $V_HOST --user $V_USERNAME --password $V_PASSWORD --disable_ssl_verification > $TMP_DIR/vmware_vms' 0 'Getting a list of VMs'
while read name uuid creation_date; do
# remove VMs with name starting "Composer-Auto-VM" and older than $TIMESTAMP
echo $name | grep ^Composer-Auto-VM > /dev/null
# remove VMs with name starting "Composer-Test" and older than $TIMESTAMP
echo $name | grep ^Composer-Test > /dev/null
if [ $? -eq 0 -a "$creation_date" \< "$TIMESTAMP" ]; then
# note: vmdk disk is removed when destroying the VM
rlRun 'python3 $SAMPLES/destroy_vm.py -S -s $V_HOST -u $V_USERNAME -p $V_PASSWORD --uuid $uuid' 0 "Delete VM: $name UUID: $uuid"

View File

@ -103,7 +103,8 @@ __EOF__
rlPhaseStartTest "Upload VMDK image in vCenter"
rlRun -t -c "$CLI compose image $UUID"
IMAGE="$UUID-disk.vmdk"
rlRun -t -c "mv $UUID-disk.vmdk Composer-Test-$UUID-disk.vmdk"
IMAGE="Composer-Test-$UUID-disk.vmdk"
python3 $SAMPLES/upload_file_to_datastore.py -S -s $V_HOST -u $V_USERNAME -p $V_PASSWORD \
-d $V_DATASTORE -l `readlink -f $IMAGE` -r $IMAGE
@ -111,7 +112,7 @@ __EOF__
rlPhaseEnd
rlPhaseStartTest "Start VM instance"
VM_NAME="Composer-Auto-VM-$UUID"
VM_NAME="Composer-Test-VM-$UUID"
INSTANCE_UUID=`python3 $SAMPLES/create_vm.py -S -s $V_HOST -u $V_USERNAME -p $V_PASSWORD \
--datacenter $V_DATACENTER -c $V_CLUSTER -f $V_FOLDER -d $V_DATASTORE \
--portgroup $V_NETWORK -v $IMAGE -m 2048 -g rhel7_64Guest -n $VM_NAME \