mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-18 06:03:39 +03:00
L #-: Change percentage for brackets
in ruby word array definitions
This commit is contained in:
parent
00ac76a42c
commit
27a97b4ea6
@ -185,7 +185,7 @@ xml_host_template.xpath('HOST/VMS').text.split.each do |vm_id|
|
|||||||
last_action = vm["#{last_history_xpath}/ACTION"]
|
last_action = vm["#{last_history_xpath}/ACTION"]
|
||||||
last_action_str = OpenNebula::VirtualMachine.get_history_action(last_action)
|
last_action_str = OpenNebula::VirtualMachine.get_history_action(last_action)
|
||||||
|
|
||||||
if !%w[none live-migrate].include?(last_action_str) && autostart != 'always'
|
if !['none', 'live-migrate'].include?(last_action_str) && autostart != 'always'
|
||||||
log "vm #{vm_id}: skip: last_action (#{last_action_str}) " \
|
log "vm #{vm_id}: skip: last_action (#{last_action_str}) " \
|
||||||
'is not none or live-migrate'
|
'is not none or live-migrate'
|
||||||
next
|
next
|
||||||
|
@ -34,15 +34,15 @@ class Sudoers
|
|||||||
'ip route *',
|
'ip route *',
|
||||||
'ip neighbour *'
|
'ip neighbour *'
|
||||||
],
|
],
|
||||||
:LVM => %w[
|
:LVM => [
|
||||||
lvcreate lvremove lvs vgdisplay lvchange lvscan lvextend
|
'lvcreate', 'lvremove', 'lvs', 'vgdisplay', 'lvchange', 'lvscan', 'lvextend'
|
||||||
],
|
],
|
||||||
:OVS => %w[ovs-ofctl ovs-vsctl],
|
:OVS => ['ovs-ofctl', 'ovs-vsctl'],
|
||||||
:CEPH => %w[rbd],
|
:CEPH => ['rbd'],
|
||||||
:LXD => %w[
|
:LXD => [
|
||||||
/snap/bin/lxc /usr/bin/catfstab mount umount mkdir lsblk losetup
|
'/snap/bin/lxc', '/usr/bin/catfstab', 'mount', 'umount', 'mkdir', 'lsblk',
|
||||||
kpartx qemu-nbd blkid e2fsck resize2fs xfs_growfs rbd-nbd
|
'losetup', 'kpartx', 'qemu-nbd', 'blkid', 'e2fsck', 'resize2fs', 'xfs_growfs',
|
||||||
xfs_admin tune2fs
|
'rbd-nbd', 'xfs_admin', 'tune2fs'
|
||||||
],
|
],
|
||||||
:HA => [
|
:HA => [
|
||||||
'systemctl start opennebula-flow',
|
'systemctl start opennebula-flow',
|
||||||
@ -62,18 +62,18 @@ class Sudoers
|
|||||||
'arping',
|
'arping',
|
||||||
'ip address *'
|
'ip address *'
|
||||||
],
|
],
|
||||||
:MARKET => %W[#{lib_location}/sh/create_container_image.sh
|
:MARKET => ["#{lib_location}/sh/create_container_image.sh",
|
||||||
#{lib_location}/sh/create_docker_image.sh ],
|
"#{lib_location}/sh/create_docker_image.sh"],
|
||||||
:FIRECRACKER => %w[/usr/bin/jailer
|
:FIRECRACKER => ['/usr/bin/jailer',
|
||||||
/usr/sbin/one-clean-firecracker-domain
|
'/usr/sbin/one-clean-firecracker-domain',
|
||||||
/usr/sbin/one-prepare-firecracker-domain],
|
'/usr/sbin/one-prepare-firecracker-domain'],
|
||||||
:LXC => %w[
|
:LXC => [
|
||||||
mount umount bindfs losetup qemu-nbd lxc-attach lxc-config
|
'mount', 'umount', 'bindfs', 'losetup', 'qemu-nbd', 'lxc-attach', 'lxc-config',
|
||||||
lxc-create lxc-destroy lxc-info lxc-ls lxc-start lxc-stop
|
'lxc-create', 'lxc-destroy', 'lxc-info', 'lxc-ls', 'lxc-start', 'lxc-stop',
|
||||||
lxc-console e2fsck resize2fs xfs_growfs rbd-nbd
|
'lxc-console', 'e2fsck', 'resize2fs', 'xfs_growfs', 'rbd-nbd'
|
||||||
],
|
],
|
||||||
:MEM => ['sysctl vm.drop_caches=3 vm.compact_memory=1'],
|
:MEM => ['sysctl vm.drop_caches=3 vm.compact_memory=1'],
|
||||||
:VGPU => %w[sudo /var/tmp/one/vgpu]
|
:VGPU => ['sudo', '/var/tmp/one/vgpu']
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ require 'csv'
|
|||||||
module CLIHelper
|
module CLIHelper
|
||||||
|
|
||||||
# Available operators for filtering operations
|
# Available operators for filtering operations
|
||||||
FILTER_OPS = %w[= != < <= > >= ~]
|
FILTER_OPS = ['=', '!=', '<', '<=', '>', '>=', '~']
|
||||||
|
|
||||||
# CLI general options
|
# CLI general options
|
||||||
LIST = {
|
LIST = {
|
||||||
@ -182,23 +182,23 @@ module CLIHelper
|
|||||||
ANSI_YELLOW = "\33[33m"
|
ANSI_YELLOW = "\33[33m"
|
||||||
|
|
||||||
# CLI states
|
# CLI states
|
||||||
OK_STATES = %w[runn rdy on SUCCESS RUNNING]
|
OK_STATES = ['runn', 'rdy', 'on', 'SUCCESS', 'RUNNING']
|
||||||
BAD_STATES = %w[fail
|
BAD_STATES = ['fail',
|
||||||
err
|
'err',
|
||||||
error
|
'error',
|
||||||
ERROR
|
'ERROR',
|
||||||
FAILED_DEPLOYING
|
'FAILED_DEPLOYING',
|
||||||
FAILED_DEPLOYING_NETS
|
'FAILED_DEPLOYING_NETS',
|
||||||
FAILED_UNDEPLOYING
|
'FAILED_UNDEPLOYING',
|
||||||
FAILED_UNDEPLOYING_NETS
|
'FAILED_UNDEPLOYING_NETS',
|
||||||
FAILED_SCALING]
|
'FAILED_SCALING']
|
||||||
REGULAR_STATES = %w[PENDING
|
REGULAR_STATES = ['PENDING',
|
||||||
DEPLOYING
|
'DEPLOYING',
|
||||||
DEPLOYING_NETS
|
'DEPLOYING_NETS',
|
||||||
UNDEPLOYING
|
'UNDEPLOYING',
|
||||||
UNDEPLOYING_NETS
|
'UNDEPLOYING_NETS',
|
||||||
CONFIGURING
|
'CONFIGURING',
|
||||||
WARNING]
|
'WARNING']
|
||||||
|
|
||||||
# Set state color
|
# Set state color
|
||||||
#
|
#
|
||||||
|
@ -297,7 +297,7 @@ class OneFlowHelper < OpenNebulaHelper::OneHelper
|
|||||||
|
|
||||||
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
||||||
|
|
||||||
%w[OWNER GROUP OTHER].each do |e|
|
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
||||||
mask = '---'
|
mask = '---'
|
||||||
permissions_hash = document['PERMISSIONS']
|
permissions_hash = document['PERMISSIONS']
|
||||||
mask[0] = 'u' if permissions_hash["#{e}_U"] == '1'
|
mask[0] = 'u' if permissions_hash["#{e}_U"] == '1'
|
||||||
|
@ -157,7 +157,7 @@ class OneFlowTemplateHelper < OpenNebulaHelper::OneHelper
|
|||||||
|
|
||||||
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
||||||
|
|
||||||
%w[OWNER GROUP OTHER].each do |e|
|
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
||||||
mask = '---'
|
mask = '---'
|
||||||
permissions_hash = document['PERMISSIONS']
|
permissions_hash = document['PERMISSIONS']
|
||||||
mask[0] = 'u' if permissions_hash["#{e}_U"] == '1'
|
mask[0] = 'u' if permissions_hash["#{e}_U"] == '1'
|
||||||
|
@ -468,10 +468,10 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
|||||||
n_elems = options[:n_elems] || 8
|
n_elems = options[:n_elems] || 8
|
||||||
|
|
||||||
# Different available size units
|
# Different available size units
|
||||||
units = %w[K M G T]
|
units = ['K', 'M', 'G', 'T']
|
||||||
|
|
||||||
# Attrs that need units conversion
|
# Attrs that need units conversion
|
||||||
attrs = %w[FREE_MEMORY USED_MEMORY]
|
attrs = ['FREE_MEMORY', 'USED_MEMORY']
|
||||||
|
|
||||||
if unit && !units.include?(unit)
|
if unit && !units.include?(unit)
|
||||||
STDERR.puts "Invalid unit `#{unit}`"
|
STDERR.puts "Invalid unit `#{unit}`"
|
||||||
|
@ -22,7 +22,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
|
|||||||
|
|
||||||
# This list contains prefixes that should skip adding user home to the path
|
# This list contains prefixes that should skip adding user home to the path
|
||||||
# This must have the same content as the case $FROM in downloader.sh
|
# This must have the same content as the case $FROM in downloader.sh
|
||||||
PREFIXES = %w[http https ssh s3 rbd vcenter lxd docker dockerfile]
|
PREFIXES = ['http', 'https', 'ssh', 's3', 'rbd', 'vcenter', 'lxd', 'docker', 'dockerfile']
|
||||||
|
|
||||||
TEMPLATE_OPTIONS=[
|
TEMPLATE_OPTIONS=[
|
||||||
{
|
{
|
||||||
@ -67,7 +67,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
|
|||||||
:format => String,
|
:format => String,
|
||||||
:proc => lambda do |o, _options|
|
:proc => lambda do |o, _options|
|
||||||
prefix=o.strip.downcase
|
prefix=o.strip.downcase
|
||||||
if %w[hd sd xvd vd].include? prefix
|
if ['hd', 'sd', 'xvd', 'vd'].include? prefix
|
||||||
[0, prefix]
|
[0, prefix]
|
||||||
else
|
else
|
||||||
[-1, 'The prefix must be hd, sd, xvd or vd']
|
[-1, 'The prefix must be hd, sd, xvd or vd']
|
||||||
@ -328,7 +328,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
|
|||||||
|
|
||||||
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
||||||
|
|
||||||
%w[OWNER GROUP OTHER].each do |e|
|
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
||||||
mask = '---'
|
mask = '---'
|
||||||
mask[0] = 'u' if image["PERMISSIONS/#{e}_U"] == '1'
|
mask[0] = 'u' if image["PERMISSIONS/#{e}_U"] == '1'
|
||||||
mask[1] = 'm' if image["PERMISSIONS/#{e}_M"] == '1'
|
mask[1] = 'm' if image["PERMISSIONS/#{e}_M"] == '1'
|
||||||
|
@ -60,7 +60,7 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Available market place mads to import apps on them
|
# Available market place mads to import apps on them
|
||||||
MARKETS = %w[http s3]
|
MARKETS = ['http', 's3']
|
||||||
|
|
||||||
def self.rname
|
def self.rname
|
||||||
'MARKETPLACEAPP'
|
'MARKETPLACEAPP'
|
||||||
@ -413,7 +413,7 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper
|
|||||||
|
|
||||||
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
||||||
|
|
||||||
%w[OWNER GROUP OTHER].each do |e|
|
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
||||||
mask = '---'
|
mask = '---'
|
||||||
mask[0] = 'u' if app["PERMISSIONS/#{e}_U"] == '1'
|
mask[0] = 'u' if app["PERMISSIONS/#{e}_U"] == '1'
|
||||||
mask[1] = 'm' if app["PERMISSIONS/#{e}_M"] == '1'
|
mask[1] = 'm' if app["PERMISSIONS/#{e}_M"] == '1'
|
||||||
|
@ -58,20 +58,20 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
|
|||||||
#
|
#
|
||||||
TABLE = {
|
TABLE = {
|
||||||
VOBJECT::DATASTORE => {
|
VOBJECT::DATASTORE => {
|
||||||
:struct => %w[DATASTORE_LIST DATASTORE],
|
:struct => ['DATASTORE_LIST', 'DATASTORE'],
|
||||||
:columns =>
|
:columns =>
|
||||||
{ :IMID => 5, :REF => 15, :NAME => 50, :CLUSTERS => 10 },
|
{ :IMID => 5, :REF => 15, :NAME => 50, :CLUSTERS => 10 },
|
||||||
:cli => [:host],
|
:cli => [:host],
|
||||||
:dialogue => ->(arg) {}
|
:dialogue => ->(arg) {}
|
||||||
},
|
},
|
||||||
VOBJECT::TEMPLATE => {
|
VOBJECT::TEMPLATE => {
|
||||||
:struct => %w[TEMPLATE_LIST TEMPLATE],
|
:struct => ['TEMPLATE_LIST', 'TEMPLATE'],
|
||||||
:columns => { :IMID => 5, :REF => 10, :NAME => 50 },
|
:columns => { :IMID => 5, :REF => 10, :NAME => 50 },
|
||||||
:cli => [:host],
|
:cli => [:host],
|
||||||
:dialogue => ->(arg) { OneVcenterHelper.template_dialogue(arg) }
|
:dialogue => ->(arg) { OneVcenterHelper.template_dialogue(arg) }
|
||||||
},
|
},
|
||||||
VOBJECT::NETWORK => {
|
VOBJECT::NETWORK => {
|
||||||
:struct => %w[NETWORK_LIST NETWORK],
|
:struct => ['NETWORK_LIST', 'NETWORK'],
|
||||||
:columns => {
|
:columns => {
|
||||||
:IMID => 5,
|
:IMID => 5,
|
||||||
:REF => 15,
|
:REF => 15,
|
||||||
@ -82,13 +82,13 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
|
|||||||
:dialogue => ->(arg) { OneVcenterHelper.network_dialogue(arg) }
|
:dialogue => ->(arg) { OneVcenterHelper.network_dialogue(arg) }
|
||||||
},
|
},
|
||||||
VOBJECT::IMAGE => {
|
VOBJECT::IMAGE => {
|
||||||
:struct => %w[IMAGE_LIST IMAGE],
|
:struct => ['IMAGE_LIST', 'IMAGE'],
|
||||||
:columns => { :IMID => 5, :REF => 35, :PATH => 60 },
|
:columns => { :IMID => 5, :REF => 35, :PATH => 60 },
|
||||||
:cli => [:host, :datastore],
|
:cli => [:host, :datastore],
|
||||||
:dialogue => ->(arg) {}
|
:dialogue => ->(arg) {}
|
||||||
},
|
},
|
||||||
VOBJECT::HOST => {
|
VOBJECT::HOST => {
|
||||||
:struct => %w[HOST_LIST HOST],
|
:struct => ['HOST_LIST', 'HOST'],
|
||||||
:columns => { :DATACENTER => 10, :NAME => 30, :REF => 35 },
|
:columns => { :DATACENTER => 10, :NAME => 30, :REF => 35 },
|
||||||
:cli => [],
|
:cli => [],
|
||||||
:dialogue => ->(arg) {}
|
:dialogue => ->(arg) {}
|
||||||
@ -471,7 +471,7 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
|
|||||||
' do you want to create (IPv[4],IPv[6], [E]thernet)? '
|
' do you want to create (IPv[4],IPv[6], [E]thernet)? '
|
||||||
type_answer = ask.call(question, 'ether')
|
type_answer = ask.call(question, 'ether')
|
||||||
|
|
||||||
supported_types = %w[4 6 ether e ip4 ip6]
|
supported_types = ['4', '6', 'ether', 'e', 'ip4', 'ip6']
|
||||||
if !supported_types.include?(type_answer)
|
if !supported_types.include?(type_answer)
|
||||||
type_answer = 'e'
|
type_answer = 'e'
|
||||||
STDOUT.puts " Type [#{type_answer}] not supported,"\
|
STDOUT.puts " Type [#{type_answer}] not supported,"\
|
||||||
|
@ -343,7 +343,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
|||||||
|
|
||||||
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
||||||
|
|
||||||
%w[OWNER GROUP OTHER].each do |e|
|
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
||||||
mask = '---'
|
mask = '---'
|
||||||
mask[0] = 'u' if vn["PERMISSIONS/#{e}_U"] == '1'
|
mask[0] = 'u' if vn["PERMISSIONS/#{e}_U"] == '1'
|
||||||
mask[1] = 'm' if vn["PERMISSIONS/#{e}_M"] == '1'
|
mask[1] = 'm' if vn["PERMISSIONS/#{e}_M"] == '1'
|
||||||
|
@ -351,7 +351,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|||||||
|
|
||||||
(OneProvision::Provision::RESOURCES +
|
(OneProvision::Provision::RESOURCES +
|
||||||
OneProvision::Provision::FULL_CLUSTER -
|
OneProvision::Provision::FULL_CLUSTER -
|
||||||
%w[hosts marketplaceapps flowtemplates]).each do |resource|
|
['hosts', 'marketplaceapps', 'flowtemplates']).each do |resource|
|
||||||
list_desc = <<-EOT
|
list_desc = <<-EOT
|
||||||
List all available #{resource}
|
List all available #{resource}
|
||||||
EOT
|
EOT
|
||||||
@ -368,7 +368,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|||||||
|
|
||||||
(OneProvision::Provision::RESOURCES +
|
(OneProvision::Provision::RESOURCES +
|
||||||
OneProvision::Provision::FULL_CLUSTER -
|
OneProvision::Provision::FULL_CLUSTER -
|
||||||
%w[hosts marketplaceapps]).each do |resource|
|
['hosts', 'marketplaceapps']).each do |resource|
|
||||||
delete_desc = <<-EOT
|
delete_desc = <<-EOT
|
||||||
Deletes and unprovisions the given #{resource}
|
Deletes and unprovisions the given #{resource}
|
||||||
EOT
|
EOT
|
||||||
|
@ -603,7 +603,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|||||||
|
|
||||||
command :passwdsearch, passwdsearch_desc, :driver, :password,
|
command :passwdsearch, passwdsearch_desc, :driver, :password,
|
||||||
:options => [CLIHelper::CSV_OPT, OpenNebulaHelper::XML] do
|
:options => [CLIHelper::CSV_OPT, OpenNebulaHelper::XML] do
|
||||||
options[:list] = %w[ID NAME AUTH PASSWORD]
|
options[:list] = ['ID', 'NAME', 'AUTH', 'PASSWORD']
|
||||||
options[:filter] = ["AUTH=#{args[0]}", "PASSWORD=#{args[1]}"]
|
options[:filter] = ["AUTH=#{args[0]}", "PASSWORD=#{args[1]}"]
|
||||||
|
|
||||||
helper.list_pool(options)
|
helper.list_pool(options)
|
||||||
|
@ -250,7 +250,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|||||||
}
|
}
|
||||||
|
|
||||||
OpenNebulaHelper::TEMPLATE_OPTIONS_VM.delete_if do |v|
|
OpenNebulaHelper::TEMPLATE_OPTIONS_VM.delete_if do |v|
|
||||||
%w[as_gid as_uid].include?(v[:name])
|
['as_gid', 'as_uid'].include?(v[:name])
|
||||||
end
|
end
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
@ -40,28 +40,28 @@ class EventManager
|
|||||||
:wait_release_action
|
:wait_release_action
|
||||||
]
|
]
|
||||||
|
|
||||||
FAILURE_STATES = %w[
|
FAILURE_STATES = [
|
||||||
BOOT_FAILURE
|
'BOOT_FAILURE',
|
||||||
BOOT_MIGRATE_FAILURE
|
'BOOT_MIGRATE_FAILURE',
|
||||||
PROLOG_MIGRATE_FAILURE
|
'PROLOG_MIGRATE_FAILURE',
|
||||||
PROLOG_FAILURE
|
'PROLOG_FAILURE',
|
||||||
EPILOG_FAILURE
|
'EPILOG_FAILURE',
|
||||||
EPILOG_STOP_FAILURE
|
'EPILOG_STOP_FAILURE',
|
||||||
EPILOG_UNDEPLOY_FAILURE
|
'EPILOG_UNDEPLOY_FAILURE',
|
||||||
PROLOG_MIGRATE_POWEROFF_FAILURE
|
'PROLOG_MIGRATE_POWEROFF_FAILURE',
|
||||||
PROLOG_MIGRATE_SUSPEND_FAILURE
|
'PROLOG_MIGRATE_SUSPEND_FAILURE',
|
||||||
PROLOG_MIGRATE_UNKNOWN_FAILURE
|
'PROLOG_MIGRATE_UNKNOWN_FAILURE',
|
||||||
BOOT_UNDEPLOY_FAILURE
|
'BOOT_UNDEPLOY_FAILURE',
|
||||||
BOOT_STOPPED_FAILURE
|
'BOOT_STOPPED_FAILURE',
|
||||||
PROLOG_RESUME_FAILURE
|
'PROLOG_RESUME_FAILURE',
|
||||||
PROLOG_UNDEPLOY_FAILURE
|
'PROLOG_UNDEPLOY_FAILURE'
|
||||||
]
|
]
|
||||||
|
|
||||||
SUBSCRIBE_STATES = %w[
|
SUBSCRIBE_STATES = [
|
||||||
STOPPED
|
'STOPPED',
|
||||||
SUSPENDED
|
'SUSPENDED',
|
||||||
POWEROFF
|
'POWEROFF',
|
||||||
UNDEPLOYED
|
'UNDEPLOYED'
|
||||||
]
|
]
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
|
@ -36,9 +36,9 @@ class ServiceWD
|
|||||||
############################################################################
|
############################################################################
|
||||||
# WARNING STATES
|
# WARNING STATES
|
||||||
############################################################################
|
############################################################################
|
||||||
WARNING_STATES = %w[
|
WARNING_STATES = [
|
||||||
POWEROFF
|
'POWEROFF',
|
||||||
UNKNOWN
|
'UNKNOWN'
|
||||||
] + EventManager::FAILURE_STATES
|
] + EventManager::FAILURE_STATES
|
||||||
|
|
||||||
# Class constructor
|
# Class constructor
|
||||||
|
@ -32,26 +32,26 @@ module OpenNebula
|
|||||||
attr_reader :service
|
attr_reader :service
|
||||||
|
|
||||||
# Actions that can be performed on the VMs of a given Role
|
# Actions that can be performed on the VMs of a given Role
|
||||||
SCHEDULE_ACTIONS = %w[
|
SCHEDULE_ACTIONS = [
|
||||||
terminate
|
'terminate',
|
||||||
terminate-hard
|
'terminate-hard',
|
||||||
undeploy
|
'undeploy',
|
||||||
undeploy-hard
|
'undeploy-hard',
|
||||||
hold
|
'hold',
|
||||||
release
|
'release',
|
||||||
stop
|
'stop',
|
||||||
suspend
|
'suspend',
|
||||||
resume
|
'resume',
|
||||||
reboot
|
'reboot',
|
||||||
reboot-hard
|
'reboot-hard',
|
||||||
poweroff
|
'poweroff',
|
||||||
poweroff-hard
|
'poweroff-hard',
|
||||||
snapshot-create
|
'snapshot-create',
|
||||||
snapshot-revert
|
'snapshot-revert',
|
||||||
snapshot-delete
|
'snapshot-delete',
|
||||||
disk-snapshot-create
|
'disk-snapshot-create',
|
||||||
disk-snapshot-revert
|
'disk-snapshot-revert',
|
||||||
disk-snapshot-delete
|
'disk-snapshot-delete'
|
||||||
]
|
]
|
||||||
|
|
||||||
STATE = {
|
STATE = {
|
||||||
@ -69,52 +69,52 @@ module OpenNebula
|
|||||||
'HOLD' => 11
|
'HOLD' => 11
|
||||||
}
|
}
|
||||||
|
|
||||||
STATE_STR = %w[
|
STATE_STR = [
|
||||||
PENDING
|
'PENDING',
|
||||||
DEPLOYING
|
'DEPLOYING',
|
||||||
RUNNING
|
'RUNNING',
|
||||||
UNDEPLOYING
|
'UNDEPLOYING',
|
||||||
WARNING
|
'WARNING',
|
||||||
DONE
|
'DONE',
|
||||||
FAILED_UNDEPLOYING
|
'FAILED_UNDEPLOYING',
|
||||||
FAILED_DEPLOYING
|
'FAILED_DEPLOYING',
|
||||||
SCALING
|
'SCALING',
|
||||||
FAILED_SCALING
|
'FAILED_SCALING',
|
||||||
COOLDOWN
|
'COOLDOWN',
|
||||||
HOLD
|
'HOLD'
|
||||||
]
|
]
|
||||||
|
|
||||||
RECOVER_DEPLOY_STATES = %w[
|
RECOVER_DEPLOY_STATES = [
|
||||||
FAILED_DEPLOYING
|
'FAILED_DEPLOYING',
|
||||||
DEPLOYING
|
'DEPLOYING',
|
||||||
PENDING
|
'PENDING'
|
||||||
]
|
]
|
||||||
|
|
||||||
RECOVER_UNDEPLOY_STATES = %w[
|
RECOVER_UNDEPLOY_STATES = [
|
||||||
FAILED_UNDEPLOYING
|
'FAILED_UNDEPLOYING',
|
||||||
UNDEPLOYING
|
'UNDEPLOYING'
|
||||||
]
|
]
|
||||||
|
|
||||||
RECOVER_SCALE_STATES = %w[
|
RECOVER_SCALE_STATES = [
|
||||||
FAILED_SCALING
|
'FAILED_SCALING',
|
||||||
SCALING
|
'SCALING'
|
||||||
]
|
]
|
||||||
|
|
||||||
VM_FAILURE_STATES = %w[
|
VM_FAILURE_STATES = [
|
||||||
BOOT_FAILURE
|
'BOOT_FAILURE',
|
||||||
BOOT_MIGRATE_FAILURE
|
'BOOT_MIGRATE_FAILURE',
|
||||||
PROLOG_MIGRATE_FAILURE
|
'PROLOG_MIGRATE_FAILURE',
|
||||||
PROLOG_FAILURE
|
'PROLOG_FAILURE',
|
||||||
EPILOG_FAILURE
|
'EPILOG_FAILURE',
|
||||||
EPILOG_STOP_FAILURE
|
'EPILOG_STOP_FAILURE',
|
||||||
EPILOG_UNDEPLOY_FAILURE
|
'EPILOG_UNDEPLOY_FAILURE',
|
||||||
PROLOG_MIGRATE_POWEROFF_FAILURE
|
'PROLOG_MIGRATE_POWEROFF_FAILURE',
|
||||||
PROLOG_MIGRATE_SUSPEND_FAILURE
|
'PROLOG_MIGRATE_SUSPEND_FAILURE',
|
||||||
PROLOG_MIGRATE_UNKNOWN_FAILURE
|
'PROLOG_MIGRATE_UNKNOWN_FAILURE',
|
||||||
BOOT_UNDEPLOY_FAILURE
|
'BOOT_UNDEPLOY_FAILURE',
|
||||||
BOOT_STOPPED_FAILURE
|
'BOOT_STOPPED_FAILURE',
|
||||||
PROLOG_RESUME_FAILURE
|
'PROLOG_RESUME_FAILURE',
|
||||||
PROLOG_UNDEPLOY_FAILURE
|
'PROLOG_UNDEPLOY_FAILURE'
|
||||||
]
|
]
|
||||||
|
|
||||||
SCALE_WAYS = {
|
SCALE_WAYS = {
|
||||||
@ -129,17 +129,17 @@ module OpenNebula
|
|||||||
# parents: this has only sense in deploy operation
|
# parents: this has only sense in deploy operation
|
||||||
# state: this is internal information managed by OneFlow server
|
# state: this is internal information managed by OneFlow server
|
||||||
# vm_template: this will affect scale operation
|
# vm_template: this will affect scale operation
|
||||||
IMMUTABLE_ATTRS = %w[
|
IMMUTABLE_ATTRS = [
|
||||||
cardinality
|
'cardinality',
|
||||||
last_vmname
|
'last_vmname',
|
||||||
nodes
|
'nodes',
|
||||||
parents
|
'parents',
|
||||||
state
|
'state',
|
||||||
vm_template
|
'vm_template'
|
||||||
]
|
]
|
||||||
|
|
||||||
# VM information to save in document
|
# VM information to save in document
|
||||||
VM_INFO = %w[ID UID GID UNAME GNAME NAME]
|
VM_INFO = ['ID', 'UID', 'GID', 'UNAME', 'GNAME', 'NAME']
|
||||||
|
|
||||||
LOG_COMP = 'ROL'
|
LOG_COMP = 'ROL'
|
||||||
|
|
||||||
|
@ -42,64 +42,64 @@ module OpenNebula
|
|||||||
'HOLD' => 15
|
'HOLD' => 15
|
||||||
}
|
}
|
||||||
|
|
||||||
STATE_STR = %w[
|
STATE_STR = [
|
||||||
PENDING
|
'PENDING',
|
||||||
DEPLOYING
|
'DEPLOYING',
|
||||||
RUNNING
|
'RUNNING',
|
||||||
UNDEPLOYING
|
'UNDEPLOYING',
|
||||||
WARNING
|
'WARNING',
|
||||||
DONE
|
'DONE',
|
||||||
FAILED_UNDEPLOYING
|
'FAILED_UNDEPLOYING',
|
||||||
FAILED_DEPLOYING
|
'FAILED_DEPLOYING',
|
||||||
SCALING
|
'SCALING',
|
||||||
FAILED_SCALING
|
'FAILED_SCALING',
|
||||||
COOLDOWN
|
'COOLDOWN',
|
||||||
DEPLOYING_NETS
|
'DEPLOYING_NETS',
|
||||||
UNDEPLOYING_NETS
|
'UNDEPLOYING_NETS',
|
||||||
FAILED_DEPLOYING_NETS
|
'FAILED_DEPLOYING_NETS',
|
||||||
FAILED_UNDEPLOYING_NETS
|
'FAILED_UNDEPLOYING_NETS',
|
||||||
HOLD
|
'HOLD'
|
||||||
]
|
]
|
||||||
|
|
||||||
TRANSIENT_STATES = %w[
|
TRANSIENT_STATES = [
|
||||||
DEPLOYING
|
'DEPLOYING',
|
||||||
UNDEPLOYING
|
'UNDEPLOYING',
|
||||||
SCALING
|
'SCALING',
|
||||||
COOLDOWN
|
'COOLDOWN',
|
||||||
DEPLOYING_NETS
|
'DEPLOYING_NETS',
|
||||||
UNDEPLOYING_NETS
|
'UNDEPLOYING_NETS'
|
||||||
]
|
]
|
||||||
|
|
||||||
FAILED_STATES = %w[
|
FAILED_STATES = [
|
||||||
FAILED_DEPLOYING
|
'FAILED_DEPLOYING',
|
||||||
FAILED_UNDEPLOYING
|
'FAILED_UNDEPLOYING',
|
||||||
FAILED_SCALING
|
'FAILED_SCALING',
|
||||||
FAILED_DEPLOYING_NETS
|
'FAILED_DEPLOYING_NETS',
|
||||||
FAILED_UNDEPLOYING_NETS
|
'FAILED_UNDEPLOYING_NETS'
|
||||||
]
|
]
|
||||||
|
|
||||||
RECOVER_DEPLOY_STATES = %w[
|
RECOVER_DEPLOY_STATES = [
|
||||||
FAILED_DEPLOYING
|
'FAILED_DEPLOYING',
|
||||||
DEPLOYING
|
'DEPLOYING',
|
||||||
PENDING
|
'PENDING'
|
||||||
]
|
]
|
||||||
|
|
||||||
RECOVER_UNDEPLOY_STATES = %w[
|
RECOVER_UNDEPLOY_STATES = [
|
||||||
FAILED_UNDEPLOYING
|
'FAILED_UNDEPLOYING',
|
||||||
UNDEPLOYING
|
'UNDEPLOYING',
|
||||||
FAILED_UNDEPLOYING_NETS
|
'FAILED_UNDEPLOYING_NETS'
|
||||||
]
|
]
|
||||||
|
|
||||||
RECOVER_SCALE_STATES = %w[
|
RECOVER_SCALE_STATES = [
|
||||||
FAILED_SCALING
|
'FAILED_SCALING',
|
||||||
SCALING
|
'SCALING'
|
||||||
]
|
]
|
||||||
|
|
||||||
RECOVER_DEPLOY_NETS_STATES = %w[DEPLOYING_NETS FAILED_DEPLOYING_NETS]
|
RECOVER_DEPLOY_NETS_STATES = ['DEPLOYING_NETS', 'FAILED_DEPLOYING_NETS']
|
||||||
|
|
||||||
RECOVER_UNDEPLOY_NETS_STATES = %w[
|
RECOVER_UNDEPLOY_NETS_STATES = [
|
||||||
UNDEPLOYING_NETS
|
'UNDEPLOYING_NETS',
|
||||||
FAILED_UNDEPLOYING_NETS
|
'FAILED_UNDEPLOYING_NETS'
|
||||||
]
|
]
|
||||||
|
|
||||||
# List of attributes that can't be changed in update operation
|
# List of attributes that can't be changed in update operation
|
||||||
@ -114,17 +114,17 @@ module OpenNebula
|
|||||||
# ready_status_gate: it only has sense when deploying, not in running
|
# ready_status_gate: it only has sense when deploying, not in running
|
||||||
# state: this is internal information managed by OneFlow server
|
# state: this is internal information managed by OneFlow server
|
||||||
# start_time: this is internal information managed by OneFlow server
|
# start_time: this is internal information managed by OneFlow server
|
||||||
IMMUTABLE_ATTRS = %w[
|
IMMUTABLE_ATTRS = [
|
||||||
custom_attrs
|
'custom_attrs',
|
||||||
custom_attrs_values
|
'custom_attrs_values',
|
||||||
deployment
|
'deployment',
|
||||||
log
|
'log',
|
||||||
name
|
'name',
|
||||||
networks
|
'networks',
|
||||||
networks_values
|
'networks_values',
|
||||||
ready_status_gate
|
'ready_status_gate',
|
||||||
state
|
'state',
|
||||||
start_time
|
'start_time'
|
||||||
]
|
]
|
||||||
|
|
||||||
LOG_COMP = 'SER'
|
LOG_COMP = 'SER'
|
||||||
@ -677,7 +677,7 @@ module OpenNebula
|
|||||||
vnet.each do |_, net|
|
vnet.each do |_, net|
|
||||||
key = net.keys.first
|
key = net.keys.first
|
||||||
|
|
||||||
next unless %w[template_id reserve_from].include?(key)
|
next unless ['template_id', 'reserve_from'].include?(key)
|
||||||
|
|
||||||
rc = OpenNebula::VirtualNetwork.new_with_id(
|
rc = OpenNebula::VirtualNetwork.new_with_id(
|
||||||
net['id'],
|
net['id'],
|
||||||
|
@ -149,7 +149,7 @@ end
|
|||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# Script helper functions and gLobals
|
# Script helper functions and gLobals
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
LOCAL_HYPERVISOR = %w[az ec2 one equinix].freeze
|
LOCAL_HYPERVISOR = ['az', 'ec2', 'one', 'equinix'].freeze
|
||||||
|
|
||||||
def local?(hypervisor)
|
def local?(hypervisor)
|
||||||
LOCAL_HYPERVISOR.include?(hypervisor)
|
LOCAL_HYPERVISOR.include?(hypervisor)
|
||||||
|
@ -21,7 +21,7 @@ require 'open3'
|
|||||||
ENV['LANG'] = 'C'
|
ENV['LANG'] = 'C'
|
||||||
ENV['LC_ALL'] = 'C'
|
ENV['LC_ALL'] = 'C'
|
||||||
|
|
||||||
GUEST_ARCHS = %w[i686 x86_64]
|
GUEST_ARCHS = ['i686', 'x86_64']
|
||||||
|
|
||||||
begin
|
begin
|
||||||
machines = []
|
machines = []
|
||||||
|
@ -64,8 +64,8 @@ class BaseDomain
|
|||||||
Base64.strict_encode64(mon_s)
|
Base64.strict_encode64(mon_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
MONITOR_KEYS = %w[cpu memory netrx nettx diskrdbytes diskwrbytes diskrdiops
|
MONITOR_KEYS = ['cpu', 'memory', 'netrx', 'nettx', 'diskrdbytes', 'diskwrbytes', 'diskrdiops',
|
||||||
diskwriops]
|
'diskwriops']
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ require 'openssl'
|
|||||||
class MonitorClient
|
class MonitorClient
|
||||||
|
|
||||||
# Defined in src/monitor/include/MonitorDriverMessages.h
|
# Defined in src/monitor/include/MonitorDriverMessages.h
|
||||||
MESSAGE_TYPES = %w[MONITOR_VM MONITOR_HOST SYSTEM_HOST BEACON_HOST STATE_VM
|
MESSAGE_TYPES = ['MONITOR_VM', 'MONITOR_HOST', 'SYSTEM_HOST', 'BEACON_HOST', 'STATE_VM',
|
||||||
START_MONITOR STOP_MONITOR].freeze
|
'START_MONITOR', 'STOP_MONITOR'].freeze
|
||||||
|
|
||||||
MESSAGE_STATUS = { true =>'SUCCESS', false => 'FAILURE' }.freeze
|
MESSAGE_STATUS = { true =>'SUCCESS', false => 'FAILURE' }.freeze
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ module NUMA
|
|||||||
hp_info = { 'size' => hp_size }
|
hp_info = { 'size' => hp_size }
|
||||||
|
|
||||||
begin
|
begin
|
||||||
%w[free nr surplus].each do |var|
|
['free', 'nr', 'surplus'].each do |var|
|
||||||
var_path = "#{hpsz_path}/#{var}_hugepages"
|
var_path = "#{hpsz_path}/#{var}_hugepages"
|
||||||
hp_info[var] = File.read(var_path).chomp
|
hp_info[var] = File.read(var_path).chomp
|
||||||
end
|
end
|
||||||
@ -102,7 +102,7 @@ module NUMA
|
|||||||
|
|
||||||
bind = binding
|
bind = binding
|
||||||
|
|
||||||
mem_vars = %w[MemTotal MemFree MemUsed]
|
mem_vars = ['MemTotal', 'MemFree', 'MemUsed']
|
||||||
|
|
||||||
# rubocop:disable Style/DocumentDynamicEvalDefinition
|
# rubocop:disable Style/DocumentDynamicEvalDefinition
|
||||||
mem_vars.each {|var| bind.eval("#{var.downcase.to_sym} = 0") }
|
mem_vars.each {|var| bind.eval("#{var.downcase.to_sym} = 0") }
|
||||||
|
@ -110,7 +110,7 @@ require 'oneprovision'
|
|||||||
require 'ipaddr'
|
require 'ipaddr'
|
||||||
require 'digest'
|
require 'digest'
|
||||||
|
|
||||||
IP_TYPE = %w[public_ipv4 global_ipv4]
|
IP_TYPE = ['public_ipv4', 'global_ipv4']
|
||||||
|
|
||||||
DEFAULT_PRIVATE_CIDR = '172.16.0.0/12'
|
DEFAULT_PRIVATE_CIDR = '172.16.0.0/12'
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ require 'opennebula'
|
|||||||
require 'oneprovision'
|
require 'oneprovision'
|
||||||
require 'vultr'
|
require 'vultr'
|
||||||
|
|
||||||
IP_TYPE = %w[v4 v6]
|
IP_TYPE = ['v4', 'v6']
|
||||||
|
|
||||||
DEFAULT_PRIVATE_CIDR = '172.16.0.0/12'
|
DEFAULT_PRIVATE_CIDR = '172.16.0.0/12'
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ class LinuxContainersMarket
|
|||||||
:fs => 'ext4',
|
:fs => 'ext4',
|
||||||
:format => 'raw',
|
:format => 'raw',
|
||||||
:agent => 'OpenNebula',
|
:agent => 'OpenNebula',
|
||||||
:tested_apps => %w[alpine alt centos rockylinux almalinux oracle debian
|
:tested_apps => ['alpine', 'alt', 'centos', 'rockylinux', 'almalinux', 'oracle', 'debian',
|
||||||
ubuntu fedora devuan],
|
'ubuntu', 'fedora', 'devuan'],
|
||||||
:skip_untested => 'yes',
|
:skip_untested => 'yes',
|
||||||
:memory => '768',
|
:memory => '768',
|
||||||
:cpu => 1,
|
:cpu => 1,
|
||||||
|
@ -50,11 +50,11 @@ module OpenNebula
|
|||||||
},
|
},
|
||||||
'shutdown_action' => {
|
'shutdown_action' => {
|
||||||
:type => :string,
|
:type => :string,
|
||||||
:enum => %w[
|
:enum => [
|
||||||
terminate
|
'terminate',
|
||||||
terminate-hard
|
'terminate-hard',
|
||||||
shutdown
|
'shutdown',
|
||||||
shutdown-hard
|
'shutdown-hard'
|
||||||
],
|
],
|
||||||
:required => false
|
:required => false
|
||||||
},
|
},
|
||||||
@ -84,10 +84,10 @@ module OpenNebula
|
|||||||
:properties => {
|
:properties => {
|
||||||
'type' => {
|
'type' => {
|
||||||
:type => :string,
|
:type => :string,
|
||||||
:enum => %w[
|
:enum => [
|
||||||
CHANGE
|
'CHANGE',
|
||||||
CARDINALITY
|
'CARDINALITY',
|
||||||
PERCENTAGE_CHANGE
|
'PERCENTAGE_CHANGE'
|
||||||
],
|
],
|
||||||
:required => true
|
:required => true
|
||||||
},
|
},
|
||||||
@ -133,10 +133,10 @@ module OpenNebula
|
|||||||
:properties => {
|
:properties => {
|
||||||
'type' => {
|
'type' => {
|
||||||
:type => :string,
|
:type => :string,
|
||||||
:enum => %w[
|
:enum => [
|
||||||
CHANGE
|
'CHANGE',
|
||||||
CARDINALITY
|
'CARDINALITY',
|
||||||
PERCENTAGE_CHANGE
|
'PERCENTAGE_CHANGE'
|
||||||
],
|
],
|
||||||
:required => true
|
:required => true
|
||||||
},
|
},
|
||||||
@ -172,7 +172,7 @@ module OpenNebula
|
|||||||
},
|
},
|
||||||
'deployment' => {
|
'deployment' => {
|
||||||
:type => :string,
|
:type => :string,
|
||||||
:enum => %w[none straight],
|
:enum => ['none', 'straight'],
|
||||||
:default => 'none'
|
:default => 'none'
|
||||||
},
|
},
|
||||||
'description' => {
|
'description' => {
|
||||||
@ -181,11 +181,11 @@ module OpenNebula
|
|||||||
},
|
},
|
||||||
'shutdown_action' => {
|
'shutdown_action' => {
|
||||||
:type => :string,
|
:type => :string,
|
||||||
:enum => %w[
|
:enum => [
|
||||||
terminate
|
'terminate',
|
||||||
terminate-hard
|
'terminate-hard',
|
||||||
shutdown
|
'shutdown',
|
||||||
shutdown-hard
|
'shutdown-hard'
|
||||||
],
|
],
|
||||||
:required => false
|
:required => false
|
||||||
},
|
},
|
||||||
@ -235,8 +235,8 @@ module OpenNebula
|
|||||||
# List of attributes that can't be changed in update operation
|
# List of attributes that can't be changed in update operation
|
||||||
#
|
#
|
||||||
# registration_time: this is internal info managed by OneFlow server
|
# registration_time: this is internal info managed by OneFlow server
|
||||||
IMMUTABLE_ATTRS = %w[
|
IMMUTABLE_ATTRS = [
|
||||||
registration_time
|
'registration_time'
|
||||||
]
|
]
|
||||||
|
|
||||||
def self.init_default_vn_name_template(vn_name_template)
|
def self.init_default_vn_name_template(vn_name_template)
|
||||||
|
@ -314,9 +314,9 @@ module OpenNebula::MarketPlaceAppExt
|
|||||||
# @param image [OpenNebula::Image] Image information
|
# @param image [OpenNebula::Image] Image information
|
||||||
def create_vcenter_template(ds, options, template, image = nil)
|
def create_vcenter_template(ds, options, template, image = nil)
|
||||||
ret = {}
|
ret = {}
|
||||||
keys = %w[VCENTER_TEMPLATE_REF
|
keys = ['VCENTER_TEMPLATE_REF',
|
||||||
VCENTER_CCR_REF
|
'VCENTER_CCR_REF',
|
||||||
VCENTER_INSTANCE_ID]
|
'VCENTER_INSTANCE_ID']
|
||||||
|
|
||||||
if ds['//VCENTER_TEMPLATE_REF']
|
if ds['//VCENTER_TEMPLATE_REF']
|
||||||
keys.each do |key|
|
keys.each do |key|
|
||||||
|
@ -79,7 +79,7 @@ module OpenNebula::TemplateExt
|
|||||||
image['STATE'].to_i
|
image['STATE'].to_i
|
||||||
]
|
]
|
||||||
|
|
||||||
unless %w[LOCKED READY USED].include?(i_state)
|
unless ['LOCKED', 'READY', 'USED'].include?(i_state)
|
||||||
logger.fatal "Wrong image state #{i_state}" if logger
|
logger.fatal "Wrong image state #{i_state}" if logger
|
||||||
|
|
||||||
rollback(ids)
|
rollback(ids)
|
||||||
@ -204,7 +204,7 @@ module OpenNebula::TemplateExt
|
|||||||
# @param nic [XMLElement] to delete attributes from
|
# @param nic [XMLElement] to delete attributes from
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
def delete_nic_attributes(nic)
|
def delete_nic_attributes(nic)
|
||||||
%w[NETWORK NETWORK_ID NETWORK_UNAME SECURITY_GROUPS].each do |a|
|
['NETWORK', 'NETWORK_ID', 'NETWORK_UNAME', 'SECURITY_GROUPS'].each do |a|
|
||||||
nic.delete_element(a)
|
nic.delete_element(a)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -47,17 +47,16 @@ module OpenNebula::VirtualMachineExt
|
|||||||
# @return [Integer, OpenNebula::Error] the new Template ID in case
|
# @return [Integer, OpenNebula::Error] the new Template ID in case
|
||||||
# of success, error otherwise
|
# of success, error otherwise
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
REMOVE_VNET_ATTRS = %w[AR_ID BRIDGE CLUSTER_ID IP MAC TARGET NIC_ID
|
REMOVE_VNET_ATTRS = ['AR_ID', 'BRIDGE', 'CLUSTER_ID', 'IP', 'MAC', 'TARGET', 'NIC_ID',
|
||||||
NETWORK_ID VN_MAD SECURITY_GROUPS VLAN_ID
|
'NETWORK_ID', 'VN_MAD', 'SECURITY_GROUPS', 'VLAN_ID',
|
||||||
BRIDGE_TYPE]
|
'BRIDGE_TYPE']
|
||||||
|
|
||||||
REMOVE_IMAGE_ATTRS = %w[DEV_PREFIX SOURCE ORIGINAL_SIZE SIZE
|
REMOVE_IMAGE_ATTRS = ['DEV_PREFIX', 'SOURCE', 'ORIGINAL_SIZE', 'SIZE',
|
||||||
DISK_SNAPSHOT_TOTAL_SIZE DRIVER IMAGE_STATE
|
'DISK_SNAPSHOT_TOTAL_SIZE', 'DRIVER', 'IMAGE_STATE', 'SAVE',
|
||||||
SAVE CLONE READONLY PERSISTENT TARGET
|
'CLONE', 'READONLY', 'PERSISTENT', 'TARGET', 'ALLOW_ORPHANS',
|
||||||
ALLOW_ORPHANS CLONE_TARGET CLUSTER_ID
|
'CLONE_TARGET', 'CLUSTER_ID', 'DATASTORE', 'DATASTORE_ID',
|
||||||
DATASTORE DATASTORE_ID DISK_ID DISK_TYPE
|
'DISK_ID', 'DISK_TYPE', 'IMAGE_ID', 'IMAGE', 'IMAGE_UNAME',
|
||||||
IMAGE_ID IMAGE IMAGE_UNAME IMAGE_UID
|
'IMAGE_UID', 'LN_TARGET', 'TM_MAD', 'TYPE', 'OPENNEBULA_MANAGED']
|
||||||
LN_TARGET TM_MAD TYPE OPENNEBULA_MANAGED]
|
|
||||||
|
|
||||||
def save_as_template(name, desc, opts = {})
|
def save_as_template(name, desc, opts = {})
|
||||||
opts = {
|
opts = {
|
||||||
|
@ -151,7 +151,7 @@ CommandParser::CmdParser.new(ARGV) do
|
|||||||
:format => String
|
:format => String
|
||||||
}
|
}
|
||||||
|
|
||||||
PATCH_FORMATS = %w[line yaml]
|
PATCH_FORMATS = ['line', 'yaml']
|
||||||
|
|
||||||
begin
|
begin
|
||||||
require 'ee'
|
require 'ee'
|
||||||
|
@ -84,7 +84,7 @@ module OneCfg::Common
|
|||||||
# command
|
# command
|
||||||
parsed[:command].downcase!
|
parsed[:command].downcase!
|
||||||
|
|
||||||
if !%w[rm ins set].include?(parsed[:command])
|
if !['rm', 'ins', 'set'].include?(parsed[:command])
|
||||||
raise OneCfg::Exception::FileParseError,
|
raise OneCfg::Exception::FileParseError,
|
||||||
"Invalid patch action '#{parsed[:command]}'"
|
"Invalid patch action '#{parsed[:command]}'"
|
||||||
end
|
end
|
||||||
|
@ -197,7 +197,7 @@ module OneCfg::Config
|
|||||||
# @return [Hash] Filtered file data
|
# @return [Hash] Filtered file data
|
||||||
def file4desc(data)
|
def file4desc(data)
|
||||||
data.select do |k, _v|
|
data.select do |k, _v|
|
||||||
%w[class owner group mode].include?(k)
|
['class', 'owner', 'group', 'mode'].include?(k)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -44,24 +44,22 @@ module OneCfg::Config::Type
|
|||||||
|
|
||||||
# Parameters which are expected to be specified MULTIPLE
|
# Parameters which are expected to be specified MULTIPLE
|
||||||
# times in the main section of configuration file.
|
# times in the main section of configuration file.
|
||||||
MULTIPLE = %w[
|
MULTIPLE = [
|
||||||
VM_RESTRICTED_ATTR
|
'VM_RESTRICTED_ATTR',
|
||||||
IMAGE_RESTRICTED_ATTR
|
'IMAGE_RESTRICTED_ATTR',
|
||||||
VNET_RESTRICTED_ATTR
|
'VNET_RESTRICTED_ATTR',
|
||||||
USER_RESTRICTED_ATTR
|
'USER_RESTRICTED_ATTR',
|
||||||
GROUP_RESTRICTED_ATTR
|
'GROUP_RESTRICTED_ATTR',
|
||||||
|
'DOCUMENT_ENCRYPTED_ATTR',
|
||||||
DOCUMENT_ENCRYPTED_ATTR
|
'HOST_ENCRYPTED_ATTR',
|
||||||
HOST_ENCRYPTED_ATTR
|
'IMAGE_ENCRYPTED_ATTR',
|
||||||
IMAGE_ENCRYPTED_ATTR
|
'VM_ENCRYPTED_ATTR',
|
||||||
VM_ENCRYPTED_ATTR
|
'VNET_ENCRYPTED_ATTR',
|
||||||
VNET_ENCRYPTED_ATTR
|
'DATASTORE_ENCRYPTED_ATTR',
|
||||||
DATASTORE_ENCRYPTED_ATTR
|
'CLUSTER_ENCRYPTED_ATTR',
|
||||||
CLUSTER_ENCRYPTED_ATTR
|
'INHERIT_DATASTORE_ATTR',
|
||||||
|
'INHERIT_IMAGE_ATTR',
|
||||||
INHERIT_DATASTORE_ATTR
|
'INHERIT_VNET_ATTR'
|
||||||
INHERIT_IMAGE_ATTR
|
|
||||||
INHERIT_VNET_ATTR
|
|
||||||
]
|
]
|
||||||
|
|
||||||
# Class constructor
|
# Class constructor
|
||||||
|
@ -67,7 +67,7 @@ module OneDBFsck
|
|||||||
|
|
||||||
history_doc = nokogiri_doc(row[:body])
|
history_doc = nokogiri_doc(row[:body])
|
||||||
|
|
||||||
%w[RETIME ESTIME EETIME ETIME].each do |att|
|
['RETIME', 'ESTIME', 'EETIME', 'ETIME'].each do |att|
|
||||||
elem = history_doc.root.at_xpath(att)
|
elem = history_doc.root.at_xpath(att)
|
||||||
|
|
||||||
elem.content = etime if elem.text == '0'
|
elem.content = etime if elem.text == '0'
|
||||||
|
@ -270,7 +270,7 @@ module OneDBFsck
|
|||||||
|
|
||||||
type = address_range.at_xpath('TYPE').text
|
type = address_range.at_xpath('TYPE').text
|
||||||
|
|
||||||
if %w[IP6 IP4_6].include? type
|
if ['IP6', 'IP4_6'].include? type
|
||||||
ipv6[:link_prefix] = 0xfe80000000000000
|
ipv6[:link_prefix] = 0xfe80000000000000
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ module OneDBFsck
|
|||||||
size = e.at_xpath('SIZE').text.to_i
|
size = e.at_xpath('SIZE').text.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
if %w[SWAP FS].include? type
|
if ['SWAP', 'FS'].include? type
|
||||||
sys_used += size
|
sys_used += size
|
||||||
|
|
||||||
next
|
next
|
||||||
|
@ -22,7 +22,7 @@ module OneProvision
|
|||||||
DOCUMENT_TYPE = 102
|
DOCUMENT_TYPE = 102
|
||||||
|
|
||||||
# These attributes can not be changed when updating the provider
|
# These attributes can not be changed when updating the provider
|
||||||
IMMUTABLE_ATTRS = %w[provider name]
|
IMMUTABLE_ATTRS = ['provider', 'name']
|
||||||
|
|
||||||
# These providers get the credentials via some file
|
# These providers get the credentials via some file
|
||||||
CREDENTIALS_FILE = { 'google' => 'credentials' }
|
CREDENTIALS_FILE = { 'google' => 'credentials' }
|
||||||
@ -185,7 +185,7 @@ EOS
|
|||||||
# @return [JSON] Document information in JSON format
|
# @return [JSON] Document information in JSON format
|
||||||
def to_json(template)
|
def to_json(template)
|
||||||
document = {}
|
document = {}
|
||||||
skip = %w[provider connection registration_time plain]
|
skip = ['provider', 'connection', 'registration_time', 'plain']
|
||||||
|
|
||||||
# Create document JSON
|
# Create document JSON
|
||||||
document['provider'] = template['provider']
|
document['provider'] = template['provider']
|
||||||
|
@ -35,28 +35,28 @@ module OneProvision
|
|||||||
'DELETING' => 5
|
'DELETING' => 5
|
||||||
}
|
}
|
||||||
|
|
||||||
STATE_STR = %w[
|
STATE_STR = [
|
||||||
PENDING
|
'PENDING',
|
||||||
DEPLOYING
|
'DEPLOYING',
|
||||||
CONFIGURING
|
'CONFIGURING',
|
||||||
RUNNING
|
'RUNNING',
|
||||||
ERROR
|
'ERROR',
|
||||||
DELETING
|
'DELETING'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Available resources that can be created with the provision
|
# Available resources that can be created with the provision
|
||||||
#
|
#
|
||||||
# Note: order is important, some objects depend on others
|
# Note: order is important, some objects depend on others
|
||||||
# Objects without dependencies need to be created firstly, then the rest
|
# Objects without dependencies need to be created firstly, then the rest
|
||||||
RESOURCES = %w[images
|
RESOURCES = ['images',
|
||||||
marketplaceapps
|
'marketplaceapps',
|
||||||
templates
|
'templates',
|
||||||
vntemplates
|
'vntemplates',
|
||||||
flowtemplates]
|
'flowtemplates']
|
||||||
|
|
||||||
INFRASTRUCTURE_RESOURCES = %w[datastores networks]
|
INFRASTRUCTURE_RESOURCES = ['datastores', 'networks']
|
||||||
|
|
||||||
FULL_CLUSTER = INFRASTRUCTURE_RESOURCES + %w[hosts clusters]
|
FULL_CLUSTER = INFRASTRUCTURE_RESOURCES + ['hosts', 'clusters']
|
||||||
|
|
||||||
# Class constructor
|
# Class constructor
|
||||||
#
|
#
|
||||||
@ -482,7 +482,7 @@ module OneProvision
|
|||||||
|
|
||||||
host['connection'] = {}
|
host['connection'] = {}
|
||||||
|
|
||||||
%w[private_key public_key remote_port remote_user].each do |attr|
|
['private_key', 'public_key', 'remote_port', 'remote_user'].each do |attr|
|
||||||
host['connection'][attr] = host['provision_connection'][attr]
|
host['connection'][attr] = host['provision_connection'][attr]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ module OneProvision
|
|||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
if @config['hosts']
|
if @config['hosts']
|
||||||
sections = %w[connection provision configuration]
|
sections = ['connection', 'provision', 'configuration']
|
||||||
|
|
||||||
@config['hosts'].map! do |host|
|
@config['hosts'].map! do |host|
|
||||||
sections.each do |section|
|
sections.each do |section|
|
||||||
@ -115,7 +115,7 @@ module OneProvision
|
|||||||
# Datastores & Networks
|
# Datastores & Networks
|
||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
%w[datastores networks].each do |r|
|
['datastores', 'networks'].each do |r|
|
||||||
next unless @config[r]
|
next unless @config[r]
|
||||||
|
|
||||||
@config[r].map! do |x|
|
@config[r].map! do |x|
|
||||||
@ -334,26 +334,26 @@ module OneProvision
|
|||||||
def extra
|
def extra
|
||||||
ret = {}
|
ret = {}
|
||||||
|
|
||||||
reject = %w[cluster
|
reject = ['cluster',
|
||||||
datastores
|
'datastores',
|
||||||
defaults
|
'defaults',
|
||||||
extends
|
'extends',
|
||||||
flowtemplates
|
'flowtemplates',
|
||||||
hosts
|
'hosts',
|
||||||
images
|
'images',
|
||||||
inputs
|
'inputs',
|
||||||
marketplaceapps
|
'marketplaceapps',
|
||||||
name
|
'name',
|
||||||
networks
|
'networks',
|
||||||
playbook
|
'playbook',
|
||||||
templates
|
'templates',
|
||||||
vntemplates
|
'vntemplates',
|
||||||
name
|
'name',
|
||||||
description
|
'description',
|
||||||
state
|
'state',
|
||||||
provider
|
'provider',
|
||||||
provision
|
'provision',
|
||||||
start_time]
|
'start_time']
|
||||||
|
|
||||||
@config.each do |key, value|
|
@config.each do |key, value|
|
||||||
next if reject.include?(key)
|
next if reject.include?(key)
|
||||||
@ -423,7 +423,7 @@ module OneProvision
|
|||||||
end
|
end
|
||||||
|
|
||||||
# merge each defaults section separately
|
# merge each defaults section separately
|
||||||
%w[connection provision configuration].each do |section|
|
['connection', 'provision', 'configuration'].each do |section|
|
||||||
base['defaults'][section] ||= {}
|
base['defaults'][section] ||= {}
|
||||||
yaml['defaults'][section] ||= {}
|
yaml['defaults'][section] ||= {}
|
||||||
defaults = yaml['defaults'][section]
|
defaults = yaml['defaults'][section]
|
||||||
@ -520,7 +520,7 @@ module OneProvision
|
|||||||
when 'boolean'
|
when 'boolean'
|
||||||
next unless input['default']
|
next unless input['default']
|
||||||
|
|
||||||
next if %w[NO YES].include?(input['default'])
|
next if ['NO', 'YES'].include?(input['default'])
|
||||||
|
|
||||||
return [false, "default #{input['default']} is invalid"]
|
return [false, "default #{input['default']} is invalid"]
|
||||||
when 'list'
|
when 'list'
|
||||||
@ -720,7 +720,7 @@ module OneProvision
|
|||||||
answer = Base64.encode64(answer).strip.delete("\n")
|
answer = Base64.encode64(answer).strip.delete("\n")
|
||||||
end
|
end
|
||||||
when 'boolean'
|
when 'boolean'
|
||||||
until %w[YES NO].include?(answer)
|
until ['YES', 'NO'].include?(answer)
|
||||||
print "Bool `#{input['name']}` " \
|
print "Bool `#{input['name']}` " \
|
||||||
"(default=#{input['default']}): "
|
"(default=#{input['default']}): "
|
||||||
|
|
||||||
@ -730,7 +730,7 @@ module OneProvision
|
|||||||
# Add default in case no default value is given
|
# Add default in case no default value is given
|
||||||
answer = 'NO' if !answer || answer.empty?
|
answer = 'NO' if !answer || answer.empty?
|
||||||
|
|
||||||
unless %w[YES NO].include?(answer)
|
unless ['YES', 'NO'].include?(answer)
|
||||||
puts "Invalid boolean #{answer} " \
|
puts "Invalid boolean #{answer} " \
|
||||||
'boolean has to be YES or NO'
|
'boolean has to be YES or NO'
|
||||||
end
|
end
|
||||||
|
@ -49,7 +49,7 @@ module OneProvision
|
|||||||
@p_template['configuration'].to_yaml
|
@p_template['configuration'].to_yaml
|
||||||
) if @p_template['configuration']
|
) if @p_template['configuration']
|
||||||
|
|
||||||
reject = %w[im_mad vm_mad provision connection configuration count]
|
reject = ['im_mad', 'vm_mad', 'provision', 'connection', 'configuration', 'count']
|
||||||
|
|
||||||
Nokogiri::XML::Builder.new do |xml|
|
Nokogiri::XML::Builder.new do |xml|
|
||||||
xml.HOST do
|
xml.HOST do
|
||||||
|
@ -20,21 +20,21 @@ module OneProvision
|
|||||||
class Resource
|
class Resource
|
||||||
|
|
||||||
# Keys to remove from template
|
# Keys to remove from template
|
||||||
REJECT_KEYS = %w[meta]
|
REJECT_KEYS = ['meta']
|
||||||
|
|
||||||
# Valid keys in template evaluation
|
# Valid keys in template evaluation
|
||||||
EVAL_KEYS = %w[cluster
|
EVAL_KEYS = ['cluster',
|
||||||
datastore
|
'datastore',
|
||||||
host
|
'host',
|
||||||
image
|
'image',
|
||||||
network
|
'network',
|
||||||
template
|
'template',
|
||||||
vntemplate
|
'vntemplate',
|
||||||
marketplaceapp]
|
'marketplaceapp']
|
||||||
|
|
||||||
S_EVAL_KEYS = %w[index
|
S_EVAL_KEYS = ['index',
|
||||||
provision
|
'provision',
|
||||||
provision_id]
|
'provision_id']
|
||||||
|
|
||||||
# @one ONE object
|
# @one ONE object
|
||||||
# @pool ONE pool
|
# @pool ONE pool
|
||||||
|
@ -25,7 +25,7 @@ module OneProvision
|
|||||||
DEFAULT_TIMEOUT = 60
|
DEFAULT_TIMEOUT = 60
|
||||||
|
|
||||||
# Supported wait modes
|
# Supported wait modes
|
||||||
SUPPORTED_MODES = %w[true false]
|
SUPPORTED_MODES = ['true', 'false']
|
||||||
|
|
||||||
# Delete object
|
# Delete object
|
||||||
def delete(_ = nil, _ = nil, _ = nil)
|
def delete(_ = nil, _ = nil, _ = nil)
|
||||||
|
@ -32,7 +32,7 @@ module OneProvision
|
|||||||
:network => 'aws_subnet'
|
:network => 'aws_subnet'
|
||||||
}
|
}
|
||||||
|
|
||||||
KEYS = %w[access_key secret_key region]
|
KEYS = ['access_key', 'secret_key', 'region']
|
||||||
|
|
||||||
# Class constructor
|
# Class constructor
|
||||||
#
|
#
|
||||||
|
@ -32,7 +32,7 @@ module OneProvision
|
|||||||
:network => ''
|
:network => ''
|
||||||
}
|
}
|
||||||
|
|
||||||
KEYS = %w[token region]
|
KEYS = ['token', 'region']
|
||||||
|
|
||||||
# Class constructor
|
# Class constructor
|
||||||
#
|
#
|
||||||
|
@ -31,7 +31,7 @@ module OneProvision
|
|||||||
:network => 'packet_reserved_ip_block'
|
:network => 'packet_reserved_ip_block'
|
||||||
}
|
}
|
||||||
|
|
||||||
KEYS = %w[project token facility]
|
KEYS = ['project', 'token', 'facility']
|
||||||
|
|
||||||
# Class constructor
|
# Class constructor
|
||||||
#
|
#
|
||||||
|
@ -32,7 +32,7 @@ module OneProvision
|
|||||||
:network => ''
|
:network => ''
|
||||||
}
|
}
|
||||||
|
|
||||||
KEYS = %w[credentials project region zone]
|
KEYS = ['credentials', 'project', 'region', 'zone']
|
||||||
|
|
||||||
# Class constructor
|
# Class constructor
|
||||||
#
|
#
|
||||||
|
@ -33,7 +33,7 @@ module OneProvision
|
|||||||
# Vultr Terraform Provider
|
# Vultr Terraform Provider
|
||||||
class Vultr < Terraform
|
class Vultr < Terraform
|
||||||
|
|
||||||
KEYS = %w[key region]
|
KEYS = ['key', 'region']
|
||||||
|
|
||||||
# Class constructor
|
# Class constructor
|
||||||
#
|
#
|
||||||
|
@ -33,15 +33,15 @@ class BaseExporter
|
|||||||
:destination_user => nil
|
:destination_user => nil
|
||||||
}
|
}
|
||||||
|
|
||||||
VALID_STATES = %w[ACTIVE
|
VALID_STATES = ['ACTIVE',
|
||||||
POWEROFF
|
'POWEROFF',
|
||||||
UNDEPLOYED]
|
'UNDEPLOYED']
|
||||||
|
|
||||||
VALID_LCM_STATES = %w[LCM_INIT
|
VALID_LCM_STATES = ['LCM_INIT',
|
||||||
RUNNING
|
'RUNNING',
|
||||||
BACKUP
|
'BACKUP',
|
||||||
BACKUP_POWEROFF
|
'BACKUP_POWEROFF',
|
||||||
BACKUP_UNDEPLOYED]
|
'BACKUP_UNDEPLOYED']
|
||||||
|
|
||||||
def initialize(vm, config)
|
def initialize(vm, config)
|
||||||
@vm = vm
|
@vm = vm
|
||||||
|
@ -29,11 +29,11 @@ class BaseRestorer
|
|||||||
# Constants
|
# Constants
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
VALID_STATES = %w[DONE
|
VALID_STATES = ['DONE',
|
||||||
POWEROFF
|
'POWEROFF',
|
||||||
UNDEPLOYED]
|
'UNDEPLOYED']
|
||||||
|
|
||||||
VALID_LCM_STATES = %w[LCM_INIT]
|
VALID_LCM_STATES = ['LCM_INIT']
|
||||||
|
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
# Default configuration options
|
# Default configuration options
|
||||||
@ -138,15 +138,13 @@ class BaseRestorer
|
|||||||
template << "DESCRIPTION = \"VM restored from backup.\"\n"
|
template << "DESCRIPTION = \"VM restored from backup.\"\n"
|
||||||
|
|
||||||
# Add disks
|
# Add disks
|
||||||
disk_black_list = Set.new(%w[ALLOW_ORPHANS CLONE CLONE_TARGET
|
disk_black_list = Set.new(['ALLOW_ORPHANS', 'CLONE', 'CLONE_TARGET', 'CLUSTER_ID',
|
||||||
CLUSTER_ID DATASTORE DATASTORE_ID
|
'DATASTORE', 'DATASTORE_ID', 'DEV_PREFIX', 'DISK_ID',
|
||||||
DEV_PREFIX DISK_ID
|
'DISK_SNAPSHOT_TOTAL_SIZE', 'DISK_TYPE', 'DRIVER',
|
||||||
DISK_SNAPSHOT_TOTAL_SIZE DISK_TYPE
|
'IMAGE', 'IMAGE_ID', 'IMAGE_STATE', 'IMAGE_UID',
|
||||||
DRIVER IMAGE IMAGE_ID IMAGE_STATE
|
'IMAGE_UNAME', 'LN_TARGET', 'OPENNEBULA_MANAGED',
|
||||||
IMAGE_UID IMAGE_UNAME LN_TARGET
|
'ORIGINAL_SIZE', 'PERSISTENT', 'READONLY', 'SAVE',
|
||||||
OPENNEBULA_MANAGED ORIGINAL_SIZE
|
'SIZE', 'SOURCE', 'TARGET', 'TM_MAD', 'TYPE'])
|
||||||
PERSISTENT READONLY SAVE SIZE SOURCE
|
|
||||||
TARGET TM_MAD TYPE])
|
|
||||||
new_disks.each do |disk|
|
new_disks.each do |disk|
|
||||||
disk_xpath = "/VM//DISK[DISK_ID = #{disk[:id]}]/*"
|
disk_xpath = "/VM//DISK[DISK_ID = #{disk[:id]}]/*"
|
||||||
disk_tmpl = "DISK = [\n"
|
disk_tmpl = "DISK = [\n"
|
||||||
@ -164,11 +162,11 @@ class BaseRestorer
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Add NICs
|
# Add NICs
|
||||||
nic_black_list = Set.new(%w[AR_ID BRIDGE BRIDGE_TYPE CLUSTER_ID IP
|
nic_black_list = Set.new(['AR_ID', 'BRIDGE', 'BRIDGE_TYPE', 'CLUSTER_ID', 'IP', 'IP6',
|
||||||
IP6 IP6_ULA IP6_GLOBAL NAME NETWORK_ID
|
'IP6_ULA', 'IP6_GLOBAL', 'NAME', 'NETWORK_ID', 'NIC_ID',
|
||||||
NIC_ID TARGET VLAN_ID VN_MAD])
|
'TARGET', 'VLAN_ID', 'VN_MAD'])
|
||||||
if @config[:restore_nics]
|
if @config[:restore_nics]
|
||||||
%w[NIC NIC_ALIAS].each do |type|
|
['NIC', 'NIC_ALIAS'].each do |type|
|
||||||
vm_xml.xpath("/VM//#{type}").each do |nic|
|
vm_xml.xpath("/VM//#{type}").each do |nic|
|
||||||
nic_tmpl = "#{type} = [\n"
|
nic_tmpl = "#{type} = [\n"
|
||||||
|
|
||||||
@ -220,7 +218,7 @@ class BaseRestorer
|
|||||||
# subscribe to wait until every image is ready
|
# subscribe to wait until every image is ready
|
||||||
img_id = disk[:img].id
|
img_id = disk[:img].id
|
||||||
|
|
||||||
%w[READY ERROR].each do |i|
|
['READY', 'ERROR'].each do |i|
|
||||||
key = "EVENT IMAGE #{img_id}/#{i}/"
|
key = "EVENT IMAGE #{img_id}/#{i}/"
|
||||||
subscriber.setsockopt(ZMQ::SUBSCRIBE, key)
|
subscriber.setsockopt(ZMQ::SUBSCRIBE, key)
|
||||||
end
|
end
|
||||||
@ -239,7 +237,7 @@ class BaseRestorer
|
|||||||
img = OpenNebula::Image.new_with_id(id, client)
|
img = OpenNebula::Image.new_with_id(id, client)
|
||||||
img.info
|
img.info
|
||||||
|
|
||||||
next unless %w[READY ERROR].include?(img.state_str)
|
next unless ['READY', 'ERROR'].include?(img.state_str)
|
||||||
|
|
||||||
error = true if img.state_str.upcase == 'ERROR'
|
error = true if img.state_str.upcase == 'ERROR'
|
||||||
imgs_set.delete(id)
|
imgs_set.delete(id)
|
||||||
@ -256,7 +254,7 @@ class BaseRestorer
|
|||||||
match = key.match(%r{EVENT IMAGE (?<img_id>\d+)/(?<state>\S+)/})
|
match = key.match(%r{EVENT IMAGE (?<img_id>\d+)/(?<state>\S+)/})
|
||||||
img_id = Integer(match[:img_id])
|
img_id = Integer(match[:img_id])
|
||||||
|
|
||||||
%w[READY ERROR].each do |i|
|
['READY', 'ERROR'].each do |i|
|
||||||
key = "EVENT IMAGE #{img_id}/#{i}/"
|
key = "EVENT IMAGE #{img_id}/#{i}/"
|
||||||
subscriber.setsockopt(ZMQ::UNSUBSCRIBE, key)
|
subscriber.setsockopt(ZMQ::UNSUBSCRIBE, key)
|
||||||
end
|
end
|
||||||
|
@ -51,7 +51,7 @@ class SunstoneGuac < SunstoneRemoteConnections
|
|||||||
return error(400, error_message)
|
return error(400, error_message)
|
||||||
end
|
end
|
||||||
|
|
||||||
unless %w[vnc rdp ssh].include?(type_connection.downcase)
|
unless ['vnc', 'rdp', 'ssh'].include?(type_connection.downcase)
|
||||||
return error(400, 'Type connection not supported by Guacamole')
|
return error(400, 'Type connection not supported by Guacamole')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -176,13 +176,10 @@ class VmmAction
|
|||||||
|
|
||||||
# List of xpaths required by the VNM driver actions. TEMPLATE/NIC is
|
# List of xpaths required by the VNM driver actions. TEMPLATE/NIC is
|
||||||
# also required but added separately to the driver xml
|
# also required but added separately to the driver xml
|
||||||
XPATH_LIST = %w[
|
XPATH_LIST = [
|
||||||
ID DEPLOY_ID TEMPLATE/CONTEXT USER_TEMPLATE
|
'ID', 'DEPLOY_ID', 'TEMPLATE/CONTEXT', 'USER_TEMPLATE', 'TEMPLATE/SECURITY_GROUP_RULE',
|
||||||
TEMPLATE/SECURITY_GROUP_RULE
|
'HISTORY_RECORDS/HISTORY/HOSTNAME', 'HISTORY_RECORDS/HISTORY/HID',
|
||||||
HISTORY_RECORDS/HISTORY/HOSTNAME
|
'HISTORY_RECORDS/HISTORY/DS_ID', 'HISTORY_RECORDS/HISTORY/VM_MAD'
|
||||||
HISTORY_RECORDS/HISTORY/HID
|
|
||||||
HISTORY_RECORDS/HISTORY/DS_ID
|
|
||||||
HISTORY_RECORDS/HISTORY/VM_MAD
|
|
||||||
]
|
]
|
||||||
|
|
||||||
DRIVER_NAMES = {
|
DRIVER_NAMES = {
|
||||||
@ -209,7 +206,7 @@ class VmmAction
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
%w[NIC NIC_ALIAS].each do |r|
|
['NIC', 'NIC_ALIAS'].each do |r|
|
||||||
vm_template_xml.elements.each("TEMPLATE/#{r}") do |element|
|
vm_template_xml.elements.each("TEMPLATE/#{r}") do |element|
|
||||||
vn_mad = element.get_text('VN_MAD').to_s
|
vn_mad = element.get_text('VN_MAD').to_s
|
||||||
|
|
||||||
|
@ -89,10 +89,14 @@ class AzureDriver
|
|||||||
'OS Disk Write Operations/Sec'
|
'OS Disk Write Operations/Sec'
|
||||||
]
|
]
|
||||||
|
|
||||||
AZ_REQUIRED_PARAMS = %w[
|
AZ_REQUIRED_PARAMS = [
|
||||||
INSTANCE_TYPE
|
'INSTANCE_TYPE',
|
||||||
VM_USER VM_PASSWORD
|
'VM_USER',
|
||||||
IMAGE_PUBLISHER IMAGE_OFFER IMAGE_SKU IMAGE_VERSION
|
'VM_PASSWORD',
|
||||||
|
'IMAGE_PUBLISHER',
|
||||||
|
'IMAGE_OFFER',
|
||||||
|
'IMAGE_SKU',
|
||||||
|
'IMAGE_VERSION'
|
||||||
]
|
]
|
||||||
|
|
||||||
STATE_MAP = {
|
STATE_MAP = {
|
||||||
@ -225,7 +229,7 @@ class AzureDriver
|
|||||||
unless @resource_client.resource_groups
|
unless @resource_client.resource_groups
|
||||||
.check_existence(@rgroup_name)
|
.check_existence(@rgroup_name)
|
||||||
|
|
||||||
if %w[BOOT BOOT_FAILURE].include?(lcm_state)
|
if ['BOOT', 'BOOT_FAILURE'].include?(lcm_state)
|
||||||
@defaults = load_default_template_values
|
@defaults = load_default_template_values
|
||||||
|
|
||||||
az_info, context = get_deployment_info(host, xml_text)
|
az_info, context = get_deployment_info(host, xml_text)
|
||||||
|
@ -25,7 +25,7 @@ require 'storageutils'
|
|||||||
class Qcow2Mapper
|
class Qcow2Mapper
|
||||||
|
|
||||||
QEMU_NBD_FORK_VERSION = '2.8.0'
|
QEMU_NBD_FORK_VERSION = '2.8.0'
|
||||||
CACHE_MODES = %w[none writethrough writeback directsync unsafe]
|
CACHE_MODES = ['none', 'writethrough', 'writeback', 'directsync', 'unsafe']
|
||||||
|
|
||||||
COMMANDS = {
|
COMMANDS = {
|
||||||
:map => 'sudo -n qemu-nbd --fork -c',
|
:map => 'sudo -n qemu-nbd --fork -c',
|
||||||
|
@ -127,7 +127,7 @@ end
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NSXV_RULE_BASE = 'xxx'
|
NSXV_RULE_BASE = 'xxx'
|
||||||
NSX_RULE_IPSEC_PORTS = %w[500 4500]
|
NSX_RULE_IPSEC_PORTS = ['500', '4500']
|
||||||
# Logical Ports
|
# Logical Ports
|
||||||
NSXT_LP_BASE = NSXT_BASE + '/logical-ports/'
|
NSXT_LP_BASE = NSXT_BASE + '/logical-ports/'
|
||||||
NSXV_LP_BASE = ''
|
NSXV_LP_BASE = ''
|
||||||
|
@ -743,9 +743,9 @@ module VCenterDriver
|
|||||||
image_path = ''
|
image_path = ''
|
||||||
|
|
||||||
# Skip not relevant files
|
# Skip not relevant files
|
||||||
next unless %w[FloppyImageFileInfo
|
next unless ['FloppyImageFileInfo',
|
||||||
IsoImageFileInfo
|
'IsoImageFileInfo',
|
||||||
VmDiskFileInfo].include? image.class.to_s
|
'VmDiskFileInfo'].include? image.class.to_s
|
||||||
|
|
||||||
# Get image path and name
|
# Get image path and name
|
||||||
image_path << folderpath << image.path
|
image_path << folderpath << image.path
|
||||||
|
@ -109,7 +109,7 @@ module VCenterDriver
|
|||||||
def self.needs_unpack?(file_path)
|
def self.needs_unpack?(file_path)
|
||||||
type = get_type(file_path)
|
type = get_type(file_path)
|
||||||
type.gsub!(%r{^application/(x-)?}, '')
|
type.gsub!(%r{^application/(x-)?}, '')
|
||||||
%w[bzip2 gzip tar].include?(type)
|
['bzip2', 'gzip', 'tar'].include?(type)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.vcenter_file_info(file_path)
|
def self.vcenter_file_info(file_path)
|
||||||
|
@ -44,7 +44,7 @@ vnmad = File.basename(File.expand_path('..', File.dirname(__FILE__)))
|
|||||||
XPATH_NICS = "//TEMPLATE/NIC[VN_MAD='#{vnmad}']"
|
XPATH_NICS = "//TEMPLATE/NIC[VN_MAD='#{vnmad}']"
|
||||||
XPATH_HV = '//HISTORY/VM_MAD'
|
XPATH_HV = '//HISTORY/VM_MAD'
|
||||||
|
|
||||||
OVS_VN_MADS = %w[ovswitch ovswitch_vxlan]
|
OVS_VN_MADS = ['ovswitch', 'ovswitch_vxlan']
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ vnmad = File.basename(File.expand_path('..', File.dirname(__FILE__)))
|
|||||||
XPATH_NICS = "//TEMPLATE/NIC[VN_MAD='#{vnmad}']"
|
XPATH_NICS = "//TEMPLATE/NIC[VN_MAD='#{vnmad}']"
|
||||||
XPATH_HV = '//HISTORY/VM_MAD'
|
XPATH_HV = '//HISTORY/VM_MAD'
|
||||||
|
|
||||||
OVS_VN_MADS = %w[ovswitch ovswitch_vxlan]
|
OVS_VN_MADS = ['ovswitch', 'ovswitch_vxlan']
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user