#! /usr/bin/env perl

use strict;
use warnings;
use Data::Dumper;

my $virtual = shift;
my %running;

die `virsh list --inactive` unless $virtual;

my @temp = `perl findVirtuals.pl -s | grep $virtual`;
chomp @temp;
while ( my $line = shift @temp ) {
   my ($key, $value) = split "\t", $line;
   $running{$key} = $value;
}

die "$virtual already running on $running{$virtual}\n" if $running{$virtual};

print "I would start $virtual here\n";
print "virsh start $virtual\n";
1;
