1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-25 02:50:08 +03:00

Added OCA API Documentation

This commit is contained in:
Daniel Molina 2010-07-27 16:29:27 +02:00 committed by Javi Fontan
parent 9574332983
commit 4b298efd7d
12 changed files with 97 additions and 5 deletions

View File

@ -42,18 +42,27 @@ module OpenNebula
# ---------------------------------------------------------------------
# XML-RPC Methods for the User Object
# ---------------------------------------------------------------------
# Retrieves the information of the given Cluster.
def info()
super(CLUSTER_METHODS[:info], 'CLUSTER')
end
# Allocates a new Cluster in OpenNebula
#
# +clustername+ A string containing the name of the Cluster.
def allocate(clustername)
super(CLUSTER_METHODS[:allocate], clustername)
end
# Deletes the Cluster
def delete()
super(CLUSTER_METHODS[:delete])
end
# Add a host to the cluster
#
# +host_id+ ID of the Host to be added to the Cluster
def add_host(host_id)
return Error.new('ID not defined') if !@pe_id
@ -63,6 +72,9 @@ module OpenNebula
return rc
end
# Remove a host from the cluster
#
# +host_id+ ID of the Host to be removed from the Cluster
def remove_host(host_id)
return Error.new('ID not defined') if !@pe_id

View File

@ -27,7 +27,8 @@ module OpenNebula
# ---------------------------------------------------------------------
# XML-RPC Methods for the User Object
# ---------------------------------------------------------------------
# Retrieves all the Clusters in the pool.
def info()
super(CLUSTER_POOL_METHODS[:info])
end

View File

@ -52,22 +52,36 @@ module OpenNebula
#######################################################################
# XML-RPC Methods for the Host
#######################################################################
# Retrieves the information of the given Host.
def info()
super(HOST_METHODS[:info], 'HOST')
end
# Allocates a new Host in OpenNebula
#
# +hostname+ A string containing the name of the new Host.
#
# +im+ A string containing the name of the im_driver
#
# +vmm+ A string containing the name of the vmm_driver
#
# +tm+ A string containing the name of the tm_driver
def allocate(hostname,im,vmm,tm)
super(HOST_METHODS[:allocate],hostname,im,vmm,tm)
end
# Deletes the Host
def delete()
super(HOST_METHODS[:delete])
end
# Enables the Host
def enable()
set_enabled(true)
end
# Disables the Host
def disable()
set_enabled(false)
end

View File

@ -28,6 +28,7 @@ module OpenNebula
# XML-RPC Methods for the Host Pool
#######################################################################
# Retrieves all the Hosts in the pool.
def info()
super(HOST_POOL_METHODS[:info])
end

View File

@ -62,38 +62,55 @@ module OpenNebula
# XML-RPC Methods for the Image Object
#######################################################################
# Retrieves the information of the given Image.
def info()
super(IMAGE_METHODS[:info], 'IMAGE')
end
# Allocates a new Image in OpenNebula
#
# +description+ A string containing the template of the Image.
def allocate(description)
super(IMAGE_METHODS[:allocate],description)
end
# Modifies an image attribute
#
# +name+ Name of the attribute to be changed
#
# +value+ New value for the attribute
def update(name, value)
super(IMAGE_METHODS[:update], name, value)
end
# Deletes an Image attribute
#
# +name+ Name of the attribute to be deleted
def remove_attr(name)
do_rm_attr(name)
end
# Enables an Image
def enable
set_enabled(true)
end
# Disables an Image
def disable
set_enabled(false)
end
# Publishes the Image, to be used by other users
def publish
set_publish(true)
end
# Unplubishes the Image
def unpublish
set_publish(false)
end
# Deletes the Image
def delete()
super(IMAGE_METHODS[:delete])
end

View File

@ -31,6 +31,7 @@ module OpenNebula
# XML-RPC Methods for the Image Object
#######################################################################
# Retrieves all or part of the Images in the pool.
def info()
super(IMAGE_POOL_METHODS[:info],@user_id)
end

View File

