added booted?/boot methods

This commit is contained in:
Martin Willi
2009-04-07 17:13:44 +00:00
parent 801548155c
commit cf61575dc3
3 changed files with 31 additions and 3 deletions
+9 -1
View File
@@ -28,7 +28,15 @@ module Dumm
Bridge.each { |bridge| Bridge.each { |bridge|
bridge.delete 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
end end
+17
View File
@@ -41,6 +41,23 @@ module Dumm
i.delete i.delete
} }
end 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
end end
+5 -2
View File
@@ -147,8 +147,11 @@ static int request(private_mconsole_t *this, void(*cb)(void*,char*,size_t),
} }
else if (reply.err) else if (reply.err)
{ {
DBG1("received mconsole error %d: %*.s", if (reply.len && *reply.data)
reply.err, reply.len, reply.data); {
DBG1("received mconsole error %d: %*.s",
reply.err, reply.len, reply.data);
}
break; break;
} }
} }