7013470 Make install technologies compliant with Minilander/Highlander project
authorKaren Tung <Karen.Tung@oracle.com>
Wed, 06 Jul 2011 15:29:06 -0700
changeset 1254 7a85c487dd24
parent 1253 b971c046c5d4
child 1255 d2d810d1c345
7013470 Make install technologies compliant with Minilander/Highlander project
usr/src/cmd/auto-install/profile/sc_sample.xml
usr/src/cmd/auto-install/profile/static_network.xml
usr/src/cmd/distro_const/profile/ai.xml
usr/src/cmd/distro_const/profile/livecd.xml
usr/src/cmd/distro_const/profile/text.xml
usr/src/cmd/installadm/check-server-setup.sh
usr/src/cmd/js2ai/modules/conv_sysidcfg.py
usr/src/cmd/slim-install/svc/network_nwam.xml
usr/src/cmd/system-config/profile/network_info.py
--- a/usr/src/cmd/auto-install/profile/sc_sample.xml	Wed Jul 06 10:15:33 2011 -0600
+++ b/usr/src/cmd/auto-install/profile/sc_sample.xml	Wed Jul 06 15:29:06 2011 -0700
@@ -88,7 +88,10 @@
     </service>
 
     <service name="network/physical" version="1">
-      <instance name="nwam" enabled="true"/>
-      <instance name="default" enabled="false"/>
+      <instance name="default" enabled="true">
+          <property_group name='netcfg' type='application'>
+              <propval name='active_ncp' type='astring' value='Automatic'/>
+          </property_group>
+      </instance>
     </service>
 </service_bundle>
--- a/usr/src/cmd/auto-install/profile/static_network.xml	Wed Jul 06 10:15:33 2011 -0600
+++ b/usr/src/cmd/auto-install/profile/static_network.xml	Wed Jul 06 15:29:06 2011 -0700
@@ -73,8 +73,11 @@
     </service>
 
     <service name="network/physical" version="1">
-        <instance name="nwam" enabled="false"/>
-        <instance name="default" enabled="true"/>
+        <instance name="default" enabled="true">
+          <property_group name='netcfg' type='application'>
+              <propval name='active_ncp' type='astring' value='DefaultFixed'/>
+          </property_group>
+        </instance>
     </service>
 
     <service name='network/install' version='1' type='service'>
--- a/usr/src/cmd/distro_const/profile/ai.xml	Wed Jul 06 10:15:33 2011 -0600
+++ b/usr/src/cmd/distro_const/profile/ai.xml	Wed Jul 06 15:29:06 2011 -0700
@@ -29,8 +29,11 @@
       svc.startd(1M) services
   -->
   <service name='network/physical' version='1' type='service'>
-      <instance name='default' enabled='true'/>
-      <instance name='nwam' enabled='false'/>
+      <instance name='default' enabled='true'>
+          <property_group name='netcfg' type='application'>
+              <propval name='active_ncp' type='astring' value='DefaultFixed'/>
+          </property_group>
+      </instance>
   </service>
   <service name='network/routing/ndp' version='1' type='service'>
     <instance name='default' enabled='false'/>
--- a/usr/src/cmd/distro_const/profile/livecd.xml	Wed Jul 06 10:15:33 2011 -0600
+++ b/usr/src/cmd/distro_const/profile/livecd.xml	Wed Jul 06 15:29:06 2011 -0700
@@ -20,7 +20,7 @@
    
     CDDL HEADER END
    
-    Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+    Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
 
     Service profile customization for Live CD Image.
 -->
@@ -43,8 +43,11 @@
     <instance name='default' enabled='false'/>
   </service>
   <service name='network/physical' version='1' type='service'>
-      <instance name='default' enabled='false'/>
-      <instance name='nwam' enabled='true'/>
+      <instance name='default' enabled='true'>
+          <property_group name='netcfg' type='application'>
+              <propval name='active_ncp' type='astring' value='Automatic'/>
+          </property_group>
+      </instance> 
   </service>
   <service name='network/rpc/gss' version='1' type='service'>
       <instance name='default' enabled='false'/>
