From 0e4ce55881fd632f7e9daa8440a32ae52c8b2558 Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Mon, 28 Sep 2020 21:50:17 -0400 Subject: [PATCH 1/2] Remove experimental warnings of using given-when and smartmatch. --- xCAT-server/lib/perl/xCAT/OPENBMC.pm | 3 ++- xCAT-server/lib/xcat/plugins/kvm.pm | 36 ++++++++++++------------- xCAT-server/lib/xcat/plugins/openbmc.pm | 3 ++- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/xCAT-server/lib/perl/xCAT/OPENBMC.pm b/xCAT-server/lib/perl/xCAT/OPENBMC.pm index 85188c14b..5ace2f59c 100644 --- a/xCAT-server/lib/perl/xCAT/OPENBMC.pm +++ b/xCAT-server/lib/perl/xCAT/OPENBMC.pm @@ -102,7 +102,8 @@ sub run_cmd_in_perl { # List of commands currently not supported in Python my @unsupported_in_python_commands = ('rflash', 'getopenbmccons'); - if ($command ~~ @unsupported_in_python_commands) { + my @temp = grep ({$command =~ $_ } @unsupported_in_python_commands); + if ( $command eq $temp[0]) { # Command currently not supported in Python if ($support_obmc and uc($support_obmc) eq 'YES') { return (0, ''); # Go Python: unsuppored command, but XCAT_OPENBMC_DEVEL=YES overrides diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 54b2c56fc..89be54d85 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -3571,25 +3571,23 @@ sub lsvm { if (exists $domain_info->{"state"}) { my $state = $domain_info->{"state"}; my $state_string; - given($state) { - when ($state == &Sys::Virt::Domain::STATE_NOSTATE) - {$state_string = "The domain is active, but is not running / blocked (eg idle)";} - when ($state == &Sys::Virt::Domain::STATE_RUNNING) - {$state_string = "The domain is active and running";} - when ($state == &Sys::Virt::Domain::STATE_BLOCKED) - {$state_string = "The domain is active, but execution is blocked";} - when ($state == &Sys::Virt::Domain::STATE_PAUSED) - {$state_string = "The domain is active, but execution has been paused";} - when ($state == &Sys::Virt::Domain::STATE_SHUTDOWN) - {$state_string = "The domain is active, but in the shutdown phase";} - when ($state == &Sys::Virt::Domain::STATE_SHUTOFF) - {$state_string = "The domain is inactive, and shut down";} - when ($state == &Sys::Virt::Domain::STATE_CRUSHED) - {$state_string = "The domain is inactive, and crashed";} - when ($state == &Sys::Virt::Domain::STATE_PMSUSPENDED) - {$state_string = "The domain is active, but in power management suspend state";} - default {$state_string = "Unknown"}; - } + if ($state == &Sys::Virt::Domain::STATE_NOSTATE) + {$state_string = "The domain is active, but is not running / blocked (eg idle)";} + elsif ($state == &Sys::Virt::Domain::STATE_RUNNING) + {$state_string = "The domain is active and running";} + elsif ($state == &Sys::Virt::Domain::STATE_BLOCKED) + {$state_string = "The domain is active, but execution is blocked";} + elsif ($state == &Sys::Virt::Domain::STATE_PAUSED) + {$state_string = "The domain is active, but execution has been paused";} + elsif ($state == &Sys::Virt::Domain::STATE_SHUTDOWN) + {$state_string = "The domain is active, but in the shutdown phase";} + elsif ($state == &Sys::Virt::Domain::STATE_SHUTOFF) + {$state_string = "The domain is inactive, and shut down";} + elsif ($state == &Sys::Virt::Domain::STATE_CRUSHED) + {$state_string = "The domain is inactive, and crashed";} + elsif ($state == &Sys::Virt::Domain::STATE_PMSUSPENDED) + {$state_string = "The domain is active, but in power management suspend state";} + else {$state_string = "Unknown"}; push @vms, "State :" . $domain_info->{"state"} . " ($state_string)"; } # The following block of code copied from rscan command processng for disks diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 6681768f9..02556f403 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1255,7 +1255,8 @@ sub parse_args { my $option_s; GetOptions( 's' => \$option_s ); return ([ 1, "The -s option is not supported for OpenBMC." ]) if ($option_s); - if ( "resolved=" ~~ @ARGV) { + my @temp = grep ({$command =~ $_ } @ARGV); + if ( "resolved=" eq $temp[0]) { return ([ 1, "$usage_errormsg $reventlog_no_id_resolved_errormsg" ]); } return ([ 1, "Only one option is supported at the same time for $command" ]); From a5535becc56273f8d64067dbece7ab5bf155171d Mon Sep 17 00:00:00 2001 From: Wai Yee Wong Date: Mon, 28 Sep 2020 22:10:47 -0400 Subject: [PATCH 2/2] Make one correction. --- xCAT-server/lib/xcat/plugins/openbmc.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 02556f403..456a8b802 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -1255,7 +1255,7 @@ sub parse_args { my $option_s; GetOptions( 's' => \$option_s ); return ([ 1, "The -s option is not supported for OpenBMC." ]) if ($option_s); - my @temp = grep ({$command =~ $_ } @ARGV); + my @temp = grep ({"resolved" =~ $_ } @ARGV); if ( "resolved=" eq $temp[0]) { return ([ 1, "$usage_errormsg $reventlog_no_id_resolved_errormsg" ]); }