diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index eb7621ecf..6fe2ee410 100644 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -315,7 +315,7 @@ osimage => { }, passwd => { cols => [qw(key username password comments disable)], - keys => [qw(key)], + keys => [qw(key username)], table_desc => 'Contains default userids and passwords for xCAT to access cluster components. In most cases, xCAT will also actually set the userid/password in the relevant component when it is being configured or installed. Userids/passwords for specific cluster components can be overidden in other tables, e.g. mpa, ipmi, ppchcp, etc.', descriptions => { key => 'The type of component this user/pw is for. Valid values: blade (management module), ipmi (BMC), system (nodes), omapi (DHCP), hmc, ivm, fsp.', diff --git a/xCAT-server/lib/xcat/plugins/windows.pm b/xCAT-server/lib/xcat/plugins/windows.pm index 31462b7aa..b020c70cb 100644 --- a/xCAT-server/lib/xcat/plugins/windows.pm +++ b/xCAT-server/lib/xcat/plugins/windows.pm @@ -5,6 +5,7 @@ use Sys::Syslog; use File::Temp qw/tempdir/; use xCAT::Table; use xCAT::Utils; +use Socket; use xCAT::MsgUtils; use xCAT::Template; use xCAT::Postage; @@ -21,7 +22,7 @@ sub handled_commands { return { copycd => "windows", - #mkinstall => "nodetype:os=win.*" + mkinstall => "nodetype:os=win.*" }; } @@ -39,14 +40,16 @@ sub process_request { return copycd($request, $callback, $doreq); } -# elsif ($request->{command}->[0] eq 'mkinstall') -# { -# return mkinstall($request, $callback, $doreq); -# } + elsif ($request->{command}->[0] eq 'mkinstall') + { + return mkinstall($request, $callback, $doreq); + } } sub mkinstall { + my $installroot; + $installroot = "/install"; my $request = shift; my $callback = shift; my $doreq = shift; @@ -54,6 +57,7 @@ sub mkinstall my $node; my $ostab = xCAT::Table->new('nodetype'); my %doneimgs; + my $bptab = xCAT::Table->new('bootparams',-create=>1); foreach $node (@nodes) { my $osinst; @@ -162,14 +166,34 @@ sub mkinstall $callback->( { error => [ - "Failed to detect copycd configured install source at /install/$os/$arch" + "Failed to detect copycd configured install source at /$installroot/$os/$arch/sources/install.wim" ], errorcode => [1] } ); } + my $shandle; + open($shandle,">","$installroot/autoinst/$node.cmd"); + print $shandle "i:\\$os\\$arch\\setup /unattend:i:\\autoinst\\$node /noreboot\r"; + close($shandle); + foreach (getips($node)) { + link "$installroot/autoinst/$node.cmd","$installroot/autoinst/$_.cmd" + unlink "/tftpboot/Boot/BCD.$_"; + if ($arch =~ /64/) { + link "/tftpboot/Boot/BCD.64","/tftpboot/Boot/BCD.$_"; + } else { + link "/tftpboot/Boot/BCD.32","/tftpboot/Boot/BCD.$_"; + } + } } } +sub getips { #TODO: all the possible ip addresses + my $node = shift; + my $ip = inet_ntoa(inet_aton($node));; + return ($ip); +} + + sub copycd { @@ -214,9 +238,7 @@ sub copycd unless ($distname) { $distname = "win2k8"; } - print "indeed"; } - print "$path huh?\n"; unless ($distname) { return; diff --git a/xCAT-server/share/xcat/netboot/windows/genimage.bat b/xCAT-server/share/xcat/netboot/windows/genimage.bat index 1d00da0c1..2808f6d97 100644 --- a/xCAT-server/share/xcat/netboot/windows/genimage.bat +++ b/xCAT-server/share/xcat/netboot/windows/genimage.bat @@ -16,24 +16,24 @@ md c:\WinPE_%SUFFIX%\pxe\Boot\ md c:\WinPE_%SUFFIX%\pxe\Boot\Fonts if exist "C:\Program Files\Windows AIK\Tools\PETools\%ARCH%\bootmgr" copy "C:\Program Files\Windows AIK\Tools\PETools\%ARCH%\boot\fonts\wgl4_boot.ttf" "c:\WinPE_%SUFFIX%\pxe\Boot\Fonts" if exist "C:\Program Files\Windows AIK\Tools\PETools\%ARCH%\Boot\boot.sdi" copy "C:\Program Files\Windows AIK\Tools\PETools\%ARCH%\boot\boot.sdi" "c:\WinPE_%SUFFIX%\pxe\Boot\boot.sdi" -copy "c:\Program Files\Windows AIK\Tools\PETools\%ARCH%\winpe.wim" "c:\WinPE_%SUFFIX%\pxe\Boot\WinPE.wim" +copy "c:\Program Files\Windows AIK\Tools\PETools\%ARCH%\winpe.wim" "c:\WinPE_%SUFFIX%\pxe\Boot\WinPE_%SUFFIX%.wim" -bcdedit /createstore c:\WinPE_%SUFFIX%\pxe\Boot\BCD -bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD /create {ramdiskoptions} /d "Ramdisk options" -bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD /set {ramdiskoptions} ramdisksdidevice boot -bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi -for /f "Tokens=3" %%i in ('bcdedit /store c:\WinPE_%SUFFIX%\pxe\Boot\BCD /create /d "xCAT WinNB" /application osloader') do set GUID=%%i -bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD /set %GUID% systemroot \Windows -bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD /set %GUID% detecthal Yes -bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD /set %GUID% winpe Yes -bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD /set %GUID% osdevice ramdisk=[boot]\Boot\WinPE.wim,{ramdiskoptions} -bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD /set %GUID% device ramdisk=[boot]\Boot\WinPE.wim,{ramdiskoptions} -bcdedit /store c:\WinPE_%SUFFIX%\pxe\Boot\BCD /create {bootmgr} /d "xCAT WinNB" -bcdedit /store c:\WinPE_%SUFFIX%\pxe\Boot\BCD /set {bootmgr} timeout 1 -bcdedit /store c:\WinPE_%SUFFiX%\pxe\Boot\BCD /set {bootmgr} displayorder %GUID% -bcdedit /store c:\WinPE_%SUFFIX%\pxe\Boot\BCD +bcdedit /createstore c:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% +bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /create {ramdiskoptions} /d "Ramdisk options" +bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /set {ramdiskoptions} ramdisksdidevice boot +bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /set {ramdiskoptions} ramdisksdipath \Boot\boot.sdi +for /f "Tokens=3" %%i in ('bcdedit /store c:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /create /d "xCAT WinNB_%SUFFIX%" /application osloader') do set GUID=%%i +bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /set %GUID% systemroot \Windows +bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /set %GUID% detecthal Yes +bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /set %GUID% winpe Yes +bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /set %GUID% osdevice ramdisk=[boot]\Boot\WinPE_%SUFFIX%.wim,{ramdiskoptions} +bcdedit /store C:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /set %GUID% device ramdisk=[boot]\Boot\WinPE_%SUFFIX%.wim,{ramdiskoptions} +bcdedit /store c:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /create {bootmgr} /d "xCAT WinNB_%SUFFIX%" +bcdedit /store c:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% /set {bootmgr} timeout 1 +bcdedit /store c:\WinPE_%SUFFiX%\pxe\Boot\BCD.%SUFFIX% /set {bootmgr} displayorder %GUID% +bcdedit /store c:\WinPE_%SUFFIX%\pxe\Boot\BCD.%SUFFIX% -"C:\Program Files\Windows AIK\Tools\%ARCH%\imagex.exe" /mountrw c:\WinPE_%SUFFIX%\pxe\Boot\winpe.wim 1 c:\WinPE_%SUFFIX%\rootfs +"C:\Program Files\Windows AIK\Tools\%ARCH%\imagex.exe" /mountrw c:\WinPE_%SUFFIX%\pxe\Boot\winpe_%SUFFIX%.wim 1 c:\WinPE_%SUFFIX%\rootfs copy startnet.cmd c:\WinPE_%SUFFIX%\rootfs\Windows\system32 copy c:\WinPE_%SUFFIX%\rootfs\Windows\Boot\PXE\pxeboot.n12 c:\WinPE_%SUFFIX%\pxe\Boot\pxeboot.0 copy c:\WinPE_%SUFFIX%\rootfs\Windows\Boot\PXE\bootmgr.exe c:\WinPE_%SUFFIX%\pxe\