mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-17 10:23:58 +09:00
feature #206: DB xml dump of VMs with history items now works for both Sqlite and MySQL.
This commit is contained in:
1 parent
9d9686542c
commit
85be6f3f84
1 file changed
+5
-3
@@ -361,13 +361,15 @@ int VirtualMachinePool::dump(ostringstream& oss, const string& where)
|
||||
cmd << "SELECT " << VirtualMachine::table << ".*, "
|
||||
<< "user_pool.user_name, " << History::table << ".* FROM "
|
||||
<< VirtualMachine::table
|
||||
<< " LEFT OUTER JOIN (SELECT *,MAX(seq) FROM "
|
||||
<< History::table << " GROUP BY vid) AS " << History::table
|
||||
<< " LEFT OUTER JOIN ("
|
||||
<< "SELECT *,seq AS max_seq FROM " << History::table << " h1 WHERE "
|
||||
<< "seq=(SELECT MAX(seq) FROM " << History::table << " h2 WHERE h1.vid=h2.vid)) "
|
||||
<< "AS " << History::table
|
||||
<< " ON " << VirtualMachine::table << ".oid = "
|
||||
<< History::table << ".vid LEFT OUTER JOIN (SELECT oid,user_name FROM "
|
||||
<< "user_pool) AS user_pool ON "
|
||||
<< VirtualMachine::table << ".uid = user_pool.oid WHERE "
|
||||
<< VirtualMachine::table << ".state != " << VirtualMachine::DONE;
|
||||
<< VirtualMachine::table << ".state <> " << VirtualMachine::DONE;
|
||||
|
||||
if ( !where.empty() )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user