From 33f614b584781c145ada0e9f19aa60a92d49c3f0 Mon Sep 17 00:00:00 2001 From: Lei Ai Date: Wed, 8 Apr 2015 17:14:25 +0800 Subject: [PATCH] merge fix for 4634 from 2.9.1-pcm branch --- xCAT-server/lib/xcat/plugins/profilednodes.pm | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/profilednodes.pm b/xCAT-server/lib/xcat/plugins/profilednodes.pm index 34ebb3ee6..02c5cab97 100644 --- a/xCAT-server/lib/xcat/plugins/profilednodes.pm +++ b/xCAT-server/lib/xcat/plugins/profilednodes.pm @@ -865,12 +865,17 @@ Usage: my $is_kvm_hypv = xCAT::ProfiledNodeUtils->is_kvm_hypv_node($imageprofile); # Get the netboot attribute for node - my ($retcode, $retval) = xCAT::ProfiledNodeUtils->get_netboot_attr($imageprofile, $hardwareprofile); - if (not $retcode) { - setrsp_errormsg($retval); - return; + my $new_netboot = undef; + my $latestimgproflie = $imageprofile?$imageprofile:$nodeoldprofiles{'imageprofile'}; + my $latesthardwareprofile = $hardwareprofile?$hardwareprofile:$nodeoldprofiles{'hardwareprofile'}; + if ($latestimgproflie){ + my ($retcode, $retval) = xCAT::ProfiledNodeUtils->get_netboot_attr( $latestimgproflie, $latesthardwareprofile); + if (not $retcode) { + setrsp_errormsg($retval); + return; + } + $new_netboot = $retval; } - my $new_netboot = $retval; # After checking, all nodes' profile should be same # Get the new profile with specified ones in args_dict @@ -885,7 +890,10 @@ Usage: xCAT::MsgUtils->message('S', "Specified networkprofile is same with current value, ignore."); $networkprofile = undef; } + }else{ + $profile_groups .= $nodeoldprofiles{'networkprofile'}.","; } + if($hardwareprofile){ $profile_groups .= $hardwareprofile . ","; if ($hardwareprofile ne $nodeoldprofiles{'hardwareprofile'}){ @@ -895,7 +903,12 @@ Usage: xCAT::MsgUtils->message('S', "Specified hardwareprofile is same with current value, ignore."); $hardwareprofile = undef; } + }else{ + if($nodeoldprofiles{'hardwareprofile'}){ + $profile_groups .= $nodeoldprofiles{'hardwareprofile'}.","; + } } + if($imageprofile){ $profile_groups .= $imageprofile . ","; if ($imageprofile ne $nodeoldprofiles{'imageprofile'}){ @@ -905,6 +918,8 @@ Usage: xCAT::MsgUtils->message('S', "Specified imageprofile is same with current value, ignore."); $imageprofile = undef; } + }else{ + $profile_groups .= $nodeoldprofiles{'imageprofile'}.","; } # make sure there are something changed, otherwise we should quit without any changes. unless ($changeflag){ @@ -918,7 +933,9 @@ Usage: if ($is_kvm_hypv) { $updatenodeshash{$_}{'groups'} .= ",__Hypervisor_kvm"; } - $updatenodereshash{$_}{'netboot'} = $new_netboot; + if($new_netboot){ + $updatenodereshash{$_}{'netboot'} = $new_netboot; + } } #update DataBase.