aboutsummaryrefslogtreecommitdiffstats
path: root/src/dumm/ext/lib
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-04-07 17:13:44 +0000
committerMartin Willi <martin@strongswan.org>2009-04-07 17:13:44 +0000
commitcf61575dc321af853930a926768ec656a7ac546a (patch)
tree3fd4b0ae21787421bbd5246f302136510e1e845e /src/dumm/ext/lib
parent801548155cda1e4ccff51dd38607c360092a254e (diff)
downloadstrongswan-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.rb10
-rw-r--r--src/dumm/ext/lib/dumm/guest.rb17
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