support define powerKVM hypervisor in nodeimport
This commit is contained in:
parent
603a07def3
commit
33b992ae81
@ -1029,6 +1029,39 @@ sub is_kvm_node
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 is_kvm_hypv_node
|
||||
Description : Judge whether nodes are KVM nodes.
|
||||
Arguments : $imageprofile - imageprofile name
|
||||
Returns : 1 - KVM hypervisor nodes
|
||||
0 - Not KVM hypervisor nodes
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub is_kvm_hypv_node
|
||||
{
|
||||
my $class = shift;
|
||||
my $imageprofile = shift;
|
||||
|
||||
# Get provmethod
|
||||
my $provmethod = xCAT::ProfiledNodeUtils->get_imageprofile_prov_method($imageprofile);
|
||||
unless ($provmethod ){
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $osimage_tab = xCAT::Table->new('osimage');
|
||||
my $osimage_tab_entry = $osimage_tab->getAttribs({'imagename'=> $provmethod},('osdistroname'));
|
||||
my $osdistroname = $osimage_tab_entry->{'osdistroname'};
|
||||
$osimage_tab->close();
|
||||
|
||||
if ($osdistroname and $osdistroname =~ /^pkvm/ ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_nodes_cmm
|
||||
Description : Get the CMM of nodelist
|
||||
Arguments : $nodelist - the ref of node list array
|
||||
@ -1434,6 +1467,7 @@ sub get_netboot_attr{
|
||||
# Priority | Arch | OS Name | OS Major Version | Management method | Noderes.netboot |
|
||||
# 1 | x86_64/x86 | * | * | * | xnba |
|
||||
# 2 | ppc64 | rhels | 7 | * | grub2 |
|
||||
# 2 | ppc64 | pkvm | * | * | petitboot |
|
||||
# 3 | | * | * | * | yaboot |
|
||||
# 4 | ppc64le/el | * | * | * | grub2
|
||||
# 4 | ppc64le/el | * | * | ipmi | petitboot
|
||||
@ -1444,6 +1478,7 @@ sub get_netboot_attr{
|
||||
'7' => 'grub2',
|
||||
'*' => 'yaboot',
|
||||
},
|
||||
'pkvm' => 'petitboot',
|
||||
'*' => 'yaboot',
|
||||
},
|
||||
'ppc64le' => {
|
||||
|
@ -814,6 +814,8 @@ Usage:
|
||||
$nodecurrprofiles{'networkprofile'} = $group;
|
||||
}elsif ($group =~ /__HardwareProfile/){
|
||||
$nodecurrprofiles{'hardwareprofile'} = $group;
|
||||
}elsif ($group =~ /__Hypervisor/){
|
||||
next;
|
||||
}else{
|
||||
$nodecurrprofiles{'groups'} .= $group.",";
|
||||
}
|
||||
@ -859,6 +861,9 @@ Usage:
|
||||
$hardwareprofile = $args_dict{'hardwareprofile'};
|
||||
}
|
||||
|
||||
# Verify whether this node is KVM hypervisor node
|
||||
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) {
|
||||
@ -910,6 +915,9 @@ Usage:
|
||||
# Update nodes' attributes
|
||||
foreach (@$nodes) {
|
||||
$updatenodeshash{$_}{'groups'} .= $profile_groups;
|
||||
if ($is_kvm_hypv) {
|
||||
$updatenodeshash{$_}{'groups'} .= ",__Hypervisor_kvm";
|
||||
}
|
||||
$updatenodereshash{$_}{'netboot'} = $new_netboot;
|
||||
}
|
||||
|
||||
@ -2030,6 +2038,9 @@ sub gen_new_hostinfo_dict{
|
||||
# Check whether this is Power env.
|
||||
my $is_fsp = xCAT::ProfiledNodeUtils->is_fsp_node($args_dict{'networkprofile'});
|
||||
|
||||
# Check whether this node is PowerKVM Hypervisor node
|
||||
my $is_kvm_hypv = xCAT::ProfiledNodeUtils->is_kvm_hypv_node($args_dict{'imageprofile'});
|
||||
|
||||
foreach my $item (sort(keys %hostinfo_dict)){
|
||||
# Set Nodes's type:
|
||||
$hostinfo_dict{$item}{"objtype"} = 'node';
|
||||
@ -2127,6 +2138,7 @@ sub gen_new_hostinfo_dict{
|
||||
if (exists $args_dict{'imageprofile'}){$hostinfo_dict{$item}{"groups"} .= ",".$args_dict{'imageprofile'}}
|
||||
if (exists $args_dict{'hardwareprofile'}){$hostinfo_dict{$item}{"groups"} .= ",".$args_dict{'hardwareprofile'}}
|
||||
if (exists $args_dict{'groups'}){$hostinfo_dict{$item}{"groups"} .= ",".$args_dict{'groups'}}
|
||||
if ($is_kvm_hypv) {$hostinfo_dict{$item}{"groups"} .= ",__Hypervisor_kvm"}
|
||||
|
||||
# xCAT limitation: slotid attribute only for power, id is for x.
|
||||
if ((exists $hostinfo_dict{$item}{"slotid"}) && (! $is_fsp) ){
|
||||
|
Loading…
Reference in New Issue
Block a user