--- a/usr/src/cmd/distro_const/profile/text.xml	Wed Jul 06 10:15:33 2011 -0600
+++ b/usr/src/cmd/distro_const/profile/text.xml	Wed Jul 06 15:29:06 2011 -0700
@@ -20,7 +20,7 @@
    
     CDDL HEADER END
    
-    Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+    Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 
     Service profile customization for Text Installer image
 -->
@@ -43,8 +43,11 @@
     <instance name='default' enabled='false'/>
   </service>
   <service name='network/physical' version='1' type='service'>
-      <instance name='default' enabled='false'/>
-      <instance name='nwam' enabled='true'/>
+      <instance name='default' enabled='true'>
+          <property_group name='netcfg' type='application'>
+              <propval name='active_ncp' type='astring' value='Automatic'/>
+          </property_group>
+      </instance>
   </service>
   <service name='network/rpc/gss' version='1' type='service'>
       <instance name='default' enabled='false'/>
--- a/usr/src/cmd/installadm/check-server-setup.sh	Wed Jul 06 10:15:33 2011 -0600
+++ b/usr/src/cmd/installadm/check-server-setup.sh	Wed Jul 06 15:29:06 2011 -0700
@@ -25,16 +25,11 @@
 #	This script checks for basic network setup necessary for an AI server
 #	to function.  Specifically it does the following:
 #
-#	- Check that svc:/network/physical services are set up properly:
-#	  ----------------------------------------------------------------------
-#	  | NWAM  /  default    | not online         | online                  |
-#	  ----------------------------------------------------------------------
-#	  | online              | WARNING (allowed)  | ERROR: too many net svcs|
-#	  ----------------------------------------------------------------------
-#	  | !online & !disabled | ERROR: no net svcs | ERROR: too many net svcs|
-#	  ----------------------------------------------------------------------
-#	  | disabled            | ERROR: no net svcs | OK                      |
-#	  ----------------------------------------------------------------------
+#	- Check that svc:/network/physical:default service is set up properly:
+#         * if disabled: ERROR: no net svcs
+#         * if netcfg/active_ncp == "DefaultFixed": OK
+#         * if netcfg/active_ncp != "DefaultFixed": WARNING(allowed).  This
+#           is the case where Automatic or User NCP is configured.
 #
 #	- Warn if the svc:/network/dns/multicast:default is not online
 #
@@ -50,7 +45,6 @@
 GETENT="/usr/bin/getent"
 
 MDNS_SVC="svc:/network/dns/multicast:default"
-NWAM_SVC="svc:/network/physical:nwam"
 NDEF_SVC="svc:/network/physical:default"
 
 #
@@ -92,24 +86,25 @@
 		print_err "Hostname is not set. " \
 		    "It is needed to get IP information."
 		valid="False"
+                return
 	else
 		# Check network/physical SMF service configuration.
-		NWAM_STATE=$($SVCS -H -o STATE $NWAM_SVC)
 		NDEF_STATE=$($SVCS -H -o STATE $NDEF_SVC)
+
+                # make sure network/physical:default is online.
 		if [ "$NDEF_STATE" != "online" ] ; then
-			if [ "$NWAM_STATE" == "online" ] ; then
-				print_err "Warning: NWAM is enabled. " \
-				    "Please be sure that the IP address for" \
-				    "$THISHOST is static."
-			else
-				print_err "No networking SMF service is online."
-				valid="False"
-			fi
-		elif [ "$NWAM_STATE" != "disabled" ] ; then
-			print_err "More than one SMF network/physical service" \
-			    "is enabled."
-			valid="False"
-		fi
+			print_err "network/physical:default SMF service" \
+			    "is not enabled."
+                fi
+
+                # make sure netcfg/active_ncp property have the right value
+                ACTIVE_NCP_PROP=$($SVCPROP -p netcfg/active_ncp $NDEF_SVC)
+
+                if [ "$ACTIVE_NCP_PROP" != "DefaultFixed" ] ; then
+			print_err "Warning: $ACTIVE_NCP_PROP network" \
+			    "configuration is enabled.  Please be sure that" \
+			    "the IP address for $THISHOST is static."
+                fi
 
 		# Check if svc:/network/dns/multicast:default is online
 		MDNS_STATE=$($SVCS -H -o STATE $MDNS_SVC)
