validate profiles existing in database and also check hostnameformat while start node discovery
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14655 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -618,6 +618,20 @@ sub check_profile_consistent{ | ||||
|     my $networkprofile = shift; | ||||
|     my $hardwareprofile = shift; | ||||
|      | ||||
|     # Check the profiles are existing in DB. | ||||
|     my @nodegrps = xCAT::TableUtils->list_all_node_groups(); | ||||
|     unless(grep{ $_ eq $imageprofile} @nodegrps){ | ||||
|         return 0, "Image profile not defined in DB." | ||||
|     } | ||||
|     unless(grep{ $_ eq $networkprofile} @nodegrps){ | ||||
|         return 0, "Network profile not defined in DB." | ||||
|     } | ||||
|     if ($hardwareprofile){ | ||||
|         unless(grep{ $_ eq $hardwareprofile} @nodegrps){ | ||||
|             return 0, "Hardware profile not defined in DB." | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     # Profile consistent keys, arch=>netboot,  mgt=>nictype | ||||
|     my %profile_dict = ('x86' => 'xnba','x86_64' => 'xnba', 'ppc64' => 'yaboot', | ||||
|                         'fsp' => 'FSP', 'ipmi' => 'BMC'); | ||||
|   | ||||
| @@ -761,11 +761,22 @@ Usage: | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     my ($returncode, $errmsg) = xCAT::ProfiledNodeUtils->check_profile_consistent($args_dict{'imageprofile'}, $args_dict{'networkprofile'}, $args_dict{'hardwareprofile'}); | ||||
|     if (not $returncode) { | ||||
|         setrsp_errormsg($errmsg); | ||||
|         return; | ||||
|     } | ||||
|  | ||||
|     # validate hostnameformat: | ||||
|     my $nameformattype = xCAT::ProfiledNodeUtils->get_hostname_format_type($args_dict{'hostnameformat'}); | ||||
|     if ($nameformattype eq "unknown"){ | ||||
|         setrsp_errormsg("Invalid node name format: $args_dict{'hostnameformat'}"); | ||||
|         return; | ||||
|     }elsif($nameformattype eq 'rack'){ | ||||
|         if ((! exists $args_dict{'rack'}) && (! exists $args_dict{'chassis'})){ | ||||
|             setrsp_errormsg("Specify rack/chassis as node name format includes rack info."); | ||||
|             return; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     my $recordsref = xCAT::ProfiledNodeUtils->get_all_rack(1); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user