@ -41,18 +41,29 @@ module OpenNebula
# ---------------------------------------------------------------------
# XML-RPC Methods for the User Object
# ---------------------------------------------------------------------
# Retrieves the information of the given User.
def info()
super(USER_METHODS[:info], 'USER')
end
# Allocates a new User in OpenNebula
#
# +username+ Name of the new user.
#
# +password+ Password for the new user
def allocate(username, password)
super(USER_METHODS[:allocate], username, password)
end
# Deletes the User
def delete()
super(USER_METHODS[:delete])
end
# Changes the password of the given User
#
# +password+ String containing the new password
def passwd(password)
return Error.new('ID not defined') if !@pe_id

View File

@ -28,6 +28,7 @@ module OpenNebula
# XML-RPC Methods for the User Object
# ---------------------------------------------------------------------
# Retrieves all the Users in the pool.
def info()
super(USER_POOL_METHODS[:info])
end

View File

@ -98,14 +98,22 @@ module OpenNebula
# XML-RPC Methods for the Virtual Machine Object
#######################################################################
# Retrieves the information of the given VirtualMachine.
def info()
super(VM_METHODS[:info], 'VM')
end
# Allocates a new VirtualMachine in OpenNebula
#
# +description+ A string containing the template of the VirtualMachine.
def allocate(description)
super(VM_METHODS[:allocate],description)
end
# Initiates the instance of the VM on the target host.
#
# +host_id+ The host id (hid) of the target host where
# the VM will be instantiated.
def deploy(host_id)
return Error.new('ID not defined') if !@pe_id
@ -115,42 +123,52 @@ module OpenNebula
return rc
end
# Shutdowns an already deployed VM
def shutdown
action('shutdown')
end
# Cancels a running VM
def cancel
action('cancel')
end
# Sets a VM to hold state, scheduler will not deploy it
def hold
action('hold')
end
# Releases a VM from hold state
def release
action('release')
end
# Stops a running VM
def stop
action('stop')
end
# Saves a running VM
def suspend
action('suspend')
end
# Resumes the execution of a saved VM
def resume
action('resume')
end
# Deletes a VM from the pool and DB
def finalize
action('finalize')
end
# Resubmits the VM after failure
def restart
action('restart')
end
# Saves a running VM and starts it again in the specified host
def migrate(host_id)
return Error.new('ID not defined') if !@pe_id
@ -160,6 +178,7 @@ module OpenNebula
return rc
end
# Migrates a running VM to another host without downtime
def live_migrate(host_id)
return Error.new('ID not defined') if !@pe_id
@ -169,6 +188,12 @@ module OpenNebula
return rc
end
# Set the specified vm's disk to be saved in a new image
# when the VirtualMachine shutdowns
#
# +disk_id+ ID of the disk to be saved
#
# +image_id+ ID of the new image where the disk will be saved
def save_as(disk_id, image_id)
return Error.new('ID not defined') if !@pe_id

View File

@ -30,7 +30,8 @@ module OpenNebula
#######################################################################
# XML-RPC Methods for the Virtual Network Object
#######################################################################
# Retrieves all or part of the VirtualMachines in the pool.
def info()
super(VM_POOL_METHODS[:info],@user_id)
end

View File

@ -40,22 +40,29 @@ module OpenNebula
# XML-RPC Methods for the Virtual Network Object
#######################################################################
# Retrieves the information of the given VirtualNetwork.
def info()
super(VN_METHODS[:info], 'VNET')
end
# Allocates a new VirtualNetwork in OpenNebula
#
# +description+ A string containing the template of the VirtualNetwork.
def allocate(description)
super(VN_METHODS[:allocate],description)
end
# Publishes the VirtualNetwork, to be used by other users
def publish
set_publish(true)
end
# Unplubishes the VirtualNetwork
def unpublish
set_publish(false)
end
# Deletes the VirtualNetwork
def delete()
super(VN_METHODS[:delete])
end

View File

@ -31,6 +31,7 @@ module OpenNebula
# XML-RPC Methods for the Virtual Network Object
#######################################################################
# Retrieves all or part of the VirtualNetwork in the pool.
def info()
super(VN_POOL_METHODS[:info],@user_id)
end