--- a/usr/src/cmd/js2ai/modules/conv_sysidcfg.py	Wed Jul 06 10:15:33 2011 -0600
+++ b/usr/src/cmd/js2ai/modules/conv_sysidcfg.py	Wed Jul 06 15:29:06 2011 -0700
@@ -499,17 +499,20 @@
         # network_interface=None {hostname=hostname}
         #
         # <service name='network/physical' version='1' type='service'>
-        #   <instance name='default' enabled='true'/>
-        #   <instance name='nwam' enabled='false'/>
+        #   <instance name='default' enabled='true'>
+        #       <property_group name='netcfg' type='application'>
+        #           <propval name='active_ncp' type='astring'
+        #               value='DefaultFixed'/>
+        #        </property_group>
+        #   </instance>
         # </service>
         #
-        # NOTICE that default should be enabled.  This only configures
-        # the loopback interface, which is equivalent to what the text
+        # This only configures the loopback interface, 
+        # which is equivalent to what the text
         # installer does today one selects 'None' on Network screen.
         #
 
-        self.__create_net_interface(nwam_setting=False,
-                                        default_setting=True)
+        self.__create_net_interface(auto_netcfg=False)
 
         # Are there any more keys left in the dictionary that we need to flag
         self.__check_payload(line_num, "network_interface=NONE", payload)
@@ -534,8 +537,7 @@
         # The only support we can provide in Solaris for PRIMARY is
         # via nwam and DHCP.  Not a perfect match but it's the best fit
         #
-        self.__create_net_interface(nwam_setting=True,
-                                        default_setting=False)
+        self.__create_net_interface(auto_netcfg=True)
 
         # Do we have a payload to configure
         if payload is None or len(payload) == 0:
@@ -738,9 +740,14 @@
         #      </property_group>
         #    </instance>
         # </service>
-        # <service name="network/physical" version="1" type="service">
-        #    <instance name="nwam" enabled="false"/>
-        #    <instance name="default" enabled="true"/>
+        #
+        # <service name='network/physical' version='1' type='service'>
+        #   <instance name='default' enabled='true'>
+        #       <property_group name='netcfg' type='application'>
+        #           <propval name='active_ncp' type='astring'
+        #               value='DefaultFixed'/>
+        #        </property_group>
+        #   </instance>
         # </service>
         #
         if self._default_network is None:
@@ -773,8 +780,7 @@
             return
 
         # Create default network
-        self.__create_net_interface(nwam_setting=False,
-                                        default_setting=True)
+        self.__create_net_interface(auto_netcfg=False)
 
     def __config_net_physical_ipv6(self, interface, dhcp=False):
         """Configures the IPv6 interface for the interface specified by the
@@ -835,8 +841,7 @@
                                  "./service[@name='network/physical']")
             if svc_network_physical is None:
                 # Create NWAM network
-                self.__create_net_interface(nwam_setting=True,
-                                                default_setting=False)
+                self.__create_net_interface(auto_netcfg=True)
             return
 
         # The user specified one or more network
@@ -867,8 +872,7 @@
                                  "lineno": line_num})
             self._report.add_unsupported_item()
             # Create NWAM network
-            self.__create_net_interface(nwam_setting=True,
-                                            default_setting=False)
+            self.__create_net_interface(auto_netcfg=True)
             return
         else:
             dhcp = payload.pop("dhcp", None)
@@ -902,12 +906,10 @@
         if self._default_network is None:
             # Nothing is configured, which means the users choices errored out
             # Since we always want a network configured, we configure for NWAM
-            self.__create_net_interface(nwam_setting=True,
-                                            default_setting=False)
+            self.__create_net_interface(auto_netcfg=True)
         else:
             # Configure for default network
-            self.__create_net_interface(nwam_setting=False,
-                                            default_setting=True)
+            self.__create_net_interface(auto_netcfg=False)
 
     def __convert_nfs4_domain(self, line_num, keyword, values):
         """Converts the nfs4_domain keyword/values from the sysidcfg into
@@ -1162,13 +1164,15 @@
         node.set(common.ATTRIBUTE_ENABLED, enabled_state)
         return node
 
