diff options
author | Martin Willi <martin@strongswan.org> | 2009-04-07 17:13:44 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2009-04-07 17:13:44 +0000 |
commit | cf61575dc321af853930a926768ec656a7ac546a (patch) | |
tree | 3fd4b0ae21787421bbd5246f302136510e1e845e /src/dumm/ext/lib | |
parent | 801548155cda1e4ccff51dd38607c360092a254e (diff) | |
download | strongswan-cf61575dc321af853930a926768ec656a7ac546a.tar.bz2 strongswan-cf61575dc321af853930a926768ec656a7ac546a.tar.xz |
added booted?/boot methods
Diffstat (limited to 'src/dumm/ext/lib')
-rw-r--r-- | src/dumm/ext/lib/dumm.rb | 10 | ||||
-rw-r--r-- | src/dumm/ext/lib/dumm/guest.rb | 17 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/dumm/ext/lib/dumm.rb b/src/dumm/ext/lib/dumm.rb index d1450f5df..ba1ccceb2 100644 --- a/src/dumm/ext/lib/dumm.rb +++ b/src/dumm/ext/lib/dumm.rb @@ -28,7 +28,15 @@ module Dumm Bridge.each { |bridge| bridge.delete } - return nil + return Dumm + end + + # wait until all running guests have booted up + def boot + Guest.each {|g| + g.boot if g.running? + } + return Dumm end end diff --git a/src/dumm/ext/lib/dumm/guest.rb b/src/dumm/ext/lib/dumm/guest.rb index a65a0a7e9..8f5abb5a3 100644 --- a/src/dumm/ext/lib/dumm/guest.rb +++ b/src/dumm/ext/lib/dumm/guest.rb @@ -41,6 +41,23 @@ module Dumm i.delete } end + + # has the guest booted up? + def booted? + begin + exec("pgrep getty") + rescue + return false + end + return true + end + + # wait until the guest has booted + def boot + while not booted? + sleep(1) + end + end end end |