15 lines
		
	
	
		
			402 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			15 lines
		
	
	
		
			402 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/sh
 | 
						|
BUILD=${BUILD:=default}
 | 
						|
LAB=${LAB:=0}
 | 
						|
 | 
						|
## Do not touch below this line
 | 
						|
HVN="hvn${LAB}.lab.ipng.ch"
 | 
						|
VMS=$(ls -1 build/${BUILD}/${HVN}/)
 | 
						|
 | 
						|
for VM in $VMS; do
 | 
						|
  echo "[$VM] Destroying VM"
 | 
						|
  ssh root@$HVN "/usr/bin/virsh list --all | grep $VM.*running >/dev/null && virsh destroy $VM"
 | 
						|
  echo "[$VM] Rolling VM back to pristine snapshot"
 | 
						|
  ssh root@$HVN "zfs rollback ssd-vol0/${VM}@pristine"
 | 
						|
done
 |