From 4b0e3db9eabf48c65f923a49d1746bc5765875f2 Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Sat, 20 Sep 2008 22:26:48 +0000 Subject: [PATCH] -Add 'nodeset winshell' to be like nodeset shell, but start an inferior OS git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@2217 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/destiny.pm | 2 +- xCAT-server/lib/xcat/plugins/windows.pm | 54 ++++++++++++++++++++----- 2 files changed, 46 insertions(+), 10 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/destiny.pm b/xCAT-server/lib/xcat/plugins/destiny.pm index af0d93239..d3246e889 100644 --- a/xCAT-server/lib/xcat/plugins/destiny.pm +++ b/xCAT-server/lib/xcat/plugins/destiny.pm @@ -82,7 +82,7 @@ sub setdestiny { if ($ient->{kcmdline}) { $hash->{kcmdline} = $ient->{kcmdline} } $bptab->setNodeAttribs($_,$hash); } - } elsif ($state =~ /^install$/ or $state eq "install" or $state eq "netboot" or $state eq "image") { + } elsif ($state =~ /^install$/ or $state eq "install" or $state eq "netboot" or $state eq "image" or $state eq "winshell") { chomp($state); $subreq->({command=>["mk$state"], node=>$req->{node}}, \&relay_response); diff --git a/xCAT-server/lib/xcat/plugins/windows.pm b/xCAT-server/lib/xcat/plugins/windows.pm index b5a3a31c3..7770d7cf0 100644 --- a/xCAT-server/lib/xcat/plugins/windows.pm +++ b/xCAT-server/lib/xcat/plugins/windows.pm @@ -28,6 +28,7 @@ sub handled_commands return { copycd => "windows", mkinstall => "nodetype:os=(win.*|imagex)", + mkwinshell => "windows", mkimage => "nodetype:os=imagex", }; } @@ -46,6 +47,9 @@ sub process_request { return copycd($request, $callback, $doreq); } + elsif ($request->{command}->[0] eq 'mkwinshell') { + return winshell($request,$callback,$doreq); + } elsif ($request->{command}->[0] eq 'mkinstall') { return mkinstall($request, $callback, $doreq); @@ -102,17 +106,50 @@ sub mkimage { print $shandle ":END\r\n"; print $shandle "pause\r\n"; close($shandle); - foreach (getips($node)) { - link "$installroot/autoinst/$node.cmd","$installroot/autoinst/$_.cmd"; - unlink "/tftpboot/Boot/BCD.$_"; - if ($ent->{arch} =~ /64/) { - link "/tftpboot/Boot/BCD.64","/tftpboot/Boot/BCD.$_"; - } else { - link "/tftpboot/Boot/BCD.32","/tftpboot/Boot/BCD.$_"; - } + mkwinlinks($node,$ent); + } +} +sub mkwinlinks { + my $node = shift; + my $ent = shift; + foreach (getips($node)) { + link "$installroot/autoinst/$node.cmd","$installroot/autoinst/$_.cmd"; + unlink "/tftpboot/Boot/BCD.$_"; + if ($ent->{arch} =~ /64/) { + link "/tftpboot/Boot/BCD.64","/tftpboot/Boot/BCD.$_"; + } else { + link "/tftpboot/Boot/BCD.32","/tftpboot/Boot/BCD.$_"; } } } + +sub winshell { + my $installroot = "/install"; + my $request = shift; + my $script = "cmd"; + my @nodes = @{$request->{node}}; + my $node; + my $ostab = xCAT::Table->new('nodetype'); + my $oshash = $ostab->getNodesAttribs(\@nodes,['profile','arch']); + foreach $node (@nodes) { + open($shandle,">","$installroot/autoinst/$node.cmd"); + print $shandle $script; + close $shandle; + mkwinlinks($node,$oshash->{$node}->[0]); + my $bptab = xCAT::Table->new('bootparams',-create=>1); + $bptab->setNodeAttribs( + $node, + { + kernel => "Boot/pxeboot.0", + initrd => "", + kcmdline => "" + } + ); + } +} + +sub applyimagescript { +} #Don't sweat os type as for mkimage it is always 'imagex' if it got here sub mkinstall { @@ -295,7 +332,6 @@ sub copycd if ($sitetab) { (my $ref) = $sitetab->getAttribs({key => installdir}, value); - print Dumper($ref); if ($ref and $ref->{value}) { $installroot = $ref->{value};