Handle multiple groups when generating node name.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11129 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2011-12-06 03:04:47 +00:00
parent c7eb0b0856
commit 756ee41b95

View File

@ -347,6 +347,12 @@ sub gennodename {
# Generate node name based on given group
my ( $callback, $group ) = @_;
# Only use the 1st group
if ($group =~ m/,/) {
my @groups = split(',', $group);
$group = @groups[0];
}
my $hostname_regex;
my $ipaddr_regex;
@ -438,7 +444,7 @@ sub clonezlinux {
my $src_node = $request->{arg}->[1];
my $group = $request->{arg}->[2];
my $owner = $request->{arg}->[3];
# Get source node's HCP
my $props = xCAT::zvmUtils->getNodeProps( 'zvm', $src_node, ('hcp') );
my $hcp = $props->{'hcp'};
@ -482,9 +488,9 @@ sub clonezlinux {
# Create VM
# e.g. webportal provzlinux [group] [hcp] [image]
my ($node, $base_digit) = gennodename( $callback, $group );
my ($node, $ip, $base_digit) = gennodename( $callback, $group );
my $userid = 'XCAT' . $base_digit;
# Set node definitions
$out = `mkdef -t node -o $node userid=$userid hcp=$hcp mgt=zvm groups=$group`;
println( $callback, "$out" );