On Thu, Jul 12, 2012 at 12:35 PM, Tony Huang <tonycongjie@gmail.com>
wrote:> I am looking for a way to detect whether a vm has been startup and
> ready to go. For example, ready to been ssh into, not just in the
> start up process. Anyone know?
Short version: no, there''s no facility that provides that.
Long version: you need to write your own script to check. Possibly
something that does these things:
- xm create
- try to connect to the guests port and exit immediately (e.g.
something like "echo | nc -w 1 IP_OF_domU 22")
- if the above commands returns non-zero error code (i.e. it couldn''t
connect due to timeout or connection refused), retry again for a
specified number of seconds (e.g. using a WHILE for FOR loop)
- return the appropriate error code (e.g. "0" if you can connect
successfully within the specified period, "1" otherwise)
--
Fajar