mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-30 19:02:27 +00:00 
			
		
		
		
	Checkin code for image group support which will be used by litefile/litetree table
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13252 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		| @@ -603,11 +603,12 @@ notification => { | ||||
|  }, | ||||
|   }, | ||||
| osimage => { | ||||
|  cols => [qw(imagename profile imagetype provmethod rootfstype osname osvers osdistro osarch synclists postscripts postbootscripts comments disable)], | ||||
|  cols => [qw(imagename groups profile imagetype provmethod rootfstype osname osvers osdistro osarch synclists postscripts postbootscripts comments disable)], | ||||
|  keys => [qw(imagename)], | ||||
|     table_desc => 'Basic information about an operating system image that can be used to deploy cluster nodes.', | ||||
|  descriptions => { | ||||
|   imagename => 'The name of this xCAT OS image definition.', | ||||
|   groups => 'A comma-delimited list of groups this image is a member of.  Group names are arbitrary.', | ||||
|   imagetype => 'The type of operating system image this definition represents (linux,AIX).', | ||||
|   provmethod => 'The provisioning method for node deployment. The valid values are install, netboot or statelite. It is not used by AIX.', | ||||
|   rootfstype => 'The filesystem type for the rootfs is used when the provmethod is statelite. The valid values are nfs or ramdisk. The default value is nfs', | ||||
| @@ -1967,6 +1968,10 @@ push(@{$defspec{node}->{'attrs'}}, @nodeattrs); | ||||
|                  tabentry => 'osimage.imagename', | ||||
|                  access_tabentry => 'osimage.imagename=attr:imagename', | ||||
|                  }, | ||||
|  {attr_name => 'groups', | ||||
|                  tabentry => 'osimage.groups', | ||||
|                  access_tabentry => 'osimage.imagename=attr:imagename', | ||||
|                  }, | ||||
|  {attr_name => 'imagetype', | ||||
|                  tabentry => 'osimage.imagetype', | ||||
|                  access_tabentry => 'osimage.imagename=attr:imagename', | ||||
|   | ||||
| @@ -605,12 +605,25 @@ sub make_bundle { | ||||
|  | ||||
| 	$callback->({data=>["Getting litefile settings"]}); | ||||
| 	my @imageInfo; | ||||
|         # get the directories with no names | ||||
|         push @imageInfo, $lftab->getAttribs({image => ''}, ('file','options')); | ||||
|         # get the ALL directories | ||||
|         push @imageInfo, $lftab->getAttribs({image => 'ALL'}, ('file','options')); | ||||
|         # get for the image specific directories | ||||
|         push @imageInfo, $lftab->getAttribs({image => $imagename}, ('file','options')); | ||||
|         my @imagegroupsattr = ('groups'); | ||||
|         # Check if this image contains osimage.groups attribute. | ||||
|         # if so, means user wants to use specific directories to this image. | ||||
|         my $osimagetab = xCAT::Table->new("osimage",-create=>1); | ||||
|         my $imagegroups = $osimagetab->getAttribs({imagename => $imagename}, @imagegroupsattr); | ||||
|         if ($imagegroups and $imagegroups->{groups}) { | ||||
|             # get for the image groups specific directories | ||||
|             push @imageInfo, $lftab->getAttribs({image => $imagegroups->{groups}}, ('file','options')); | ||||
|             # get for the image specific directories | ||||
|             push @imageInfo, $lftab->getAttribs({image => $imagename}, ('file','options')); | ||||
|         } else { | ||||
|             # get the directories with no names | ||||
|             push @imageInfo, $lftab->getAttribs({image => ''}, ('file','options')); | ||||
|             # get the ALL directories | ||||
|             push @imageInfo, $lftab->getAttribs({image => 'ALL'}, ('file','options')); | ||||
|             # get for the image specific directories | ||||
|             push @imageInfo, $lftab->getAttribs({image => $imagename}, ('file','options')); | ||||
|         } | ||||
|  | ||||
| 	open(FILE,">$tpath/litefile.csv") or die "Could not open $tpath/litefile.csv"; | ||||
| 	foreach(@imageInfo){ | ||||
| 	    my $file=$_->{file}; | ||||
|   | ||||
| @@ -302,6 +302,7 @@ sub getNodeData { | ||||
|  | ||||
| 	my @imageInfo; | ||||
| 	my @attrs; | ||||
|         my @imagegroupsattr = ('groups'); | ||||
| 	if($type eq "dir"){ | ||||
| 		@attrs = ('priority', 'directory'); | ||||
| 	}elsif($type =~ /file|image/){ | ||||
| @@ -320,12 +321,23 @@ sub getNodeData { | ||||
| 	} | ||||
| 	else | ||||
| 	{ | ||||
|         # get the directories with no names | ||||
|         push @imageInfo, $tab->getAttribs({image => ''}, @attrs); | ||||
|         # get the ALL directories | ||||
|         push @imageInfo, $tab->getAttribs({image => 'ALL'}, @attrs); | ||||
|         # get for the image specific directories | ||||
|         push @imageInfo, $tab->getAttribs({image => $image}, @attrs); | ||||
|             # Check if this image contains osimage.groups attribute. | ||||
|             # if so, means user wants to use specific directories to this image. | ||||
|             my $osimagetab = xCAT::Table->new("osimage",-create=>1); | ||||
|             my $imagegroups = $osimagetab->getAttribs({imagename => $image}, @imagegroupsattr); | ||||
|             if ($imagegroups and $imagegroups->{groups}) { | ||||
|                 # get for the image groups specific directories | ||||
|                 push @imageInfo, $tab->getAttribs({image => $imagegroups->{groups}}, @attrs); | ||||
|                 # get for the image specific directories | ||||
|                 push @imageInfo, $tab->getAttribs({image => $image}, @attrs); | ||||
|             } else { | ||||
|                 # get the directories with no names | ||||
|                 push @imageInfo, $tab->getAttribs({image => ''}, @attrs); | ||||
|                 # get the ALL directories | ||||
|                 push @imageInfo, $tab->getAttribs({image => 'ALL'}, @attrs); | ||||
|                 # get for the image specific directories | ||||
|                 push @imageInfo, $tab->getAttribs({image => $image}, @attrs); | ||||
|             }  | ||||
| 	} | ||||
| 	# pass back a reference to the directory | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user