From c3a3b8083b9b4a87cb3ce441ed590bf962706b06 Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 1 Jul 2015 04:33:14 -0400 Subject: [PATCH] add '-c' option for mknb to just create netboot configuration file --- xCAT-server/lib/xcat/plugins/mknb.pm | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/mknb.pm b/xCAT-server/lib/xcat/plugins/mknb.pm index 4bae8272b..400b5943d 100644 --- a/xCAT-server/lib/xcat/plugins/mknb.pm +++ b/xCAT-server/lib/xcat/plugins/mknb.pm @@ -61,6 +61,13 @@ sub process_request { $callback->({error=>"Unable to find directory $::XCATROOT/share/xcat/netboot/$arch or $::XCATROOT/share/xcat/netboot/genesis/$arch",errorcode=>[1]}); return; } + my $configfileonly = $request->{arg}->[1]; + if ($configfileonly and $configfileonly ne "-c" and $configfileonly ne "--configfileonly") { + $callback->({error=>"The option $configfileonly is not supported", errorcode=>[1]}) ; + return; + } elsif ($configfileonly) { + goto CREAT_CONF_FILE; + } unless ( -r "/root/.ssh/id_rsa.pub" ) { if (-r "/root/.ssh/id_rsa") { $callback->({data=>["Extracting ssh public key from private key"]}); @@ -155,11 +162,17 @@ sub process_request { $callback->({data=>["Creating filesystem file in $tftpdir/xcat failed"]}); return; } + +CREAT_CONF_FILE: my $hexnets = xCAT::NetworkUtils->my_hexnets(); my $normnets = xCAT::NetworkUtils->my_nets(); my $consolecmdline; if (defined($serialport) and $serialspeed) { - $consolecmdline = "console=tty0 console=ttyS$serialport,$serialspeed"; + if ($arch =~ /ppc/) { + $consolecmdline = "console=tty0 console=hvc$serialport,$serialspeed"; + } else { + $consolecmdline = "console=tty0 console=ttyS$serialport,$serialspeed"; + } if ($serialflow =~ /cts/ or $serialflow =~ /hard/) { $consolecmdline .= "n8r"; } @@ -293,9 +306,9 @@ sub process_request { } } - - - + if ($configfileonly) { + $callback->({data=>["Write netboot config file done"]}); + } } 1;