From 23e12b997a58d9ceebca9f218d41105425bdcc11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 2 Sep 2011 12:02:07 +0200 Subject: [PATCH 1/2] Bug #772: onedb upgrade now counts the number of used leases --- src/onedb/2.0_to_2.9.80.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/onedb/2.0_to_2.9.80.rb b/src/onedb/2.0_to_2.9.80.rb index 01054ecb4d..20d47aeb62 100644 --- a/src/onedb/2.0_to_2.9.80.rb +++ b/src/onedb/2.0_to_2.9.80.rb @@ -256,10 +256,16 @@ module Migrator group = (uid == 0) ? "oneadmin" : "users" public = row[:public] + total_leases = 0 + @db.fetch("SELECT COUNT (ip) FROM old_leases WHERE (oid=#{oid} AND used=1)") do |r| + total_leases = r[:"COUNT (ip)"] + end + + # is stored in the DB, but it is not used to rebuild # the VirtualNetwork object, and it is generated each time the # network is listed. So setting it to 0 is safe - body = "#{oid}#{uid}#{gid}#{get_username(uid)}#{group}#{name}#{row[:type]}#{row[:bridge]}#{public}0#{row[:template]}" + body = "#{oid}#{uid}#{gid}#{get_username(uid)}#{group}#{name}#{row[:type]}#{row[:bridge]}#{public}#{total_leases}#{row[:template]}" @db[:network_pool].insert( :oid => oid, From 0caef9575a628edd74fe44d3a02670744409ad53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 2 Sep 2011 12:11:30 +0200 Subject: [PATCH 2/2] Revert "Bug #766: Scheduler only filters Hosts in MONITORED state" This reverts commit f162b2c4a97a14f3057f120948bd6cacaf74e7a9. --- src/scheduler/include/HostPoolXML.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scheduler/include/HostPoolXML.h b/src/scheduler/include/HostPoolXML.h index 843790602e..8160262df6 100644 --- a/src/scheduler/include/HostPoolXML.h +++ b/src/scheduler/include/HostPoolXML.h @@ -46,7 +46,7 @@ protected: int get_suitable_nodes(vector& content) { - return get_nodes("/HOST_POOL/HOST[STATE=2]", content); + return get_nodes("/HOST_POOL/HOST[STATE<3]", content); }; void add_object(xmlNodePtr node);