Subversion Repositories havirt

Rev

Rev 41 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 41 Rev 42
Line 29... Line 29...
29
# Added some code to migrate domains if node placed in maintenance mode
29
# Added some code to migrate domains if node placed in maintenance mode
30
# Added a lot of 'verbose' print lines, and modified for new flag structure
30
# Added a lot of 'verbose' print lines, and modified for new flag structure
31
#
31
#
32
# v1.2.1 20240828 RWR
32
# v1.2.1 20240828 RWR
33
# removed forceScan from migrateAll and relying on calling scripts to do that.
33
# removed forceScan from migrateAll and relying on calling scripts to do that.
-
 
34
#
-
 
35
# v1.2.2 20250511 RWR
-
 
36
# added source node as a parameter for migrate. If source node is passed in, will not run readDB
34
 
37
 
35
package havirt;
38
package havirt;
36
 
39
 
37
use warnings;
40
use warnings;
38
use strict;  
41
use strict;  
Line 49... Line 52...
49
use Data::Dumper qw(Dumper); # Import the Dumper() subroutine
52
use Data::Dumper qw(Dumper); # Import the Dumper() subroutine
50
 
53
 
51
# define the version number
54
# define the version number
52
# see https://metacpan.org/pod/release/JPEACOCK/version-0.97/lib/version.pod
55
# see https://metacpan.org/pod/release/JPEACOCK/version-0.97/lib/version.pod
53
use version;
56
use version;
54
our $VERSION = version->declare("1.2.1");
57
our $VERSION = version->declare("1.2.2");
55
 
58
 
56
 
59
 
57
use Exporter;
60
use Exporter;
58
 
61
 
59
our @ISA = qw( Exporter );
62
our @ISA = qw( Exporter );
Line 413... Line 416...
413
   return @return ? join( "\n", @return ) . "\n" : 0;
416
   return @return ? join( "\n", @return ) . "\n" : 0;
414
}
417
}
415
 
418
 
416
# migrate domain from current node it is on to $target
419
# migrate domain from current node it is on to $target
417
sub migrate {
420
sub migrate {
418
   my ( $virt, $target ) = @_;
421
   my ( $virt, $target, $node ) = @_;
419
   my $return;
422
   my $return;
420
   my $node  = &main::findDomain( $virt );
423
   $node  = &main::findDomain( $virt ) unless $node;
421
   print Dumper( $main::statusDB->{'nodePopulation'} ) if $main::config->{'flags'}->{'debug'} > 2;
424
   print Dumper( $main::statusDB->{'nodePopulation'} ) if $main::config->{'flags'}->{'debug'} > 2;
422
   die "I can not find $virt on any node\n" unless $node;
425
   die "I can not find $virt on any node\n" unless $node;
423
   die "Domain $virt in maintenance mode, can not migrate it\n" if $main::statusDB->{'virt'}->{$virt}->{'maintenance'};
426
   die "Domain $virt in maintenance mode, can not migrate it\n" if $main::statusDB->{'virt'}->{$virt}->{'maintenance'};
424
   die "Node $target in maintenance mode, can not migrate anything to it\n" if $main::statusDB->{'node'}->{$target}->{'maintenance'};
427
   die "Node $target in maintenance mode, can not migrate anything to it\n" if $main::statusDB->{'node'}->{$target}->{'maintenance'};
425
   die "$virt already on $target\n" if $target eq $node;
428
   die "$virt already on $target\n" if $target eq $node;