1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

Merge branch 'master' of git.opennebula.org:one

This commit is contained in:
Ruben S. Montero 2011-09-02 13:20:19 +02:00
commit ef22ca4782
2 changed files with 8 additions and 2 deletions

View File

@ -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
# <TOTAL_LEASES> 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 = "<VNET><ID>#{oid}</ID><UID>#{uid}</UID><GID>#{gid}</GID><UNAME>#{get_username(uid)}</UNAME><GNAME>#{group}</GNAME><NAME>#{name}</NAME><TYPE>#{row[:type]}</TYPE><BRIDGE>#{row[:bridge]}</BRIDGE><PUBLIC>#{public}</PUBLIC><TOTAL_LEASES>0</TOTAL_LEASES>#{row[:template]}</VNET>"
body = "<VNET><ID>#{oid}</ID><UID>#{uid}</UID><GID>#{gid}</GID><UNAME>#{get_username(uid)}</UNAME><GNAME>#{group}</GNAME><NAME>#{name}</NAME><TYPE>#{row[:type]}</TYPE><BRIDGE>#{row[:bridge]}</BRIDGE><PUBLIC>#{public}</PUBLIC><TOTAL_LEASES>#{total_leases}</TOTAL_LEASES>#{row[:template]}</VNET>"
@db[:network_pool].insert(
:oid => oid,

View File

@ -46,7 +46,7 @@ protected:
int get_suitable_nodes(vector<xmlNodePtr>& content)
{
return get_nodes("/HOST_POOL/HOST[STATE=2]", content);
return get_nodes("/HOST_POOL/HOST[STATE<3]", content);
};
void add_object(xmlNodePtr node);