Merge commit 'origin/master'
This commit is contained in:
commit
2f352c0b1a
@ -10,7 +10,7 @@ if ($^O =~ /^aix/i) {
|
||||
}
|
||||
|
||||
use strict;
|
||||
use Sys::Syslog qw (:DEFAULT setlogsock);
|
||||
use Sys::Syslog;
|
||||
use xCAT::Utils;
|
||||
#use locale;
|
||||
use Socket;
|
||||
@ -456,8 +456,7 @@ sub message
|
||||
|
||||
# If they want this msg to also go to syslog, do that now
|
||||
eval {
|
||||
openlog("xCAT", '', 'local4');
|
||||
setlogsock(["tcp", "unix", "stream"]);
|
||||
openlog("xCAT", "nofatal,pid", "local4");
|
||||
if ($sev eq 'SE') {
|
||||
syslog("err", $rsp);
|
||||
} else {
|
||||
@ -503,8 +502,7 @@ sub message
|
||||
{
|
||||
print $stdouterrf "Unable to open auditlog\n";
|
||||
eval {
|
||||
openlog("xCAT", '', 'local4');
|
||||
setlogsock(["tcp", "unix", "stream"]);
|
||||
openlog("xCAT", "nofatal,pid", "local4");
|
||||
syslog("err", "Unable to write to auditlog");
|
||||
closelog();
|
||||
};
|
||||
@ -521,8 +519,7 @@ sub message
|
||||
{ # error
|
||||
print $stdouterrf "Unable to open auditlog\n";
|
||||
eval {
|
||||
openlog("xCAT", '', 'local4');
|
||||
setlogsock(["tcp", "unix", "stream"]);
|
||||
openlog("xCAT", "nofatal,pid", "local4");
|
||||
syslog("err", "Unable to open auditlog");
|
||||
closelog();
|
||||
};
|
||||
|
@ -191,7 +191,7 @@ vmmaster => {
|
||||
}
|
||||
},
|
||||
vm => {
|
||||
cols => [qw(node mgr host migrationdest storage storagemodel cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter cluster guestostype othersettings vidmodel vidproto vidpassword comments disable)],
|
||||
cols => [qw(node mgr host migrationdest storage storagemodel storagecache storageformat cfgstore memory cpus nics nicmodel bootorder clockoffset virtflags master vncport textconsole powerstate beacon datacenter cluster guestostype othersettings vidmodel vidproto vidpassword comments disable)],
|
||||
keys => [qw(node)],
|
||||
tablespace =>'XCATTBS32K',
|
||||
table_desc => 'Virtualization parameters',
|
||||
@ -230,6 +230,8 @@ vm => {
|
||||
'vidproto' => "Request a specific protocol for remote video access be set up. For example, spice in KVM.",
|
||||
'vidmodel' => "Model of video adapter to provide to guest. For example, qxl in KVM",
|
||||
'vidpassword' => "Password to use instead of temporary random tokens for VNC and SPICE access",
|
||||
'storagecache' => "Select caching scheme to employ. E.g. KVM understands 'none', 'writethrough' and 'writeback'",
|
||||
'storageformat' => "Select disk format to use by default (e.g. raw versus qcow2)",
|
||||
}
|
||||
},
|
||||
hypervisor => {
|
||||
@ -2236,6 +2238,14 @@ my @nodeattrs = (
|
||||
tabentry => 'vm.storagemodel',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmstoragecache',
|
||||
tabentry => 'vm.storagecache',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmstorageformat',
|
||||
tabentry => 'vm.storageformat',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
},
|
||||
{attr_name => 'vmcfgstore',
|
||||
tabentry => 'vm.cfgstore',
|
||||
access_tabentry => 'vm.node=attr:node',
|
||||
|
@ -26,7 +26,7 @@ sub grab_table_data{ #grab table data relevent to VM guest nodes
|
||||
if ($vpdtab) {
|
||||
$cfghash->{vpd} = $vpdtab->getNodesAttribs($noderange,['uuid']);
|
||||
}
|
||||
$cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','vidmodel','vidproto','vidpassword','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags','datacenter','guestostype','othersettings','master']);
|
||||
$cfghash->{vm} = $vmtab->getNodesAttribs($noderange,['node','host','migrationdest','cfgstore','storage','storagecache','storageformat','vidmodel','vidproto','vidpassword','storagemodel','memory','cpus','nics','nicmodel','bootorder','virtflags','datacenter','guestostype','othersettings','master']);
|
||||
my $mactab = xCAT::Table->new("mac",-create=>1);
|
||||
my $nrtab= xCAT::Table->new("noderes",-create=>1);
|
||||
$cfghash->{mac} = $mactab->getAllNodeAttribs(['mac'],1);
|
||||
|
100
xCAT-client/pods/man1/geninitrd.1.pod
Normal file
100
xCAT-client/pods/man1/geninitrd.1.pod
Normal file
@ -0,0 +1,100 @@
|
||||
=head1 NAME
|
||||
|
||||
B<genimage> - Generate an initrd (initial ramfs) which to be used for statefull install or stateless netboot.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<geninitrd> <imagename>
|
||||
|
||||
B<geninitrd> [B<-h> | B<--help>]
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Generate the initrd for the osimage: B<imagename> which is an xCAT object of I<osimage> type.
|
||||
|
||||
B<Diskfull Osimage>
|
||||
|
||||
=over 2
|
||||
|
||||
If the B<imagename> is a statefull one (The provmethod attribute for the osimage is 'install'),
|
||||
this command is used to rebuild the initrd to inject the new drivers from driver rpms or
|
||||
'update distro' and copy the rebuilt initrd and new kernel (If there's new kernel in 'update
|
||||
distro') to the directory I</tftpboot/xcat/<imagename>>.
|
||||
|
||||
If the initrd has been rebuilt by geninitrd, when run nodeset, the I<--noupdateinitrd> option
|
||||
should be used to skip the rebuilding of initrd to improve the performance.
|
||||
|
||||
Three attributes of osimage object can be used to specify the Driver RPM location and Driver names
|
||||
for injecting new drviers to initrd.
|
||||
|
||||
B<netdrivers> - comma separated driver names that need to be injected to the initrd.
|
||||
The postfix '.ko' can be ignored. The netdrivers attribute must be set to specify the new driver list.
|
||||
If you want to load all the drivers from the driver rpms, using the keyword allupdate.
|
||||
|
||||
B<driverupdatesrc> - comma separated driver rpm packages (full path should be specified)
|
||||
|
||||
B<osupdatename> - comma separated 'osdistroupdate' object. Each 'osdistroupdate' object specifies a
|
||||
Linux distro update. When run geninitrd, 'kernel-*.rpm' will be searched from osdistroupdate.dirpath
|
||||
to get all the rpm packages and then search the drivers from the rpm packages.
|
||||
|
||||
Refer to the doc: https://sourceforge.net/apps/mediawiki/xcat/index.php?title=Using_Linux_Driver_Update_Disk
|
||||
|
||||
=back
|
||||
|
||||
B<Stateless Osimage>
|
||||
|
||||
=over 2
|
||||
|
||||
If the B<imagename> is a stateless one (The provmethod attribute for the osimage is 'netboot'),
|
||||
this command is used to generate the initrd from the rootimg which generated by 'genimage' command.
|
||||
So the 'genimage' must be run once before running the geninitrd command.
|
||||
|
||||
Two attributes of osimage object can be used to specify the Driver RPM location and Driver names
|
||||
for injecting new drviers to initrd.
|
||||
|
||||
B<netdrivers> - comma separated driver names that need to be injected to the initrd.
|
||||
The postfix '.ko' can be ignored. The netdrivers attribute must be set to specify the new driver list.
|
||||
If you want to load all the drivers from the driver rpms, using the keyword allupdate.
|
||||
|
||||
B<driverupdatesrc> - comma separated driver rpm packages (full path should be specified)
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 Parameters
|
||||
|
||||
I<imagename> specifies the name of an os image definition to be used. The specification for the image is storted in the I<osimage> table and I<linuximage> table.
|
||||
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
0 The command completed successfully.
|
||||
|
||||
1 An error has occurred.
|
||||
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
=over 3
|
||||
|
||||
=item 1
|
||||
To generate initrd for the osimage B<myimagename>:
|
||||
|
||||
geninitrd myimagename
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=head1 FILES
|
||||
|
||||
/opt/xcat/bin/geninitrd
|
||||
|
||||
/opt/xcat/bin/genimage
|
||||
|
||||
/opt/xcat/share/xcat/netboot/<OS>/genimage
|
||||
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<geninitrd(1)|geninitrd.1>, L<genimage(1)|genimage.1>
|
@ -6,6 +6,8 @@ B<nodeset> - set the boot state for a noderange
|
||||
|
||||
B<nodeset> [I<noderange>] [I<boot>|I<install>|I<stat>|I<iscsiboot>|I<netboot>|I<statelite>|I<offline>|I<runcmd=bmcsetup>|I<osimage[=<imagename>>]]
|
||||
|
||||
B<nodeset> I<noderange> [I<osimage=<imagename>> I<--noupdateinitrd>]
|
||||
|
||||
B<nodeset> [I<-h>|I<--help>|I<-v>|I<--version>]
|
||||
|
||||
=head1 B<Description>
|
||||
@ -67,6 +69,11 @@ Cleanup the current pxe/tftp boot configuration files for the nodes requested
|
||||
|
||||
Prepare server for installing a node using the specified os image. The os image is defined in the I<osimage> table and I<linuximage> table. If the <imagename> is omitted, the os image name will be obtained from I<nodetype.provmethod> for the node.
|
||||
|
||||
=item B<--noupdateinitrd>
|
||||
|
||||
Skip the rebuilding of initrd when the 'netdrivers', 'drvierupdatesrc' or 'osupdatename' were set for injecting new drviers to initrd. But, the geninitrd command
|
||||
should be run to rebuild the initrd for new drivers injecting. This is used to improve the performance of nodeset command.
|
||||
|
||||
=item B<runimage>=<task>>
|
||||
|
||||
If you would like to run a task after deployment, you can define that task with this attribute.
|
||||
|
@ -1556,7 +1556,8 @@ sub mksysclone
|
||||
}
|
||||
}
|
||||
|
||||
# copy postscripts
|
||||
# copy postscripts, the xCAT scripts may update, but the image is captured long time ago
|
||||
# should update the scripts at each nodeset
|
||||
my $script1 = "configefi";
|
||||
my $script2 = "updatenetwork";
|
||||
my $pspath = "$installroot/sysclone/scripts/post-install/";
|
||||
|
@ -26,8 +26,28 @@ sub preprocess_request
|
||||
my $req = shift;
|
||||
my $callback = shift;
|
||||
|
||||
unless (defined ($req->{arg}) && $req->{arg}->[0]) {
|
||||
xCAT::MsgUtils->message("E", {error=>["An osimage name needs to be specified."], errorcode=>["1"]}, $callback);
|
||||
my $usage = sub {
|
||||
my $callback = shift;
|
||||
xCAT::MsgUtils->message("I", {data=>["Usage: geninitrd <imagename> [-h | --help]"]}, $callback);
|
||||
};
|
||||
|
||||
my $osimage;
|
||||
if (defined ($req->{arg})) {
|
||||
foreach (@{$req->{arg}}) {
|
||||
if (/^-/) {
|
||||
$usage->($callback);
|
||||
return;
|
||||
}else {
|
||||
$osimage = $_;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$usage->($callback);
|
||||
return;
|
||||
}
|
||||
|
||||
unless ($osimage) {
|
||||
$usage->($callback);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -46,10 +66,11 @@ sub process_request
|
||||
{
|
||||
my $req = shift;
|
||||
my $callback = shift;
|
||||
my $doreq = shift;
|
||||
|
||||
if ($req->{command}->[0] eq 'geninitrd')
|
||||
{
|
||||
return geninitrd($req, $callback);
|
||||
return geninitrd($req, $callback, $doreq);
|
||||
}
|
||||
|
||||
}
|
||||
@ -57,6 +78,7 @@ sub process_request
|
||||
sub geninitrd {
|
||||
my $req = shift;
|
||||
my $callback = shift;
|
||||
my $doreq = shift;
|
||||
|
||||
my $osimage = $req->{arg}->[0];
|
||||
|
||||
@ -69,7 +91,7 @@ sub geninitrd {
|
||||
return;
|
||||
}
|
||||
|
||||
my $oient = $osimagetab->getAttribs({imagename => $osimage}, 'osvers', 'osarch', 'osupdatename');
|
||||
my $oient = $osimagetab->getAttribs({imagename => $osimage}, 'provmethod', 'osvers', 'osarch', 'osupdatename');
|
||||
unless ($oient && $oient->{'osvers'} && $oient->{'osarch'} ) {
|
||||
xCAT::MsgUtils->message("E", {error=>["The osimage [$osimage] was not defined or [osvers, osarch] attributes were not set."], errorcode=>["1"]}, $callback);
|
||||
return;
|
||||
@ -84,7 +106,7 @@ sub geninitrd {
|
||||
return;
|
||||
}
|
||||
|
||||
my $lient = $linuximagetab->getAttribs({imagename => $osimage}, 'pkgdir', 'driverupdatesrc', 'netdrivers');
|
||||
my $lient = $linuximagetab->getAttribs({imagename => $osimage}, 'rootimgdir', 'pkgdir', 'driverupdatesrc', 'netdrivers');
|
||||
unless ($lient && $lient->{'pkgdir'}) {
|
||||
xCAT::MsgUtils->message("E", {error=>["The osimage [$osimage] was not defined or [pkgdir] attribute was not set."], errorcode=>["1"]}, $callback);
|
||||
return;
|
||||
@ -93,6 +115,27 @@ sub geninitrd {
|
||||
$driverupdatesrc = $lient->{'driverupdatesrc'};
|
||||
$netdrivers = $lient->{'netdrivers'};
|
||||
|
||||
# if the provmethod equals 'netboot', call the genimage --onlyinitrd directly
|
||||
if ($oient->{'provmethod'} && $oient->{'provmethod'} eq "netboot") {
|
||||
if ($lient->{'rootimgdir'}) {
|
||||
unless (-d $lient->{'rootimgdir'}."/rootimg/lib/modules") {
|
||||
xCAT::MsgUtils->message("E", {error=>["The genimage should be run before running geninitrd."], errorcode=>["1"]}, $callback);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
xCAT::MsgUtils->message("E", {error=>["The rootimgdir attribute for the osimage should be set."], errorcode=>["1"]}, $callback);
|
||||
return;
|
||||
}
|
||||
my @output = `genimage $osimage --onlyinitrd`;
|
||||
xCAT::MsgUtils->message("I", {data=>\@output}, $callback);
|
||||
#$doreq->({ command => ['genimage'],
|
||||
# arg => [$osimage, '--onlyinitrd'] }, $callback);
|
||||
return;
|
||||
} elsif (!$oient->{'provmethod'} || $oient->{'provmethod'} ne "install") {
|
||||
xCAT::MsgUtils->message("E", {error=>["The attribute [provmethod] for osimage [$osimage] must be set to install or netboot."], errorcode=>["1"]}, $callback);
|
||||
return;
|
||||
}
|
||||
|
||||
# get the path list of the osdistroupdate
|
||||
if ($oient->{'osupdatename'}) {
|
||||
my @osupdatenames = split (/,/, $oient->{'osupdatename'});
|
||||
|
@ -252,6 +252,13 @@ sub add_hosts_content {
|
||||
{
|
||||
addnode $callback, $nodename, $ip, $ref->{hostnames}, $domain;
|
||||
}
|
||||
else
|
||||
{
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Invalid IP Addr \'$ref->{ip}\' for node \'$ref->{node}\'.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
}
|
||||
|
||||
if (defined($ref->{otherinterfaces}))
|
||||
{
|
||||
addotherinterfaces $callback, $nodename, $ref->{otherinterfaces}, $domain;
|
||||
|
@ -2895,6 +2895,7 @@ sub parseprod {
|
||||
}
|
||||
$idx+=$currsize;
|
||||
($currsize,$currdata,$encode)=extractfield(\@area,$idx);
|
||||
if ($currsize < 0) { last }
|
||||
}
|
||||
return \%info;
|
||||
|
||||
@ -2967,6 +2968,7 @@ sub parseboard {
|
||||
}
|
||||
$idx+=$currsize;
|
||||
($currsize,$currdata,$encode)=extractfield(\@area,$idx);
|
||||
if ($currsize < 0) { last }
|
||||
}
|
||||
if ($global_sessdata->{isanimm}) { #we can understand more specifically some of the extra fields...
|
||||
$boardinf{frunum}=$boardinf{extra}->[0]->{value};
|
||||
@ -3031,6 +3033,7 @@ sub parsechassis {
|
||||
}
|
||||
$idx+=$currsize;
|
||||
($currsize,$currdata,$encode)=extractfield(\@chassarea,$idx);
|
||||
if ($currsize < 0) { last }
|
||||
}
|
||||
return \%chassisinf;
|
||||
}
|
||||
@ -3042,7 +3045,7 @@ sub extractfield { #idx is location of the type/length byte, returns something a
|
||||
my $data;
|
||||
if ($idx >= scalar @$area) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Error parsing FRU data from BMC"],$callback);
|
||||
return 1,undef,undef;
|
||||
return -1,undef,undef;
|
||||
}
|
||||
my $size = $area->[$idx] & 0b00111111;
|
||||
my $encoding = ($area->[$idx] & 0b11000000)>>6;
|
||||
|
@ -303,6 +303,47 @@ sub comp_word
|
||||
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 check_newinstall
|
||||
|
||||
Check if the given kitcomp list are in NEW_INSTALL_LIST
|
||||
or not. If so, set $::noupgrade all other kitcomp
|
||||
depending on this list will be put into NEW_INSTALL_LIST
|
||||
also
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub check_newinstall
|
||||
{
|
||||
my $kitcomponents = shift;
|
||||
my @lines = @_;
|
||||
|
||||
my @kitcomps = split /,/, $kitcomponents;
|
||||
|
||||
foreach my $kitcomp ( @kitcomps ) {
|
||||
last if ( $::noupgrade );
|
||||
|
||||
my $match_newinstall = 0;
|
||||
foreach my $line ( @lines ) {
|
||||
chomp($line);
|
||||
if ( $line =~ /^#NEW_INSTALL_LIST#$/ ) {
|
||||
$match_newinstall = 1;
|
||||
}
|
||||
if ( $line =~ /\/$kitcomp$/ ) {
|
||||
if ( $match_newinstall ) {
|
||||
$::noupgrade = 1;
|
||||
}
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 assign_to_osimage
|
||||
@ -319,7 +360,7 @@ sub assign_to_osimage
|
||||
my $callback = shift;
|
||||
my $tabs = shift;
|
||||
|
||||
(my $kitcomptable) = $tabs->{kitcomponent}->getAttribs({kitcompname=> $kitcomp}, 'kitname', 'kitreponame', 'basename', 'kitpkgdeps', 'prerequisite', 'exlist', 'genimage_postinstall','postbootscripts', 'driverpacks');
|
||||
(my $kitcomptable) = $tabs->{kitcomponent}->getAttribs({kitcompname=> $kitcomp}, 'kitname', 'kitreponame', 'basename', 'kitcompdeps', 'kitpkgdeps', 'prerequisite', 'exlist', 'genimage_postinstall','postbootscripts', 'driverpacks');
|
||||
(my $osimagetable) = $tabs->{osimage}->getAttribs({imagename=> $osimage}, 'provmethod', 'osarch', 'postbootscripts', 'kitcomponents');
|
||||
(my $linuximagetable) = $tabs->{linuximage}->getAttribs({imagename=> $osimage}, 'rootimgdir', 'exlist', 'postinstall', 'otherpkglist', 'otherpkgdir', 'driverupdatesrc');
|
||||
|
||||
@ -688,6 +729,13 @@ sub assign_to_osimage
|
||||
push @lines, "$kitreponame/$kitcomptable->{prerequisite}\n";
|
||||
$::noupgrade = 1;
|
||||
}
|
||||
|
||||
# Check if this kitcomponent's kitcompdeps are in NEW_INSTALL_LIST or not.
|
||||
# If so, set $::noupgrade to put this kitcomp in a new NEW_INSTALL_LIST
|
||||
if ( $kitcomptable and $kitcomptable->{kitcompdeps} ) {
|
||||
check_newinstall($kitcomptable->{kitcompdeps}, @lines);
|
||||
}
|
||||
|
||||
if ( $::noupgrade ) {
|
||||
push @lines, "#NEW_INSTALL_LIST#\n";
|
||||
foreach my $kitdeployparam ( @kitdeployparams ) {
|
||||
@ -2141,7 +2189,7 @@ sub addkitcomp
|
||||
if ( $kitcomp eq $oskitcomp ) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "$kitcomp kit component is already in osimage $osimage";
|
||||
xCAT::MsgUtils->message( "E", \%rsp, $callback );
|
||||
xCAT::MsgUtils->message( "I", \%rsp, $callback );
|
||||
$catched = 1;
|
||||
}
|
||||
}
|
||||
@ -2491,19 +2539,36 @@ sub rmkitcomp
|
||||
|
||||
# Remove symlink from osimage.otherpkgdir.
|
||||
|
||||
# Read all the kitcomponents assigned to all the osimage to make sure the repo used by other osimage
|
||||
# will not be deleted.
|
||||
|
||||
my @allosikitcomps = $tabs{osimage}->getAllAttribs( 'imagename', 'kitcomponents' );
|
||||
|
||||
(my $linuximagetable) = $tabs{linuximage}->getAttribs({imagename=> $osimage}, 'postinstall', 'exlist', 'otherpkglist', 'otherpkgdir', 'driverupdatesrc');
|
||||
if ( $linuximagetable and $linuximagetable->{otherpkgdir} ) {
|
||||
|
||||
my $otherpkgdir = $linuximagetable->{otherpkgdir};
|
||||
foreach my $kitcomponent (keys %kitcomps) {
|
||||
|
||||
my %newosikitcomponents;
|
||||
foreach my $allosikitcomp (@allosikitcomps) {
|
||||
if ( $allosikitcomp->{kitcomponents} and $allosikitcomp->{imagename} ) {
|
||||
my @allkitcomps = split /,/, $allosikitcomp->{kitcomponents};
|
||||
foreach my $allkitcomp ( @allkitcomps ) {
|
||||
if ( $allosikitcomp->{imagename} ne $osimage or $allkitcomp ne $kitcomponent ) {
|
||||
$newosikitcomponents{$allkitcomp} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( $kitcomps{$kitcomponent}{kitreponame} ) {
|
||||
if ( -d "$otherpkgdir/$kitcomps{$kitcomponent}{kitreponame}" ) {
|
||||
|
||||
# Check if this repo is used by other kitcomponent before removing the link
|
||||
my $match = 0;
|
||||
foreach my $osikitcomp ( @osikitcomps ) {
|
||||
next if ( $osikitcomp =~ /$kitcomponent/ );
|
||||
foreach my $osikitcomp ( keys %newosikitcomponents ) {
|
||||
|
||||
my $depkitrepodir;
|
||||
(my $kitcomptable) = $tabs{kitcomponent}->getAttribs({kitcompname => $osikitcomp}, 'kitreponame');
|
||||
if ( $kitcomptable and $kitcomptable->{kitreponame} ) {
|
||||
|
@ -278,7 +278,9 @@ sub get_filepath_by_url { #at the end of the day, the libvirt storage api gives
|
||||
my $create = $args{create};
|
||||
my $force = $args{force};
|
||||
my $format = $args{format};
|
||||
my $sparse = 1;
|
||||
if ($url =~ /^lvm:/) {
|
||||
$sparse = 0;
|
||||
$format = 'raw';
|
||||
}
|
||||
unless ($format) {
|
||||
@ -327,7 +329,7 @@ sub get_filepath_by_url { #at the end of the day, the libvirt storage api gives
|
||||
# additionally, when mastering a powered down node, we should rebase the node to be a cow clone of the master it just spawned
|
||||
} else {
|
||||
my $vol;
|
||||
if ($format eq 'raw') { #skip allocation specification for now
|
||||
unless ($sparse) { #skip allocation specification for now
|
||||
#currently, LV can have reduced allocation, but *cannot* grow.....
|
||||
$vol = $poolobj->create_volume("<volume><name>".$desiredname."</name><target><format type='$format'/></target><capacity>".getUnits($create,"G",1)."</capacity></volume>");
|
||||
} else {
|
||||
@ -488,6 +490,10 @@ sub build_diskstruct {
|
||||
$cdhash->{target}->{dev}='hdc';
|
||||
push @returns,$cdhash;
|
||||
}
|
||||
my $cachemethod = "none";
|
||||
if ( $confdata->{vm}->{$node}->[0]->{storagecache}) {
|
||||
$cachemethod = $confdata->{vm}->{$node}->[0]->{storagecache};
|
||||
}
|
||||
|
||||
|
||||
if (defined $confdata->{vm}->{$node}->[0]->{storage}) {
|
||||
@ -530,8 +536,7 @@ sub build_diskstruct {
|
||||
$tdiskhash->{device}='disk';
|
||||
$tdiskhash->{driver}->{name}='qemu';
|
||||
$tdiskhash->{driver}->{type}=$disks{$_}->{format};
|
||||
$tdiskhash->{driver}->{cache}="none"; #in this scenario, making a brand new vm, there is not much the hypervisor cache can do for us that the
|
||||
#guest cannot do for itself
|
||||
$tdiskhash->{driver}->{cache}=$cachemethod;
|
||||
$tdiskhash->{source}->{file}=$_;
|
||||
$tdiskhash->{target}->{dev} = $disks{$_}->{device};
|
||||
if ($disks{$_} =~ /^vd/) {
|
||||
@ -1209,13 +1214,17 @@ sub createstorage {
|
||||
#my $diskstruct = shift;
|
||||
my $node = $cfginfo->{node};
|
||||
my @flags = split /,/,$cfginfo->{virtflags};
|
||||
my $format;
|
||||
foreach (@flags) {
|
||||
if (/^imageformat=(.*)\z/) {
|
||||
$imgfmt=$1;
|
||||
$format=$1;
|
||||
} elsif (/^clonemethod=(.*)\z/) {
|
||||
$clonemethod=$1;
|
||||
}
|
||||
}
|
||||
if ($cfginfo->{storageformat}) {
|
||||
$format = $cfginfo->{storageformat};
|
||||
}
|
||||
my $mountpath;
|
||||
my $pathappend;
|
||||
|
||||
@ -1242,7 +1251,7 @@ sub createstorage {
|
||||
if ($filename =~ /^nfs:/ or $filename =~ /^dir:/ or $filename =~ /^lvm:/) { #libvirt storage pool to be used for this
|
||||
my @sizes = split /,/,$size;
|
||||
foreach (@sizes) {
|
||||
get_filepath_by_url(url=>$filename,dev=>$prefix.shift(@suffixes),create=>$_, force=>$force);
|
||||
get_filepath_by_url(url=>$filename,dev=>$prefix.shift(@suffixes),create=>$_, force=>$force, format=>$format);
|
||||
}
|
||||
}else{
|
||||
oldCreateStorage($filename, $mastername, $size, $cfginfo, $force);
|
||||
@ -1653,6 +1662,15 @@ sub chvm {
|
||||
$suffix=$1;
|
||||
$format='raw';
|
||||
}
|
||||
if ($confdata->{vm}->{$node}->[0]->{storageformat}) {
|
||||
$format = $confdata->{vm}->{$node}->[0]->{storageformat};
|
||||
}
|
||||
#when creating a new disk not cloned from anything, disable cache as copy on write content similarity is a lost cause...
|
||||
my $cachemode = 'none';
|
||||
#unless user knows better
|
||||
if ($confdata->{vm}->{$node}->[0]->{storagecache}) {
|
||||
$cachemode = $confdata->{vm}->{$node}->[0]->{storagecache};
|
||||
}
|
||||
my $bus;
|
||||
if ($suffix =~ /^sd/) {
|
||||
$bus='scsi';
|
||||
@ -1661,8 +1679,7 @@ sub chvm {
|
||||
} elsif ($suffix =~ /vd/) {
|
||||
$bus='virtio';
|
||||
}
|
||||
#when creating a new disk not cloned from anything, disable cache as copy on write content similarity is a lost cause...
|
||||
my $xml = "<disk type='file' device='disk'><driver name='qemu' type='$format' cache='none'/><source file='$_'/><target dev='$suffix' bus='$bus'/></disk>";
|
||||
my $xml = "<disk type='file' device='disk'><driver name='qemu' type='$format' cache='$cachemode'/><source file='$_'/><target dev='$suffix' bus='$bus'/></disk>";
|
||||
if ($currstate eq 'on') { #attempt live attach
|
||||
eval {
|
||||
$dom->attach_device($xml);
|
||||
|
@ -596,7 +596,7 @@ sub nodeset {
|
||||
my $subreq = shift;
|
||||
my $host2mic = shift;
|
||||
|
||||
my $usage_string = "nodeset noderange [osimage=imagename]";
|
||||
my $usage_string = "nodeset noderange osimage[=imagename]";
|
||||
|
||||
my $nodes = $request->{'node'};
|
||||
my $args = $request->{arg};
|
||||
@ -604,9 +604,6 @@ sub nodeset {
|
||||
foreach (@$args) {
|
||||
if (/osimage=(.*)/) {
|
||||
$setosimg = $1;
|
||||
} else {
|
||||
xCAT::MsgUtils->message("E", {error=>[$usage_string], errorcode=>["1"]}, $callback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -625,11 +622,12 @@ sub nodeset {
|
||||
}
|
||||
$nttab->setNodesAttribs(\%setpmethod);
|
||||
}
|
||||
|
||||
|
||||
# get the provision method from nodetype table
|
||||
my $nthash = $nttab->getNodesAttribs($nodes,['provmethod']);
|
||||
foreach my $node (@$nodes) {
|
||||
unless (defined ($nthash->{$node}->[0]->{'provmethod'})) {
|
||||
xCAT::MsgUtils->message("E", {error=>["The provmethod for the node $node must be set before the nodeset."], errorcode=>["1"]}, $callback);
|
||||
xCAT::MsgUtils->message("E", {error=>["The provmethod for the node $node must be set by [nodeset <node> osimage=<image name>] or set in the provmethod attribute of the node."], errorcode=>["1"]}, $callback);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -35,28 +35,43 @@ unless ($master && $cfgpath) {
|
||||
}
|
||||
|
||||
# get the correct host name for the host
|
||||
my $nodename;
|
||||
my ($nodename, $nodename_short);
|
||||
my $masterip = `getent hosts $master | awk {'print \$1'}`;
|
||||
chomp($masterip);
|
||||
my $myip = `ip route get $masterip| head -n 1 | sed 's/^.*src//g' | awk {'print \$1'}`;
|
||||
my $myipinfo =`getent hosts $myip`;
|
||||
if ($myipinfo =~ /([^\s]+)\s+([^\s]+)\s+([^\s]+)/) {
|
||||
my $n1 = $2;
|
||||
my $n2 = $3;
|
||||
if (length($n1) > length($n2)) {
|
||||
$nodename = $n2;
|
||||
} else {
|
||||
$nodename = $n1;
|
||||
if ($masterip) {
|
||||
chomp($masterip);
|
||||
my $myip = `ip route get $masterip| head -n 1 | sed 's/^.*src//g' | awk {'print \$1'}`;
|
||||
if ($myip) {
|
||||
my $myipinfo =`getent hosts $myip`;
|
||||
|
||||
if ($myipinfo && $myipinfo =~ /([^\s]+)\s+([^\s]+)\s+([^\s]+)/) {
|
||||
my $n1 = $2;
|
||||
my $n2 = $3;
|
||||
if (length($n1) > length($n2)) {
|
||||
$nodename_short = $n2;
|
||||
} else {
|
||||
$nodename = $n1;
|
||||
}
|
||||
} elsif ($myipinfo && $myipinfo =~ /([^\s]+)\s+([^\s]+)/) {
|
||||
$nodename_short = $2;
|
||||
}
|
||||
}
|
||||
} elsif ($myipinfo =~ /([^\s]+)\s+([^\s]+)/) {
|
||||
$nodename = $2;
|
||||
} else {
|
||||
outputmsg("Error: cannot get the hostname of the host node\n", 2);
|
||||
}
|
||||
unless ($nodename) {
|
||||
$nodename = `hostname`;
|
||||
chomp($nodename);
|
||||
}
|
||||
unless ($nodename_short) {
|
||||
$nodename_short = `hostname -s`;
|
||||
chomp($nodename_short);
|
||||
}
|
||||
|
||||
# download the mic configuration file from master
|
||||
my $cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/miccfg.$nodename -P $tmppath";
|
||||
my ($rc, $output) = runsyscmd ($cmd, "Error: failed to download mic configuration file from $master\n", 3);
|
||||
my $cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/miccfg.$nodename_short -P $tmppath";
|
||||
my ($rc, $output) = runsyscmd ($cmd);
|
||||
if ($rc) {
|
||||
$cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/miccfg.$nodename -P $tmppath";
|
||||
runsyscmd ($cmd, "Error: failed to download mic configuration file from $master\n", 3);
|
||||
}
|
||||
|
||||
unless (-r "$tmppath/miccfg.$nodename") {
|
||||
runsyscmd ("Error: cannot get the mic configuration file from http://$master/$cfgpath/miccfg.$nodename\n", 4);
|
||||
|
@ -36,28 +36,43 @@ unless ($master && $cfgpath) {
|
||||
}
|
||||
|
||||
# get the correct host name for the host
|
||||
my $nodename;
|
||||
my ($nodename, $nodename_short);
|
||||
my $masterip = `getent hosts $master | awk {'print \$1'}`;
|
||||
chomp($masterip);
|
||||
my $myip = `ip route get $masterip| head -n 1 | sed 's/^.*src//g' | awk {'print \$1'}`;
|
||||
my $myipinfo =`getent hosts $myip`;
|
||||
if ($myipinfo =~ /([^\s]+)\s+([^\s]+)\s+([^\s]+)/) {
|
||||
my $n1 = $2;
|
||||
my $n2 = $3;
|
||||
if (length($n1) > length($n2)) {
|
||||
$nodename = $n2;
|
||||
} else {
|
||||
$nodename = $n1;
|
||||
if ($masterip) {
|
||||
chomp($masterip);
|
||||
my $myip = `ip route get $masterip| head -n 1 | sed 's/^.*src//g' | awk {'print \$1'}`;
|
||||
if ($myip) {
|
||||
my $myipinfo =`getent hosts $myip`;
|
||||
|
||||
if ($myipinfo && $myipinfo =~ /([^\s]+)\s+([^\s]+)\s+([^\s]+)/) {
|
||||
my $n1 = $2;
|
||||
my $n2 = $3;
|
||||
if (length($n1) > length($n2)) {
|
||||
$nodename_short = $n2;
|
||||
} else {
|
||||
$nodename = $n1;
|
||||
}
|
||||
} elsif ($myipinfo && $myipinfo =~ /([^\s]+)\s+([^\s]+)/) {
|
||||
$nodename_short = $2;
|
||||
}
|
||||
}
|
||||
} elsif ($myipinfo =~ /([^\s]+)\s+([^\s]+)/) {
|
||||
$nodename = $2;
|
||||
} else {
|
||||
outputmsg("Error: cannot get the hostname of the host node\n", 2);
|
||||
}
|
||||
unless ($nodename) {
|
||||
$nodename = `hostname`;
|
||||
chomp($nodename);
|
||||
}
|
||||
unless ($nodename_short) {
|
||||
$nodename_short = `hostname -s`;
|
||||
chomp($nodename_short);
|
||||
}
|
||||
|
||||
# download the mic configuration file from master
|
||||
my $cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/micflash.$nodename -P $tmppath";
|
||||
my ($rc, $output) = runsyscmd ($cmd, "Error: failed to download mic configuration file from $master\n", 3);
|
||||
my $cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/micflash.$nodename_short -P $tmppath";
|
||||
my ($rc, $output) = runsyscmd ($cmd);
|
||||
if ($rc) {
|
||||
$cmd = "wget -N --waitretry=10 --random-wait -T 60 http://$master/$cfgpath/micflash.$nodename -P $tmppath";
|
||||
runsyscmd ($cmd, "Error: failed to download mic configuration file from $master\n", 3);
|
||||
}
|
||||
|
||||
unless (-r "$tmppath/micflash.$nodename") {
|
||||
runsyscmd ("Error: cannot get the mic configuration file from http://$master/$cfgpath/micflash.$nodename\n", 4);
|
||||
|
@ -189,3 +189,23 @@ cmd:lsdef -t wrongtype -o test
|
||||
check:rc!=0
|
||||
check:output=~Error
|
||||
end
|
||||
|
||||
start:lsdef_t_h_i
|
||||
description:lsdef -t node -h -i status
|
||||
cmd:lsdef -t node -h -i status
|
||||
check:rc==0
|
||||
check:output=~status
|
||||
end
|
||||
|
||||
start:lsdef_nics
|
||||
description:lsdef --nics
|
||||
cmd:mkdef -t node -o testnode1 groups=all mgt=ipmi nicips.eth0=1.1.1.1
|
||||
check:rc==0
|
||||
cmd:lsdef testnode1 --nics
|
||||
check:rc==0
|
||||
check:output=~1.1.1.1
|
||||
cmd:rmdef testnode1
|
||||
check:rc==0
|
||||
cmd:lsdef testnode1
|
||||
check:output=~Could not find
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user