The real question is should r.manifest deletes the service if an instance remains ?
IMO, the answer is YES if the instance was added manually (because the methods may be removed along with the package) and NO if the instance comes from a different manifest. Now the difficulty is how do we make the difference between them? If the instance was added manually then it shouldn't have a last-import snapshot. I've filed CR 6821896 "r.manifest should not always delete a service if instances remain". -- Renaud Seema wrote: > Hi, > > Few of our web stack components, in their manifest file, define the service > name > as "network/httpd" and component name as the instance name. > e.g., > Squid's manifest file looks like this. > <service > name='network/http' > .... > <instance name='sun-squid' enabled='false'> > .... > </service> > > > Lighttpd's looks like this: > <service > name='network/http' > .... > <instance name='sun-lighttpd14' enabled='false'> > .... > </service> > > > Apache has: > <service > name='network/http' > .... > <instance name='sun-apache22' enabled='false'> > .... > </service> > > > All these components have a common service name. The issue with the common > service name is that r.manifest deletes the instance and the service during > pkgrm of any one of the above listed packages. And because of that, after the > pkgrm, one cannot start/stop other services which have the same service name. > > -------- Snippet of r.manifest ------ > while read mfst; do > if [ "$smf_alive" = "yes" ]; then > ENTITIES=`$SVCCFG inventory $mfst` > > for fmri in $ENTITIES; do > > # Determine whether fmri refers to an instance or a > service. > $SVCPROP -p restarter/state $fmri >/dev/null 2>&1 > if [ $? -eq 1 ]; then > # this is a service fmri, all instances have > been deleted > $SVCCFG delete $fmri 2>/dev/null > # process next instance > continue > fi > > # > # Try to disable the instance within a reasonable > amount of time > # (eg. 60 secs). If it fails, forcibly delete the > instance. > # > echo "Waiting up to $STOP_DELAY seconds for $fmri to > stop..." > $SVCADM disable $fmri 2>/dev/null > if [ $? -eq 0 ]; then > wait_disable $fmri $STOP_DELAY > if [ $? -eq 0 ]; then > # the instance is disabled and can be > safely deleted > $SVCCFG delete $fmri 2>/dev/null > # process next instance > continue > fi > echo "Failed to disable $fmri after > $STOP_DELAY seconds" > else > echo "Failed to disable $fmri" > fi > > echo "Force deleting $fmri" > > ctid=`$SVCPROP -p restarter/contract $fmri > 2>/dev/null` > tctid=`$SVCPROP -p restarter/transient_contract $fmri > 2>/dev/null` > > $SVCCFG delete -f $fmri > > .... > .... > ---------- > > How do I fix this issue ? > Should I change the service name within the manifest file to a unique value ( > with the instance name as "default" ) or modify the r.manifest class action > script to delete only the instances and not the service ? > > > Thanks, > Seema.