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

bug #4724: move VM Driver constants to oca

This commit is contained in:
Javi Fontan 2016-09-05 12:45:24 +02:00
parent ee626f6fcb
commit c2b7864a4f
3 changed files with 26 additions and 20 deletions

View File

@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
require 'opennebula'
require "OpenNebulaDriver"
require "CommandManager"
require 'base64'
@ -52,23 +53,8 @@ class VirtualMachineDriver < OpenNebulaDriver
:update_sg => "UPDATESG"
}
POLL_ATTRIBUTE = {
:memory => "MEMORY",
:cpu => "CPU",
:nettx => "NETTX",
:netrx => "NETRX",
:state => "STATE",
:disk_size => "DISK_SIZE",
:snapshot_size => "SNAPSHOT_SIZE"
}
VM_STATE = {
:active => 'a',
:paused => 'p',
:error => 'e',
:deleted => 'd',
:unknown => '-'
}
POLL_ATTRIBUTE = OpenNebula::VirtualMachine::Driver::POLL_ATTRIBUTE
VM_STATE = OpenNebula::VirtualMachine::Driver::VM_STATE
HOST_ARG = 1

View File

@ -218,6 +218,27 @@ module OpenNebula
'SL_PRIMARYIPADDRESS'
]
# VirtualMachineDriver constants
module Driver
POLL_ATTRIBUTE = {
:memory => "MEMORY",
:cpu => "CPU",
:nettx => "NETTX",
:netrx => "NETRX",
:state => "STATE",
:disk_size => "DISK_SIZE",
:snapshot_size => "SNAPSHOT_SIZE"
}
VM_STATE = {
:active => 'a',
:paused => 'p',
:error => 'e',
:deleted => 'd',
:unknown => '-'
}
end
# Creates a VirtualMachine description with just its identifier
# this method should be used to create plain VirtualMachine objects.
# +id+ the id of the vm

View File

@ -42,7 +42,6 @@ require 'yaml'
require 'opennebula'
require 'base64'
require 'openssl'
require 'VirtualMachineDriver'
################################################################################
# Monkey patch rbvmomi library with some extra functions
@ -1361,8 +1360,8 @@ end
class VCenterVm
attr_reader :vm
POLL_ATTRIBUTE = VirtualMachineDriver::POLL_ATTRIBUTE
VM_STATE = VirtualMachineDriver::VM_STATE
POLL_ATTRIBUTE = OpenNebula::VirtualMachine::Driver::POLL_ATTRIBUTE
VM_STATE = OpenNebula::VirtualMachine::Driver::VM_STATE
############################################################################
# Creates a new VIVm using a RbVmomi::VirtualMachine object