bug #4724: move VM Driver constants to oca

This commit is contained in:
Javi Fontan committed 2016-09-05 12:45:56 +02:00
1 parent ee626f6fcb
commit c2b7864a4f
3 files changed
+26 -20

No files matched your search

+3 -17
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
@@ -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
@@ -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