Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
commit
1b4173456b
@ -895,18 +895,21 @@ sub check_profile_consistent{
|
||||
return 0, "Provisioning network not defined for network profile."
|
||||
}
|
||||
|
||||
# Remove check mechanism about arch and netboot attribute
|
||||
# Attribute 'neboot' will be generated based on arch, management method, os
|
||||
|
||||
# Profile consistent keys, arch=>netboot, mgt=>nictype
|
||||
my $ppc_netboot = 'yaboot';
|
||||
if( $os =~ /rhels7/ ){
|
||||
$ppc_netboot = 'grub2';
|
||||
}
|
||||
my %profile_dict = ('x86' => 'xnba','x86_64' => 'xnba', 'ppc64' => $ppc_netboot,
|
||||
'ppc64el' => $ppc_netboot,
|
||||
'fsp' => 'FSP', 'ipmi' => 'BMC');
|
||||
#my $ppc_netboot = 'yaboot';
|
||||
#if( $os =~ /rhels7/ ){
|
||||
# $ppc_netboot = 'grub2';
|
||||
#}
|
||||
#my %profile_dict = ('x86' => 'xnba','x86_64' => 'xnba', 'ppc64' => $ppc_netboot,
|
||||
# 'ppc64el' => $ppc_netboot,
|
||||
# 'fsp' => 'FSP', 'ipmi' => 'BMC');
|
||||
# Check if imageprofile is consistent with networkprofile
|
||||
if ($profile_dict{$arch} ne $netboot) {
|
||||
return 0, "Imageprofile's arch is not consistent with networkprofile's netboot."
|
||||
}
|
||||
#if ($profile_dict{$arch} ne $netboot) {
|
||||
# return 0, "Imageprofile's arch is not consistent with networkprofile's netboot."
|
||||
#}
|
||||
|
||||
# Check if networkprofile is consistent with hardwareprofile
|
||||
if (not $hardwareprofile) { # Not define hardwareprofile
|
||||
@ -916,27 +919,27 @@ sub check_profile_consistent{
|
||||
return 0, "$nictype networkprofile must use with hardwareprofile.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($mgt eq 'vm')
|
||||
{
|
||||
return 1, "";
|
||||
}
|
||||
|
||||
my %mgt_dict = ('fsp' => 'FSP', 'ipmi' => 'BMC', 'kvm' => '');
|
||||
|
||||
# For nodetype is lpar node, not need to check the nictype as it is not required for lpar node
|
||||
if (not $nictype and $mgt and $nodetype ne 'lpar' ) {
|
||||
# define hardwareprofile, not define fsp or bmc networkprofile, and the node type is not lpar
|
||||
return 0, "$profile_dict{$mgt} hardwareprofile must use with $profile_dict{$mgt} networkprofile.";
|
||||
if ($mgt eq 'vm') {
|
||||
return 1, "";
|
||||
}
|
||||
|
||||
if ($profile_dict{$mgt} ne $nictype and $nodetype ne 'lpar') {
|
||||
# Networkprofile's nictype is not consistent with hadrwareprofile's mgt, and the node type is not lpar
|
||||
return 0, "Networkprofile's nictype is not consistent with hardwareprofile's mgt.";
|
||||
if ($nodetype eq 'lpar') {
|
||||
if ($nictype) {
|
||||
# Can not associate FSP/BMC network if the node type is lpar
|
||||
return 0, "The node with hardware type $nodetype can not use with $nictype networkprofile.";
|
||||
}
|
||||
return 1, ""
|
||||
}
|
||||
|
||||
if ($nodetype eq 'lpar' and $nictype eq 'FSP')
|
||||
{
|
||||
# can not associate FSP network if the node type is lpar
|
||||
return 0, "The node with hardware type $nodetype can not use with $nictype networkprofile.";
|
||||
|
||||
if ($mgt and $mgt_dict{$mgt} ne $nictype) {
|
||||
my $errmsg = "$mgt hardwareprofile must use with $mgt_dict{$mgt} networkprofile.";
|
||||
if ( $mgt eq 'kvm' ) {
|
||||
$errmsg = "$mgt hardwareprofile must use with non-BMC and non-FSP networkprofile."
|
||||
}
|
||||
return 0, $errmsg;
|
||||
}
|
||||
|
||||
return 1, "";
|
||||
@ -1267,3 +1270,32 @@ sub gen_chain_for_profiles{
|
||||
}
|
||||
return (0, $final_chain);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_all_vmhosts
|
||||
Description : Get all vm hosts/hypervisor from DB.
|
||||
Arguments : N/A
|
||||
Returns : ref for vm hosts/hypervisor hash.
|
||||
Example :
|
||||
my $hashref = xCAT::ProfiledNodeUtils->get_all_vmhosts();
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
sub get_all_vmhosts
|
||||
{
|
||||
my %vmhostshash;
|
||||
|
||||
my $nodelisttab = xCAT::Table->new('nodelist');
|
||||
# groups like '__Hypervisor_pkvm' means this node is Power KVM hypervisor
|
||||
my @vmhosts = $nodelisttab->getAllAttribsWhere("groups like '%__Hypervisor_kvm%'", 'node');
|
||||
foreach (@vmhosts) {
|
||||
if($_->{'node'}) {
|
||||
$vmhostshash{$_->{'node'}} = 1;
|
||||
}
|
||||
}
|
||||
$nodelisttab->close();
|
||||
|
||||
# Return the ref accordingly
|
||||
return \%vmhostshash;
|
||||
}
|
||||
|
@ -134,12 +134,22 @@ To import nodes using a profile, follow the following steps:
|
||||
cec=mycec
|
||||
lparid=2
|
||||
# Node information file ends.
|
||||
|
||||
Example of a node information file that specifies a PowerKVM Guest node that uses KVM management:
|
||||
|
||||
# Node information file begins
|
||||
# This entry defines a PowerKVM Guest node.
|
||||
# Make sure the node 'vm01' is already created on Hypervisor
|
||||
vm01:
|
||||
mac=b8:ef:3f:28:31:15
|
||||
vmhost=pkvm1
|
||||
# Node information file ends.
|
||||
|
||||
The node information file includes the following items:
|
||||
|
||||
B<__hostname__:> This is a mandatory item.
|
||||
|
||||
Description: The name of the node, where __hostname__ is automatically generated by the node name format. You can also input a fixed node name, for example “compute-node”.
|
||||
Description: The name of the node, where __hostname__ is automatically generated by the node name format. You can also input a fixed node name, for example "compute-node".
|
||||
|
||||
B<mac=<mac-address>> This is a mandatory item.
|
||||
|
||||
@ -185,6 +195,10 @@ B<unit=<rack-server-unit-location>> This is an optional item.
|
||||
|
||||
Description: node location info, for rack server only. Specify the node's start unit number in rack, in U. this item must be specified together with rack and height.
|
||||
|
||||
B<vmhost=<PowerKVM Hypervisior Host Name>> This is a mandatory option for defining PowerKVM Guest nodes.
|
||||
|
||||
Description: Specifies the vmhost of a Power KVM Guest node, where <vmhost> is the host name of PowerKVM Hypervisior.
|
||||
|
||||
3. Import the nodes, by using the following commands. Note: If we want to import PureFlex X/P nodes, hardware profile must be set to a PureFlex hardware type.
|
||||
nodeimport file=/root/hostinfo.txt networkprofile=default_cn imageprofile=rhels6.3_packaged hostnameformat=compute-#NNN
|
||||
|
||||
|
@ -42,6 +42,7 @@ my %allracks;
|
||||
my %allchassis;
|
||||
my %allswitches;
|
||||
my %all_switchports;
|
||||
my %allvmhosts;
|
||||
|
||||
my @switch_records;
|
||||
|
||||
@ -430,6 +431,10 @@ Usage:
|
||||
# Get all LPAR ids
|
||||
$recordsref = xCAT::ProfiledNodeUtils->get_all_lparids(\%allcecs);
|
||||
%alllparids = %$recordsref;
|
||||
|
||||
# Get all vm hosts/hypervisiors
|
||||
$recordsref = xCAT::ProfiledNodeUtils->get_all_vmhosts();
|
||||
%allvmhosts = %$recordsref;
|
||||
|
||||
#TODO: can not use getallnode to get rack infos.
|
||||
$recordsref = xCAT::ProfiledNodeUtils->get_all_rack(1);
|
||||
@ -2103,6 +2108,12 @@ sub gen_new_hostinfo_dict{
|
||||
$hostinfo_dict{$item}{"mgt"} = "fsp";
|
||||
}
|
||||
|
||||
# Generate VM host nodes' attribute
|
||||
# Update netboot attribute if this is powerKVM node
|
||||
if (exists $hostinfo_dict{$item}{"vmhost"}){
|
||||
$hostinfo_dict{$item}{"netboot"} = 'grub2';
|
||||
}
|
||||
|
||||
# get the chain attribute from hardwareprofile and insert it to node.
|
||||
my $chaintab = xCAT::Table->new('chain');
|
||||
my $hardwareprofile = $args_dict{'hardwareprofile'};
|
||||
@ -2538,6 +2549,12 @@ sub validate_node_entry{
|
||||
}
|
||||
}
|
||||
}
|
||||
}elsif ($_ eq "vmhost") {
|
||||
# Support PowerKVM vms
|
||||
my $vm_host= $node_entry{"vmhost"};
|
||||
if (! exists $allvmhosts{$node_entry{$_}}){
|
||||
$errmsg .= "The VM host name $node_entry{$_} that is specified in the node information file is not defined in the system.\n";
|
||||
}
|
||||
}else{
|
||||
$errmsg .= "Invalid attribute $_ specified\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user