this is because in db not actual data<br><br>apply this patch and restart db-omatic<br><br>diff --git a/src/db-omatic/db_omatic.rb b/src/db-omatic/db_omatic.rb<br>index 4afffb1..c499610 100755<br>--- a/src/db-omatic/db_omatic.rb<br>
+++ b/src/db-omatic/db_omatic.rb<br>@@ -74,6 +74,64 @@ class DbOmatic < Qpid::Qmf::Console<br> domain[:synced] = true<br> end<br> <br>+ #find hostname from values['node'] where values['class_type'] == 'domain'<br>
+ def get_host_id(abank,bbank)<br>+ begin<br>+ @cached_objects.keys.each do |objkey|<br>+ if @cached_objects[objkey][:agent_bank].to_s == abank and @cached_objects[objkey][:broker_bank].to_s == bbank and @cached_objects[objkey][:class_type].to_s == 'node'<br>
+ return Host.find(:first, :conditions => ['hostname = ?',@cached_objects[objkey]["hostname"].to_s]).id<br>+ break<br>+ end<br>+ end<br>+ rescue => ex<br>
+ log("error in get_host_id")<br>+ log(ex)<br>+ end<br>+ end<br>+<br>+ def set_host(values,digit)<br>+ begin<br>+ vm = Vm.find(:first, :conditions => ['description = ?',values["name"].to_s])<br>
+ if vm and digit<br>+ vm.host_id = digit<br>+ vm.save!<br>+ else<br>+ log("this vm not exist #{values["name"]}")<br>+ end<br>+ rescue => ex<br>+ puts "error when set_host for #{values["name"]}"<br>
+ puts ex<br>+ end<br>+ end<br>+<br>+ def start_crashed_vm(vm)<br>+ task = VmTask.new( :user => 'db-omatic', :task_target => vm, :action => 'start_vm', :state => 'queued')<br>
+ task.save!<br>+ log("set task for start crashed vm #{<a href="http://vm.id">vm.id</a>}")<br>+ end<br>+<br>+ def set_domain_stopped(domain)<br>+ begin<br>+ vm = Vm.find(:first, :conditions => ['uuid = ?', domain['uuid']])<br>
+ if vm != nil<br>+ curstate = vm.state<br>+ vm.state = Vm::STATE_STOPPED<br>+ vm.host_id = nil<br>+ vm.save<br>+ domain['state'] = 'crashed' # and now i will use ipmi for reboot anavailable host - simple fencing<br>
+ # if curstate == Vm::STATE_RUNNING and vm.ha # vm.ha true or false<br>+ # start_crashed_vm(vm)<br>+ # end<br>+ else<br>+ log('vm == nil ')<br>+ end<br>+ log("domain #{domain['id']} already stopped")<br>
+ rescue => ex<br>+ log("can\'t set domain #{domain['id']} stopped")<br>+ log(ex)<br>+ end<br>+ end<br>+<br> def update_host_state(host_info, state)<br> db_host = Host.find(:first, :conditions => [ "hostname = ?", host_info['hostname'] ])<br>
if db_host<br>@@ -131,6 +189,7 @@ class DbOmatic < Qpid::Qmf::Console<br> <br> domain_state_change = false<br> <br>+ change_node = false<br> obj.properties.each do |key, newval|<br>
if values[key.to_s] != newval<br> values[key.to_s] = newval<br>@@ -138,12 +197,30 @@ class DbOmatic < Qpid::Qmf::Console<br> if type == "domain" and key.to_s == "state"<br>
domain_state_change = true<br> end<br>+ if type == "domain" and key.to_s == "node"<br>+ change_node = true<br>+ end<br>
+<br>+<br> end<br> end<br> <br> if domain_state_change<br> update_domain_state(values)<br> end<br>+ if change_node <br>+ values.each do |key,val|<br>
+ if key == 'state' and val == 'running'<br>+ abank = values['node'].to_s.split('-')[3]<br>+ bbank = values['node'].to_s.split('-')[4]<br>
+ @@host_id = get_host_id(abank,bbank)<br>+ set_host(values,@@host_id)<br>+ log("update node data for #{values['name']}")<br>+ break<br>+ end<br>
+ end<br>+ end<br>+<br> <br> if new_object<br> if type == "node"<br>@@ -187,11 +264,6 @@ class DbOmatic < Qpid::Qmf::Console<br> end<br> end<br> <br>-<br>- def del_agent(agent)<br>
- agent_disconnected(agent)<br>- end<br>-<br> # This method marks objects associated with the given agent as timed out/invalid. Called either<br> # when the agent heartbeats out, or we get a del_agent callback.<br>
def agent_disconnected(agent)<br>@@ -205,8 +277,10 @@ class DbOmatic < Qpid::Qmf::Console<br> if values[:class_type] == 'node'<br> update_host_state(values, Host::STATE_UNAVAILABLE)<br>
elsif values[:class_type] == 'domain'<br>- update_domain_state(values, Vm::STATE_UNREACHABLE)<br>- end<br>+ set_domain_stopped(values)<br>
+ values[:timed_out] = true<br>+ @cached_objects.delete(objkey)<br>+ end<br> end<br> values[:timed_out] = true<br> end<br>@@ -248,6 +322,7 @@ class DbOmatic < Qpid::Qmf::Console<br>
db_vm = Vm.find(:all)<br> db_vm.each do |vm|<br> log "Marking vm #{vm.description} as stopped."<br>+ vm.host_id = nil<br> vm.state = Vm::STATE_STOPPED<br> vm.save<br>
end<br><br><div class="gmail_quote">2009/1/30 Hugh O. Brock <span dir="ltr"><<a href="mailto:hbrock@redhat.com">hbrock@redhat.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Fri, Jan 30, 2009 at 01:24:36PM -0600, Carb, Brian A wrote:<br>
> date --utc on all nodes and the appliance shows that they are within a few seconds of each other.<br>
><br>
> brian carb<br>
> unisys corporation - malvern, pa<br>
> <a href="mailto:brian.carb@unisys.com">brian.carb@unisys.com</a><br>
><br>
> -----Original Message-----<br>
> From: Perry Myers [mailto:<a href="mailto:pmyers@redhat.com">pmyers@redhat.com</a>]<br>
> Sent: Friday, January 30, 2009 2:19 PM<br>
> To: Carb, Brian A<br>
> Cc: <a href="mailto:ovirt-devel@redhat.com">ovirt-devel@redhat.com</a>; Ian Main<br>
> Subject: Re: [Ovirt-devel] oVirt Nodes become unavailable<br>
><br>
> Carb, Brian A wrote:<br>
> > running oVirt 0.96 on fedora10...<br>
> ><br>
> > I noticed that after some time has elapsed (machines sitting idle overnight), the oVirt dashboard shows 2 of my 4 nodes as "unavailable(enabled)". I can access them via their consoles though, so the machines are up. Restarting the browser session does not change this. If I shutdown and then restart the oVirt server appliance, all 4 show as unavailable. Do I have to do something to make the nodes available (short of restarting them)?<br>
> ><br>
> > Any ideas? Thanks.<br>
><br>
> Really quick thing.... check timestamps on each Node and the appliance (date --utc)<br>
><br>
> If they're not within a few seconds of each other then kerberos gets unhappy... If that is the case then our NTP setup is not working which needs to be fixed.<br>
><br>
> If they are in sync then Ian should be able to help<br>
><br>
> Perry<br>
<br>
</div>Hmm... sounds like it could be a qpid or host-browser problem. Ian?<br>
<font color="#888888"><br>
--Hugh<br>
</font><div><div></div><div class="Wj3C7c"><br>
_______________________________________________<br>
Ovirt-devel mailing list<br>
<a href="mailto:Ovirt-devel@redhat.com">Ovirt-devel@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/ovirt-devel" target="_blank">https://www.redhat.com/mailman/listinfo/ovirt-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>С уважением, Дмитрий.<br>