-    def __create_net_interface(self, nwam_setting, default_setting):
-        """Create the nwam and default network node settings
-
-        <service name='network/physical' version='1' type='service'>
-          <instance name='default' enabled='default_settings'/>
-          <instance name='nwam' enabled='nwam_settings'/>
-        </service>
+    def __create_net_interface(self, auto_netcfg):
+        """Create the network/physical:default node, and set
+           its value based on the value of auto_netcfg.
+ 
+           If auto_netcfg is True,
+           the netcfg/active_ncp property of the network/physical:default
+           service will be set to "Automatic".  If auto_netcfg is not
+           True, the netcfg/active_ncp property will be set to 
+           "DefaultFixed".
 
         """
         service = fetch_xpath_node(self._service_bundle,
@@ -1178,9 +1182,19 @@
         else:
             service = self.__create_service_node(self._service_bundle,
                                                 "network/physical")
-        self.__create_instance_node(service, "nwam", str(nwam_setting).lower())
-        self.__create_instance_node(service, "default",
-                                    str(default_setting).lower())
+        network_node = self.__create_instance_node(service,
+                                                   "default",
+                                                   enabled_state="true")
+        network_prop_grp = self.__create_propgrp_node(network_node,
+                                                      "netcfg", "application")
+
+        if auto_netcfg:
+            propval_node_value = "Automatic"
+        else:
+            propval_node_value = "DefaultFixed"
+
+        self.__create_propval_node(network_prop_grp, "active_ncp", "astring",
+                                   propval_node_value)
 
     def __create_prop_node(self, parent, name, prop_type):
         """Create a <property> node with a parent of 'parent'
--- a/usr/src/cmd/slim-install/svc/network_nwam.xml	Wed Jul 06 10:15:33 2011 -0600
+++ b/usr/src/cmd/slim-install/svc/network_nwam.xml	Wed Jul 06 15:29:06 2011 -0700
@@ -7,7 +7,7 @@
     Common Development and Distribution License (the "License").
     You may not use this file except in compliance with the License.
    
-    You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
+    You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     or http://www.opensolaris.org/os/licensing.
     See the License for the specific language governing permissions
     and limitations under the License.
@@ -20,16 +20,20 @@
    
     CDDL HEADER END
 
-    Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
-    Use is subject to license terms.
+    Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
 
-    Service profile to enable NWAM
+    Service profile to set network/physical:default SMF instance's
+    netcfg/active_ncp property to the value of Automatic.
 
 -->
+
 <service_bundle type='profile' name='network_nwam'
 	 xmlns:xi='http://www.w3.org/2003/XInclude' >
   <service name='network/physical' version='1' type='service'>
-    <instance name='default' enabled='false'/>
-    <instance name='nwam' enabled='true'/>
+    <instance name='default' enabled='true'>
+          <property_group name='netcfg' type='application'>
+              <propval name='active_ncp' type='astring' value='Automatic'/>
+          </property_group>
+    </instance>
   </service>
 </service_bundle>
--- a/usr/src/cmd/system-config/profile/network_info.py	Wed Jul 06 10:15:33 2011 -0600
+++ b/usr/src/cmd/system-config/profile/network_info.py	Wed Jul 06 15:29:06 2011 -0700
@@ -285,14 +285,17 @@
         net_physical = SMFConfig("network/physical")
         data_objects.append(net_physical)
 
-        nwam = SMFInstance("nwam", enabled=False)
         net_default = SMFInstance("default", enabled=True)
-        net_physical.insert_children([nwam, net_default])
+        net_physical.insert_children(net_default)
+
+        netcfg_prop = SMFPropertyGroup("netcfg")
+        net_default.insert_children(netcfg_prop)
 
         if self.type == NetworkInfo.AUTOMATIC:
-            nwam.enabled = True
-            net_default.enabled = False
+            netcfg_prop.setprop(name="active_ncp", ptype="astring", value="Automatic")
         elif self.type == NetworkInfo.MANUAL:
+            netcfg_prop.setprop(name="active_ncp", ptype="astring", value="DefaultFixed")
+
             net_install = SMFConfig('network/install')
             data_objects.append(net_install)