mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-19 03:12:55 +09:00
Feature #1686: Add rename methods to ruby OCA and CLI
This commit is contained in:
1 parent
9061812849
commit
e1b033f8cc
9 files changed
+88
-4
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
#######################################################################
|
||||
|
||||
@@ -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
|
||||
#######################################################################
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
#######################################################################
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user