Feature #1686: Add rename methods to ruby OCA and CLI

This commit is contained in:
Carlos Martín committed 2012-12-10 11:46:32 +01:00
1 parent 9061812849
commit e1b033f8cc
9 files changed
+88 -4

No files matched your search

+10
View File
@@ -304,6 +304,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
rename_desc = <<-EOT.unindent
Renames the Image
EOT
command :rename, rename_desc, :imageid, :name do
helper.perform_action(args[0],options,"renamed") do |o|
o.rename(args[1])
end
end
list_desc = <<-EOT.unindent
Lists Images in the pool
EOT
+10
View File
@@ -265,6 +265,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do
Lists Templates in the pool
EOT
rename_desc = <<-EOT.unindent
Renames the Template
EOT
command :rename, rename_desc, :templateid, :name do
helper.perform_action(args[0],options,"renamed") do |o|
o.rename(args[1])
end
end
command :list, list_desc, [:filterflag, nil], :options=>list_options do
helper.list_pool(options, false, args[0])
end
+10
View File
@@ -515,6 +515,16 @@ cmd=CommandParser::CmdParser.new(ARGV) do
Lists VMs in the pool
EOT
rename_desc = <<-EOT.unindent
Renames the VM
EOT
command :rename, rename_desc, :vmid, :name do
helper.perform_action(args[0],options,"renamed") do |o|
o.rename(args[1])
end
end
command :list, list_desc, [:filterflag, nil],
:options=>CLIHelper::OPTIONS+OpenNebulaHelper::OPTIONS+
[OpenNebulaHelper::DESCRIBE] do
+10
View File
@@ -228,4 +228,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
vnet.update(str)
end
end
rename_desc = <<-EOT.unindent
Renames the Virtual Network
EOT
command :rename, rename_desc, :vnetid, :name do
helper.perform_action(args[0],options,"renamed") do |o|
o.rename(args[1])
end
end
end
+11
View File
@@ -44,6 +44,7 @@ module OpenNebula
:chown => "document.chown",
:chmod => "document.chmod",
:clone => "document.clone",
:rename => "document.rename"
}
# Creates a Document Object description with just its identifier
@@ -185,6 +186,16 @@ module OpenNebula
return rc
end
# Renames this Document
#
# @param name [String] New name for the Document.
#
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def rename(name)
return call(DOCUMENT_METHODS[:rename], @pe_id, name)
end
#######################################################################
# Helpers to get Document information
#######################################################################
+12 -1
View File
@@ -35,7 +35,8 @@ module OpenNebula
:chown => "image.chown",
:chmod => "image.chmod",
:chtype => "image.chtype",
:clone => "image.clone"
:clone => "image.clone",
:rename => "image.rename"
}
IMAGE_STATES=%w{INIT READY USED DISABLED LOCKED ERROR CLONE DELETE USED_PERS}
@@ -205,6 +206,16 @@ module OpenNebula
return rc
end
# Renames this Image
#
# @param name [String] New name for the Image.
#
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def rename(name)
return call(IMAGE_METHODS[:rename], @pe_id, name)
end
#######################################################################
# Helpers to get Image information
#######################################################################
+1 -1
View File
@@ -160,7 +160,7 @@ module OpenNebula
# Renames this Template
#
# @param name [String] New name for the new Template.
# @param name [String] New name for the Template.
#
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
+12 -1
View File
@@ -35,7 +35,8 @@ module OpenNebula
:chmod => "vm.chmod",
:monitoring => "vm.monitoring",
:attach => "vm.attach",
:detach => "vm.detach"
:detach => "vm.detach",
:rename => "vm.rename"
}
VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED
@@ -352,6 +353,16 @@ module OpenNebula
return @client.call(VM_METHODS[:monitoring], @pe_id)
end
# Renames this VM
#
# @param name [String] New name for the VM.
#
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def rename(name)
return call(VM_METHODS[:rename], @pe_id, name)
end
#######################################################################
# Helpers to get VirtualMachine information
#######################################################################
+12 -1
View File
@@ -34,7 +34,8 @@ module OpenNebula
:chmod => "vn.chmod",
:update => "vn.update",
:hold => "vn.hold",
:release => "vn.release"
:release => "vn.release",
:rename => "vn.rename"
}
VN_TYPES=%w{RANGED FIXED}
@@ -191,6 +192,16 @@ module OpenNebula
super(VN_METHODS[:chmod], owner_u, owner_m, owner_a, group_u,
group_m, group_a, other_u, other_m, other_a)
end
# Renames this virtual network
#
# @param name [String] New name for the virtual network.
#
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def rename(name)
return call(VN_METHODS[:rename], @pe_id, name)
end
#######################################################################
# Helpers to get VirtualNetwork information