* Anurag S. Maskey <Anurag.Maskey at Sun.COM> [2009-05-04 22:33]: > NWAM Phase 1 introduces a couple of new SMF services and modifies a few > others. These new SMF services have dependencies between each other and > existing services. When system/manifest-import runs, it doesn't care > about the dependencies. Thus, we have a problem because we want one > service online before the second one starts.. > > Couple of things we have tried (let me illustrate with SMF services A > and B where B depends on A (in other words, A must start before B)). > manifest-import doesn't care if B was imported and started before A. > > 1. In B's start method, explicitly enable A. If A is already enabled, > it does nothing. Otherwise, A is started. This doesn't work (all the > time) because if manifest-import hasn't imported A yet, then the enable > finds nothing. > > Two solutions we're looking at: > > 1. In B's start method, check if A been enabled (it will be if it has > been imported). If not, sleep for a while and check again. If A still > hasn't been enabled, exit with an error. We don't want to have a loop > here for fear that A may have failed and don't want B to keep checking > forever. > > 2. In B's start method, check if A has been enabled. If not, svccfg > import A. The issue here it that it may create a race condition where B > imports A and manifest-import is also importing A. I don't see any > other scripts (in /lib/svc/method) doing such imports, so what would > happen here? Are there any controls to make the import operation > exclusive? > > Is there a different solution to the problem of manifest-import > respecting service dependencies? > Other comments?
The problem statement mentions dependencies between A and B, but the discussion only talks about start method implementations. What are the expected dependencies between A and B, and what characteristics do the dependencies have? For instance, if B requires A, then B will remain offline until A is online. No enabling, sleeping, etc. should be required in the start method. (Are you seeing other behaviour with a require dependency?) - Stephen -- sch at sun.com http://blogs.sun.com/sch/