The script worked very well... It took 10 seconds to clone a zone. But after I installed MySQL and the monitoring agent, I failed monitoring the instances in the Enterprise Monitor. After "only" 5 hours of testing and re-installing I discovered that the Enterprise Monitor identifies the host via its ssh hostid, that was generated during install. Unfortunately all my clones had the same ssh hostid, so Enterprise Manager was a little confused.
What did I learn from these five hours?
- I will never again hack scripts that are written by people much smarter than me (Solaris engineering in this case).
- I can install zones regularly with zoneadm -z zonename install and everything is fine.
- I can clone a zone (with the standard script!) zoneadm -z zonename clone template but then MySQL Agent will fail and needs a TRUNCATE mysql.inventory on the local database. (Look at the agent's log file.) After that, the cloned zone will be monitored correctly.