Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Feb 9th, 2010 | Syntax: Perl | Size: 1.26 KB | Hits: 18 | Expires: Never
Copy text to clipboard
  1.             # Verify  the volume which we are about to destroy is really what we thing we're destroying
  2.             #         Volume State           Status            Options
  3.             #  xdvums_report online          raid_dp, flex     create_ucode=on, guarantee=none
  4.             #                Clone, backed by volume 'xdvums', snapshot 'XDVUMS_report'
  5.             #                Containing aggregate: 't2gen1000'
  6.  
  7.             my $cmd = "vol status $flexClone";
  8.             my @output = &$rshCmd($filer, $cmd);
  9.  
  10.             my $goodFlag = 0;
  11.             foreach my $line (@output)
  12.             {
  13.                 $goodFlag = 1 if($line =~ m/\s+Clone, backed by volume '$srcVol', snapshot '$snapName'/);
  14.                 $goodFlag = 1 if($line =~ m/\s*vol status: No volume named/);
  15.             }
  16.  
  17.             if($goodFlag == 1)
  18.             {
  19.                 $cmd = "vol offline $flexClone";
  20.                 @output = &$rshCmd($filer, $cmd);
  21.  
  22.                 $cmd = "vol destroy $flexClone -f";
  23.                 @output = &$rshCmd($filer, $cmd);
  24.             } else {
  25.                 bail($node->getAttribute("name"), "destroy", sprintf("Request to destroy volume, %s, which is not based on the expected parent volume or snapshot.", $flexClone));
  26.             }