1 # Copyright (c) 2003 Intel Corporation
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following
13 # disclaimer in the documentation and/or other materials provided
14 # with the distribution.
16 # * Neither the name of the Intel Corporation nor the names of its
17 # contributors may be used to endorse or promote products derived
18 # from this software without specific prior written permission.
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
24 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 # EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF
33 # YOUR JURISDICTION. It is licensee's responsibility to comply with any
34 # export regulations applicable in licensee's jurisdiction. Under
35 # CURRENT (May 2000) U.S. export regulations this software is eligible
36 # for export from the U.S. and can be downloaded by or otherwise
37 # exported or reexported worldwide EXCEPT to U.S. embargoed destinations
38 # which include Cuba, Iraq, Libya, North Korea, Iran, Syria, Sudan,
39 # Afghanistan and any other country to which the U.S. has embargoed
45 from Exceptions import *
53 - unmount all previously mounted partitions
55 Except the following variables from the store:
56 TEMP_PATH the path to download and store temp files to
57 SYSIMG_PATH the path where the system image will be mounted
58 (always starts with TEMP_PATH)
59 PARTITIONS dictionary of generic part. types (root/swap)
60 and their associated devices.
61 NODE_ID the node_id from the database for this node
63 this is needed to make any requests back to the server
65 Sets the following variables:
70 log.write( "\n\nStep: Install: Shutting down installer.\n" )
72 # make sure we have the variables we need
74 TEMP_PATH= vars["TEMP_PATH"]
76 raise ValueError, "TEMP_PATH"
78 SYSIMG_PATH= vars["SYSIMG_PATH"]
80 raise ValueError, "SYSIMG_PATH"
82 PARTITIONS= vars["PARTITIONS"]
83 if PARTITIONS == None:
84 raise ValueError, "PARTITIONS"
86 NODE_ID= vars["NODE_ID"]
88 raise ValueError("NODE_ID")
91 raise BootManagerException, "Missing variable in vars: %s\n" % var
92 except ValueError, var:
93 raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
97 # make sure the required partitions exist
98 val= PARTITIONS["root"]
99 val= PARTITIONS["swap"]
100 val= PARTITIONS["vservers"]
101 except KeyError, part:
102 raise BootManagerException, "Missing partition in PARTITIONS: %s\n" % part
105 utils.sysexec_noerr( "chroot %s umount /rcfs" % SYSIMG_PATH, log )
107 log.write( "Unmounting proc.\n" )
108 utils.sysexec( "umount %s/proc" % SYSIMG_PATH, log )
110 log.write( "Unmounting vserver partition.\n" )
111 utils.sysexec( "umount %s" % PARTITIONS["vservers"], log )
113 log.write( "Unmounting rcfs file system in image.\n" )
114 utils.sysexec_noerr( "chroot %s umount /rcfs" % SYSIMG_PATH, log )
116 log.write( "Unmounting system image.\n" )
117 utils.sysexec( "umount %s" % PARTITIONS["root"], log )
119 log.write( "Shutting down swap\n" )
120 utils.sysexec( "swapoff %s" % PARTITIONS["swap"], log )
122 # as one of the last steps, upload /var/log/messages if it exists
124 # send a notification that the install is complete
126 #message= "installfinished"
130 # result= utils.notifybootserver( BS_REQUEST, NODE_ID,
132 # action, message, nodestate )
133 #except AlpinaError, desc:
134 # log.write( "Unable to notify boot server of " \
135 # "install complete (not critical): %s" % desc )