mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-10 01:17:40 +03:00
Feature #1556: Add new elem to migrator, and xsd
This commit is contained in:
parent
8a2597cd90
commit
68efaa7e62
@ -87,6 +87,7 @@
|
||||
<!-- NET_RX: Received bytes from the network -->
|
||||
<xs:element name="NET_RX" type="xs:integer"/>
|
||||
<xs:element name="TEMPLATE" type="xs:anyType"/>
|
||||
<xs:element name="USER_TEMPLATE" type="xs:anyType"/>
|
||||
<xs:element name="HISTORY_RECORDS">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
|
@ -175,7 +175,7 @@ public class VirtualMachine extends PoolElement{
|
||||
* @param client XML-RPC Client.
|
||||
* @param id The id of the target vm.
|
||||
* @param new_template New template contents
|
||||
* @return If successful the message contains the vm id.
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public static OneResponse update(Client client, int id, String new_template)
|
||||
{
|
||||
@ -558,6 +558,17 @@ public class VirtualMachine extends PoolElement{
|
||||
return rename(client, id, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces this VM's user template contents.
|
||||
*
|
||||
* @param new_template New template contents
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse update(String new_template)
|
||||
{
|
||||
return client.call(UPDATE, id, new_template);
|
||||
}
|
||||
|
||||
// =================================
|
||||
// Helpers
|
||||
// =================================
|
||||
|
@ -345,6 +345,35 @@ module Migrator
|
||||
@db.run "DROP TABLE old_cluster_pool;"
|
||||
|
||||
|
||||
########################################################################
|
||||
# Feature #1556: New elem USER_TEMPLATE
|
||||
########################################################################
|
||||
|
||||
@db.run "ALTER TABLE vm_pool RENAME TO old_vm_pool;"
|
||||
@db.run "CREATE TABLE vm_pool (oid INTEGER PRIMARY KEY, name VARCHAR(128), body TEXT, uid INTEGER, gid INTEGER, last_poll INTEGER, state INTEGER, lcm_state INTEGER, owner_u INTEGER, group_u INTEGER, other_u INTEGER);"
|
||||
|
||||
@db.fetch("SELECT * FROM old_vm_pool") do |row|
|
||||
|
||||
doc = Document.new(row[:body])
|
||||
doc.root.add_element("USER_TEMPLATE")
|
||||
|
||||
@db[:vm_pool].insert(
|
||||
:oid => row[:oid],
|
||||
:name => row[:name],
|
||||
:body => doc.root.to_s,
|
||||
:uid => row[:uid],
|
||||
:gid => row[:gid],
|
||||
:last_poll => row[:last_poll],
|
||||
:state => row[:state],
|
||||
:lcm_state => row[:lcm_state],
|
||||
:owner_u => row[:owner_u],
|
||||
:group_u => row[:group_u],
|
||||
:other_u => row[:other_u])
|
||||
end
|
||||
|
||||
@db.run "DROP TABLE old_vm_pool;"
|
||||
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Banner for the new /var/lib/one/vms directory
|
||||
|
Loading…
Reference in New Issue
Block a user