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:
parent
d1d30bb974
commit
06d727e4fd
@ -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'
|
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
|
while read name uuid creation_date; do
|
||||||
# remove VMs with name starting "Composer-Auto-VM" and older than $TIMESTAMP
|
# remove VMs with name starting "Composer-Test" and older than $TIMESTAMP
|
||||||
echo $name | grep ^Composer-Auto-VM > /dev/null
|
echo $name | grep ^Composer-Test > /dev/null
|
||||||
if [ $? -eq 0 -a "$creation_date" \< "$TIMESTAMP" ]; then
|
if [ $? -eq 0 -a "$creation_date" \< "$TIMESTAMP" ]; then
|
||||||
# note: vmdk disk is removed when destroying the VM
|
# 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"
|
rlRun 'python3 $SAMPLES/destroy_vm.py -S -s $V_HOST -u $V_USERNAME -p $V_PASSWORD --uuid $uuid' 0 "Delete VM: $name UUID: $uuid"
|
||||||
|
@ -103,7 +103,8 @@ __EOF__
|
|||||||
|
|
||||||
rlPhaseStartTest "Upload VMDK image in vCenter"
|
rlPhaseStartTest "Upload VMDK image in vCenter"
|
||||||
rlRun -t -c "$CLI compose image $UUID"
|
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 \
|
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
|
-d $V_DATASTORE -l `readlink -f $IMAGE` -r $IMAGE
|
||||||
@ -111,7 +112,7 @@ __EOF__
|
|||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "Start VM instance"
|
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 \
|
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 \
|
--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 \
|
--portgroup $V_NETWORK -v $IMAGE -m 2048 -g rhel7_64Guest -n $VM_NAME \
|
||||||
|
Loading…
Reference in New Issue
Block a user