FOSSology  4.4.0
Open Source License Compliance by Open Source Software
vmrevert.php
Go to the documentation of this file.
1 #!/usr/bin/php
2 <?php
3 /*
4  SPDX-FileCopyrightText: © 2012 Hewlett-Packard Development Company, L.P.
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
16 require_once('../lib/common-vm.php');
17 
18 // parse the ini file
19 // cycle through the arrays and revert each vm
20 
21 $toRevert = parse_ini_file('vm.ini', 1);
22 // first shutdown then power off (don't need to power off VMs)
23 /*
24 foreach($toRevert as $host => $vms)
25 {
26  $host = trim($host);
27  foreach ($vms as $vmName => $vm)
28  {
29  //echo "DB: vmName is:$vmName\n";
30  //echo "DB: vm is:$vm\n";
31  echo "Performing a soft shutdown on host $host using $vmName on vm:\n$vm\n";
32  if(!vmOps($host, $vm, 'stop soft'))
33  {
34  echo "FATAL! count not revert the current snapshot for $vmName on vm\n$vm\n";
35  }
36  } // foreach
37 } // foreach
38 */
39 // now revert snapshot
40 foreach($toRevert as $host => $vms)
41 {
42  $host = trim($host);
43  foreach ($vms as $vmName => $vm)
44  {
45  //echo "DB: vmName is:$vmName\n";
46  //echo "DB: vm is:$vm\n";
47  echo "Reverting snapshot on host $host using $vmName on vm:\n$vm\n";
48  if(!vmOps($host, $vm, 'revertsnapshot'))
49  {
50  echo "FATAL! count not revert the current snapshot for $vmName on vm\n$vm\n";
51  }
52  } // foreach
53 } // foreach
char * trim(char *ptext)
Trimming whitespace.
Definition: fossconfig.c:690