diff options
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 |