mirror of
https://github.com/OpenNebula/one.git
synced 2024-12-22 13:33:52 +03:00
L #-: Change percentage for brackets
in ruby word array definitions
(cherry picked from commit 27a97b4ea6
)
This commit is contained in:
parent
e83ce716bb
commit
f0d462649d
@ -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_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}) " \
|
||||
'is not none or live-migrate'
|
||||
next
|
||||
|
@ -34,15 +34,15 @@ class Sudoers
|
||||
'ip route *',
|
||||
'ip neighbour *'
|
||||
],
|
||||
:LVM => %w[
|
||||
lvcreate lvremove lvs vgdisplay lvchange lvscan lvextend
|
||||
:LVM => [
|
||||
'lvcreate', 'lvremove', 'lvs', 'vgdisplay', 'lvchange', 'lvscan', 'lvextend'
|
||||
],
|
||||
:OVS => %w[ovs-ofctl ovs-vsctl],
|
||||
:CEPH => %w[rbd],
|
||||
:LXD => %w[
|
||||
/snap/bin/lxc /usr/bin/catfstab mount umount mkdir lsblk losetup
|
||||
kpartx qemu-nbd blkid e2fsck resize2fs xfs_growfs rbd-nbd
|
||||
xfs_admin tune2fs
|
||||
:OVS => ['ovs-ofctl', 'ovs-vsctl'],
|
||||
:CEPH => ['rbd'],
|
||||
:LXD => [
|
||||
'/snap/bin/lxc', '/usr/bin/catfstab', 'mount', 'umount', 'mkdir', 'lsblk',
|
||||
'losetup', 'kpartx', 'qemu-nbd', 'blkid', 'e2fsck', 'resize2fs', 'xfs_growfs',
|
||||
'rbd-nbd', 'xfs_admin', 'tune2fs'
|
||||
],
|
||||
:HA => [
|
||||
'systemctl start opennebula-flow',
|
||||
@ -62,18 +62,18 @@ class Sudoers
|
||||
'arping',
|
||||
'ip address *'
|
||||
],
|
||||
:MARKET => %W[#{lib_location}/sh/create_container_image.sh
|
||||
#{lib_location}/sh/create_docker_image.sh ],
|
||||
:FIRECRACKER => %w[/usr/bin/jailer
|
||||
/usr/sbin/one-clean-firecracker-domain
|
||||
/usr/sbin/one-prepare-firecracker-domain],
|
||||
:LXC => %w[
|
||||
mount umount bindfs losetup qemu-nbd lxc-attach lxc-config
|
||||
lxc-create lxc-destroy lxc-info lxc-ls lxc-start lxc-stop
|
||||
lxc-console e2fsck resize2fs xfs_growfs rbd-nbd
|
||||
:MARKET => ["#{lib_location}/sh/create_container_image.sh",
|
||||
"#{lib_location}/sh/create_docker_image.sh"],
|
||||
:FIRECRACKER => ['/usr/bin/jailer',
|
||||
'/usr/sbin/one-clean-firecracker-domain',
|
||||
'/usr/sbin/one-prepare-firecracker-domain'],
|
||||
:LXC => [
|
||||
'mount', 'umount', 'bindfs', 'losetup', 'qemu-nbd', 'lxc-attach', 'lxc-config',
|
||||
'lxc-create', 'lxc-destroy', 'lxc-info', 'lxc-ls', 'lxc-start', 'lxc-stop',
|
||||
'lxc-console', 'e2fsck', 'resize2fs', 'xfs_growfs', 'rbd-nbd'
|
||||
],
|
||||
:MEM => ['sysctl vm.drop_caches=3 vm.compact_memory=1'],
|
||||
:VGPU => %w[sudo /var/tmp/one/vgpu]
|
||||
:VGPU => ['sudo', '/var/tmp/one/vgpu']
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -20,7 +20,7 @@ require 'csv'
|
||||
module CLIHelper
|
||||
|
||||
# Available operators for filtering operations
|
||||
FILTER_OPS = %w[= != < <= > >= ~]
|
||||
FILTER_OPS = ['=', '!=', '<', '<=', '>', '>=', '~']
|
||||
|
||||
# CLI general options
|
||||
LIST = {
|
||||
@ -182,23 +182,23 @@ module CLIHelper
|
||||
ANSI_YELLOW = "\33[33m"
|
||||
|
||||
# CLI states
|
||||
OK_STATES = %w[runn rdy on SUCCESS RUNNING]
|
||||
BAD_STATES = %w[fail
|
||||
err
|
||||
error
|
||||
ERROR
|
||||
FAILED_DEPLOYING
|
||||
FAILED_DEPLOYING_NETS
|
||||
FAILED_UNDEPLOYING
|
||||
FAILED_UNDEPLOYING_NETS
|
||||
FAILED_SCALING]
|
||||
REGULAR_STATES = %w[PENDING
|
||||
DEPLOYING
|
||||
DEPLOYING_NETS
|
||||
UNDEPLOYING
|
||||
UNDEPLOYING_NETS
|
||||
CONFIGURING
|
||||
WARNING]
|
||||
OK_STATES = ['runn', 'rdy', 'on', 'SUCCESS', 'RUNNING']
|
||||
BAD_STATES = ['fail',
|
||||
'err',
|
||||
'error',
|
||||
'ERROR',
|
||||
'FAILED_DEPLOYING',
|
||||
'FAILED_DEPLOYING_NETS',
|
||||
'FAILED_UNDEPLOYING',
|
||||
'FAILED_UNDEPLOYING_NETS',
|
||||
'FAILED_SCALING']
|
||||
REGULAR_STATES = ['PENDING',
|
||||
'DEPLOYING',
|
||||
'DEPLOYING_NETS',
|
||||
'UNDEPLOYING',
|
||||
'UNDEPLOYING_NETS',
|
||||
'CONFIGURING',
|
||||
'WARNING']
|
||||
|
||||
# Set state color
|
||||
#
|
||||
|
@ -297,7 +297,7 @@ class OneFlowHelper < OpenNebulaHelper::OneHelper
|
||||
|
||||
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
||||
|
||||
%w[OWNER GROUP OTHER].each do |e|
|
||||
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
||||
mask = '---'
|
||||
permissions_hash = document['PERMISSIONS']
|
||||
mask[0] = 'u' if permissions_hash["#{e}_U"] == '1'
|
||||
|
@ -157,7 +157,7 @@ class OneFlowTemplateHelper < OpenNebulaHelper::OneHelper
|
||||
|
||||
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
||||
|
||||
%w[OWNER GROUP OTHER].each do |e|
|
||||
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
||||
mask = '---'
|
||||
permissions_hash = document['PERMISSIONS']
|
||||
mask[0] = 'u' if permissions_hash["#{e}_U"] == '1'
|
||||
|
@ -460,10 +460,10 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
|
||||
n_elems = options[:n_elems] || 8
|
||||
|
||||
# Different available size units
|
||||
units = %w[K M G T]
|
||||
units = ['K', 'M', 'G', 'T']
|
||||
|
||||
# Attrs that need units conversion
|
||||
attrs = %w[FREE_MEMORY USED_MEMORY]
|
||||
attrs = ['FREE_MEMORY', 'USED_MEMORY']
|
||||
|
||||
if unit && !units.include?(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 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=[
|
||||
{
|
||||
@ -61,7 +61,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
|
||||
:format => String,
|
||||
:proc => lambda do |o, _options|
|
||||
prefix=o.strip.downcase
|
||||
if %w[hd sd xvd vd].include? prefix
|
||||
if ['hd', 'sd', 'xvd', 'vd'].include? prefix
|
||||
[0, prefix]
|
||||
else
|
||||
[-1, 'The prefix must be hd, sd, xvd or vd']
|
||||
@ -322,7 +322,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
|
||||
|
||||
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
||||
|
||||
%w[OWNER GROUP OTHER].each do |e|
|
||||
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
||||
mask = '---'
|
||||
mask[0] = 'u' if image["PERMISSIONS/#{e}_U"] == '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
|
||||
MARKETS = %w[http s3]
|
||||
MARKETS = ['http', 's3']
|
||||
|
||||
def self.rname
|
||||
'MARKETPLACEAPP'
|
||||
@ -413,7 +413,7 @@ class OneMarketPlaceAppHelper < OpenNebulaHelper::OneHelper
|
||||
|
||||
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
||||
|
||||
%w[OWNER GROUP OTHER].each do |e|
|
||||
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
||||
mask = '---'
|
||||
mask[0] = 'u' if app["PERMISSIONS/#{e}_U"] == '1'
|
||||
mask[1] = 'm' if app["PERMISSIONS/#{e}_M"] == '1'
|
||||
|
@ -58,20 +58,20 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
|
||||
#
|
||||
TABLE = {
|
||||
VOBJECT::DATASTORE => {
|
||||
:struct => %w[DATASTORE_LIST DATASTORE],
|
||||
:struct => ['DATASTORE_LIST', 'DATASTORE'],
|
||||
:columns =>
|
||||
{ :IMID => 5, :REF => 15, :NAME => 50, :CLUSTERS => 10 },
|
||||
:cli => [:host],
|
||||
:dialogue => ->(arg) {}
|
||||
},
|
||||
VOBJECT::TEMPLATE => {
|
||||
:struct => %w[TEMPLATE_LIST TEMPLATE],
|
||||
:struct => ['TEMPLATE_LIST', 'TEMPLATE'],
|
||||
:columns => { :IMID => 5, :REF => 10, :NAME => 50 },
|
||||
:cli => [:host],
|
||||
:dialogue => ->(arg) { OneVcenterHelper.template_dialogue(arg) }
|
||||
},
|
||||
VOBJECT::NETWORK => {
|
||||
:struct => %w[NETWORK_LIST NETWORK],
|
||||
:struct => ['NETWORK_LIST', 'NETWORK'],
|
||||
:columns => {
|
||||
:IMID => 5,
|
||||
:REF => 15,
|
||||
@ -82,13 +82,13 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
|
||||
:dialogue => ->(arg) { OneVcenterHelper.network_dialogue(arg) }
|
||||
},
|
||||
VOBJECT::IMAGE => {
|
||||
:struct => %w[IMAGE_LIST IMAGE],
|
||||
:struct => ['IMAGE_LIST', 'IMAGE'],
|
||||
:columns => { :IMID => 5, :REF => 35, :PATH => 60 },
|
||||
:cli => [:host, :datastore],
|
||||
:dialogue => ->(arg) {}
|
||||
},
|
||||
VOBJECT::HOST => {
|
||||
:struct => %w[HOST_LIST HOST],
|
||||
:struct => ['HOST_LIST', 'HOST'],
|
||||
:columns => { :DATACENTER => 10, :NAME => 30, :REF => 35 },
|
||||
:cli => [],
|
||||
:dialogue => ->(arg) {}
|
||||
@ -471,7 +471,7 @@ class OneVcenterHelper < OpenNebulaHelper::OneHelper
|
||||
' do you want to create (IPv[4],IPv[6], [E]thernet)? '
|
||||
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)
|
||||
type_answer = 'e'
|
||||
STDOUT.puts " Type [#{type_answer}] not supported,"\
|
||||
|
@ -367,7 +367,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
|
||||
|
||||
CLIHelper.print_header(str_h1 % 'PERMISSIONS', false)
|
||||
|
||||
%w[OWNER GROUP OTHER].each do |e|
|
||||
['OWNER', 'GROUP', 'OTHER'].each do |e|
|
||||
mask = '---'
|
||||
mask[0] = 'u' if vn["PERMISSIONS/#{e}_U"] == '1'
|
||||
mask[1] = 'm' if vn["PERMISSIONS/#{e}_M"] == '1'
|
||||
|
@ -351,7 +351,7 @@ CommandParser::CmdParser.new(ARGV) do
|
||||
|
||||
(OneProvision::Provision::RESOURCES +
|
||||
OneProvision::Provision::FULL_CLUSTER -
|
||||
%w[hosts marketplaceapps flowtemplates]).each do |resource|
|
||||
['hosts', 'marketplaceapps', 'flowtemplates']).each do |resource|
|
||||
list_desc = <<-EOT
|
||||
List all available #{resource}
|
||||
EOT
|
||||
@ -368,7 +368,7 @@ CommandParser::CmdParser.new(ARGV) do
|
||||
|
||||
(OneProvision::Provision::RESOURCES +
|
||||
OneProvision::Provision::FULL_CLUSTER -
|
||||
%w[hosts marketplaceapps]).each do |resource|
|
||||
['hosts', 'marketplaceapps']).each do |resource|
|
||||
delete_desc = <<-EOT
|
||||
Deletes and unprovisions the given #{resource}
|
||||
EOT
|
||||
|
@ -604,7 +604,7 @@ CommandParser::CmdParser.new(ARGV) do
|
||||
|
||||
command :passwdsearch, passwdsearch_desc, :driver, :password,
|
||||
: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]}"]
|
||||
|
||||
helper.list_pool(options)
|
||||
|
@ -258,7 +258,7 @@ CommandParser::CmdParser.new(ARGV) do
|
||||
}
|
||||
|
||||
OpenNebulaHelper::TEMPLATE_OPTIONS_VM.delete_if do |v|
|
||||
%w[as_gid as_uid].include?(v[:name])
|
||||
['as_gid', 'as_uid'].include?(v[:name])
|
||||
end
|
||||
|
||||
########################################################################
|
||||
|
@ -40,28 +40,28 @@ class EventManager
|
||||
:wait_release_action
|
||||
]
|
||||
|
||||
FAILURE_STATES = %w[
|
||||
BOOT_FAILURE
|
||||
BOOT_MIGRATE_FAILURE
|
||||
PROLOG_MIGRATE_FAILURE
|
||||
PROLOG_FAILURE
|
||||
EPILOG_FAILURE
|
||||
EPILOG_STOP_FAILURE
|
||||
EPILOG_UNDEPLOY_FAILURE
|
||||
PROLOG_MIGRATE_POWEROFF_FAILURE
|
||||
PROLOG_MIGRATE_SUSPEND_FAILURE
|
||||
PROLOG_MIGRATE_UNKNOWN_FAILURE
|
||||
BOOT_UNDEPLOY_FAILURE
|
||||
BOOT_STOPPED_FAILURE
|
||||
PROLOG_RESUME_FAILURE
|
||||
PROLOG_UNDEPLOY_FAILURE
|
||||
FAILURE_STATES = [
|
||||
'BOOT_FAILURE',
|
||||
'BOOT_MIGRATE_FAILURE',
|
||||
'PROLOG_MIGRATE_FAILURE',
|
||||
'PROLOG_FAILURE',
|
||||
'EPILOG_FAILURE',
|
||||
'EPILOG_STOP_FAILURE',
|
||||
'EPILOG_UNDEPLOY_FAILURE',
|
||||
'PROLOG_MIGRATE_POWEROFF_FAILURE',
|
||||
'PROLOG_MIGRATE_SUSPEND_FAILURE',
|
||||
'PROLOG_MIGRATE_UNKNOWN_FAILURE',
|
||||
'BOOT_UNDEPLOY_FAILURE',
|
||||
'BOOT_STOPPED_FAILURE',
|
||||
'PROLOG_RESUME_FAILURE',
|
||||
'PROLOG_UNDEPLOY_FAILURE'
|
||||
]
|
||||
|
||||
SUBSCRIBE_STATES = %w[
|
||||
STOPPED
|
||||
SUSPENDED
|
||||
POWEROFF
|
||||
UNDEPLOYED
|
||||
SUBSCRIBE_STATES = [
|
||||
'STOPPED',
|
||||
'SUSPENDED',
|
||||
'POWEROFF',
|
||||
'UNDEPLOYED'
|
||||
]
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
|
@ -36,9 +36,9 @@ class ServiceWD
|
||||
############################################################################
|
||||
# WARNING STATES
|
||||
############################################################################
|
||||
WARNING_STATES = %w[
|
||||
POWEROFF
|
||||
UNKNOWN
|
||||
WARNING_STATES = [
|
||||
'POWEROFF',
|
||||
'UNKNOWN'
|
||||
] + EventManager::FAILURE_STATES
|
||||
|
||||
# Class constructor
|
||||
|
@ -32,26 +32,26 @@ module OpenNebula
|
||||
attr_reader :service
|
||||
|
||||
# Actions that can be performed on the VMs of a given Role
|
||||
SCHEDULE_ACTIONS = %w[
|
||||
terminate
|
||||
terminate-hard
|
||||
undeploy
|
||||
undeploy-hard
|
||||
hold
|
||||
release
|
||||
stop
|
||||
suspend
|
||||
resume
|
||||
reboot
|
||||
reboot-hard
|
||||
poweroff
|
||||
poweroff-hard
|
||||
snapshot-create
|
||||
snapshot-revert
|
||||
snapshot-delete
|
||||
disk-snapshot-create
|
||||
disk-snapshot-revert
|
||||
disk-snapshot-delete
|
||||
SCHEDULE_ACTIONS = [
|
||||
'terminate',
|
||||
'terminate-hard',
|
||||
'undeploy',
|
||||
'undeploy-hard',
|
||||
'hold',
|
||||
'release',
|
||||
'stop',
|
||||
'suspend',
|
||||
'resume',
|
||||
'reboot',
|
||||
'reboot-hard',
|
||||
'poweroff',
|
||||
'poweroff-hard',
|
||||
'snapshot-create',
|
||||
'snapshot-revert',
|
||||
'snapshot-delete',
|
||||
'disk-snapshot-create',
|
||||
'disk-snapshot-revert',
|
||||
'disk-snapshot-delete'
|
||||
]
|
||||
|
||||
STATE = {
|
||||
@ -69,52 +69,52 @@ module OpenNebula
|
||||
'HOLD' => 11
|
||||
}
|
||||
|
||||
STATE_STR = %w[
|
||||
PENDING
|
||||
DEPLOYING
|
||||
RUNNING
|
||||
UNDEPLOYING
|
||||
WARNING
|
||||
DONE
|
||||
FAILED_UNDEPLOYING
|
||||
FAILED_DEPLOYING
|
||||
SCALING
|
||||
FAILED_SCALING
|
||||
COOLDOWN
|
||||
HOLD
|
||||
STATE_STR = [
|
||||
'PENDING',
|
||||
'DEPLOYING',
|
||||
'RUNNING',
|
||||
'UNDEPLOYING',
|
||||
'WARNING',
|
||||
'DONE',
|
||||
'FAILED_UNDEPLOYING',
|
||||
'FAILED_DEPLOYING',
|
||||
'SCALING',
|
||||
'FAILED_SCALING',
|
||||
'COOLDOWN',
|
||||
'HOLD'
|
||||
]
|
||||
|
||||
RECOVER_DEPLOY_STATES = %w[
|
||||
FAILED_DEPLOYING
|
||||
DEPLOYING
|
||||
PENDING
|
||||
RECOVER_DEPLOY_STATES = [
|
||||
'FAILED_DEPLOYING',
|
||||
'DEPLOYING',
|
||||
'PENDING'
|
||||
]
|
||||
|
||||
RECOVER_UNDEPLOY_STATES = %w[
|
||||
FAILED_UNDEPLOYING
|
||||
UNDEPLOYING
|
||||
RECOVER_UNDEPLOY_STATES = [
|
||||
'FAILED_UNDEPLOYING',
|
||||
'UNDEPLOYING'
|
||||
]
|
||||
|
||||
RECOVER_SCALE_STATES = %w[
|
||||
FAILED_SCALING
|
||||
SCALING
|
||||
RECOVER_SCALE_STATES = [
|
||||
'FAILED_SCALING',
|
||||
'SCALING'
|
||||
]
|
||||
|
||||
VM_FAILURE_STATES = %w[
|
||||
BOOT_FAILURE
|
||||
BOOT_MIGRATE_FAILURE
|
||||
PROLOG_MIGRATE_FAILURE
|
||||
PROLOG_FAILURE
|
||||
EPILOG_FAILURE
|
||||
EPILOG_STOP_FAILURE
|
||||
EPILOG_UNDEPLOY_FAILURE
|
||||
PROLOG_MIGRATE_POWEROFF_FAILURE
|
||||
PROLOG_MIGRATE_SUSPEND_FAILURE
|
||||
PROLOG_MIGRATE_UNKNOWN_FAILURE
|
||||
BOOT_UNDEPLOY_FAILURE
|
||||
BOOT_STOPPED_FAILURE
|
||||
PROLOG_RESUME_FAILURE
|
||||
PROLOG_UNDEPLOY_FAILURE
|
||||
VM_FAILURE_STATES = [
|
||||
'BOOT_FAILURE',
|
||||
'BOOT_MIGRATE_FAILURE',
|
||||
'PROLOG_MIGRATE_FAILURE',
|
||||
'PROLOG_FAILURE',
|
||||
'EPILOG_FAILURE',
|
||||
'EPILOG_STOP_FAILURE',
|
||||
'EPILOG_UNDEPLOY_FAILURE',
|
||||
'PROLOG_MIGRATE_POWEROFF_FAILURE',
|
||||
'PROLOG_MIGRATE_SUSPEND_FAILURE',
|
||||
'PROLOG_MIGRATE_UNKNOWN_FAILURE',
|
||||
'BOOT_UNDEPLOY_FAILURE',
|
||||
'BOOT_STOPPED_FAILURE',
|
||||
'PROLOG_RESUME_FAILURE',
|
||||
'PROLOG_UNDEPLOY_FAILURE'
|
||||
]
|
||||
|
||||
SCALE_WAYS = {
|
||||
@ -129,17 +129,17 @@ module OpenNebula
|
||||
# parents: this has only sense in deploy operation
|
||||
# state: this is internal information managed by OneFlow server
|
||||
# vm_template: this will affect scale operation
|
||||
IMMUTABLE_ATTRS = %w[
|
||||
cardinality
|
||||
last_vmname
|
||||
nodes
|
||||
parents
|
||||
state
|
||||
vm_template
|
||||
IMMUTABLE_ATTRS = [
|
||||
'cardinality',
|
||||
'last_vmname',
|
||||
'nodes',
|
||||
'parents',
|
||||
'state',
|
||||
'vm_template'
|
||||
]
|
||||
|
||||
# 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'
|
||||
|
||||
|
@ -42,64 +42,64 @@ module OpenNebula
|
||||
'HOLD' => 15
|
||||
}
|
||||
|
||||
STATE_STR = %w[
|
||||
PENDING
|
||||
DEPLOYING
|
||||
RUNNING
|
||||
UNDEPLOYING
|
||||
WARNING
|
||||
DONE
|
||||
FAILED_UNDEPLOYING
|
||||
FAILED_DEPLOYING
|
||||
SCALING
|
||||
FAILED_SCALING
|
||||
COOLDOWN
|
||||
DEPLOYING_NETS
|
||||
UNDEPLOYING_NETS
|
||||
FAILED_DEPLOYING_NETS
|
||||
FAILED_UNDEPLOYING_NETS
|
||||
HOLD
|
||||
STATE_STR = [
|
||||
'PENDING',
|
||||
'DEPLOYING',
|
||||
'RUNNING',
|
||||
'UNDEPLOYING',
|
||||
'WARNING',
|
||||
'DONE',
|
||||
'FAILED_UNDEPLOYING',
|
||||
'FAILED_DEPLOYING',
|
||||
'SCALING',
|
||||
'FAILED_SCALING',
|
||||
'COOLDOWN',
|
||||
'DEPLOYING_NETS',
|
||||
'UNDEPLOYING_NETS',
|
||||
'FAILED_DEPLOYING_NETS',
|
||||
'FAILED_UNDEPLOYING_NETS',
|
||||
'HOLD'
|
||||
]
|
||||
|
||||
TRANSIENT_STATES = %w[
|
||||
DEPLOYING
|
||||
UNDEPLOYING
|
||||
SCALING
|
||||
COOLDOWN
|
||||
DEPLOYING_NETS
|
||||
UNDEPLOYING_NETS
|
||||
TRANSIENT_STATES = [
|
||||
'DEPLOYING',
|
||||
'UNDEPLOYING',
|
||||
'SCALING',
|
||||
'COOLDOWN',
|
||||
'DEPLOYING_NETS',
|
||||
'UNDEPLOYING_NETS'
|
||||
]
|
||||
|
||||
FAILED_STATES = %w[
|
||||
FAILED_DEPLOYING
|
||||
FAILED_UNDEPLOYING
|
||||
FAILED_SCALING
|
||||
FAILED_DEPLOYING_NETS
|
||||
FAILED_UNDEPLOYING_NETS
|
||||
FAILED_STATES = [
|
||||
'FAILED_DEPLOYING',
|
||||
'FAILED_UNDEPLOYING',
|
||||
'FAILED_SCALING',
|
||||
'FAILED_DEPLOYING_NETS',
|
||||
'FAILED_UNDEPLOYING_NETS'
|
||||
]
|
||||
|
||||
RECOVER_DEPLOY_STATES = %w[
|
||||
FAILED_DEPLOYING
|
||||
DEPLOYING
|
||||
PENDING
|
||||
RECOVER_DEPLOY_STATES = [
|
||||
'FAILED_DEPLOYING',
|
||||
'DEPLOYING',
|
||||
'PENDING'
|
||||
]
|
||||
|
||||
RECOVER_UNDEPLOY_STATES = %w[
|
||||
FAILED_UNDEPLOYING
|
||||
UNDEPLOYING
|
||||
FAILED_UNDEPLOYING_NETS
|
||||
RECOVER_UNDEPLOY_STATES = [
|
||||
'FAILED_UNDEPLOYING',
|
||||
'UNDEPLOYING',
|
||||
'FAILED_UNDEPLOYING_NETS'
|
||||
]
|
||||
|
||||
RECOVER_SCALE_STATES = %w[
|
||||
FAILED_SCALING
|
||||
SCALING
|
||||
RECOVER_SCALE_STATES = [
|
||||
'FAILED_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[
|
||||
UNDEPLOYING_NETS
|
||||
FAILED_UNDEPLOYING_NETS
|
||||
RECOVER_UNDEPLOY_NETS_STATES = [
|
||||
'UNDEPLOYING_NETS',
|
||||
'FAILED_UNDEPLOYING_NETS'
|
||||
]
|
||||
|
||||
# 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
|
||||
# state: this is internal information managed by OneFlow server
|
||||
# start_time: this is internal information managed by OneFlow server
|
||||
IMMUTABLE_ATTRS = %w[
|
||||
custom_attrs
|
||||
custom_attrs_values
|
||||
deployment
|
||||
log
|
||||
name
|
||||
networks
|
||||
networks_values
|
||||
ready_status_gate
|
||||
state
|
||||
start_time
|
||||
IMMUTABLE_ATTRS = [
|
||||
'custom_attrs',
|
||||
'custom_attrs_values',
|
||||
'deployment',
|
||||
'log',
|
||||
'name',
|
||||
'networks',
|
||||
'networks_values',
|
||||
'ready_status_gate',
|
||||
'state',
|
||||
'start_time'
|
||||
]
|
||||
|
||||
LOG_COMP = 'SER'
|
||||
@ -680,7 +680,7 @@ module OpenNebula
|
||||
vnet.each do |_, net|
|
||||
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(
|
||||
net['id'],
|
||||
|
@ -149,7 +149,7 @@ end
|
||||
#-------------------------------------------------------------------------------
|
||||
# Script helper functions and gLobals
|
||||
#-------------------------------------------------------------------------------
|
||||
LOCAL_HYPERVISOR = %w[az ec2 one equinix].freeze
|
||||
LOCAL_HYPERVISOR = ['az', 'ec2', 'one', 'equinix'].freeze
|
||||
|
||||
def local?(hypervisor)
|
||||
LOCAL_HYPERVISOR.include?(hypervisor)
|
||||
|
@ -21,7 +21,7 @@ require 'open3'
|
||||
ENV['LANG'] = 'C'
|
||||
ENV['LC_ALL'] = 'C'
|
||||
|
||||
GUEST_ARCHS = %w[i686 x86_64]
|
||||
GUEST_ARCHS = ['i686', 'x86_64']
|
||||
|
||||
begin
|
||||
machines = []
|
||||
|
@ -64,8 +64,8 @@ class BaseDomain
|
||||
Base64.strict_encode64(mon_s)
|
||||
end
|
||||
|
||||
MONITOR_KEYS = %w[cpu memory netrx nettx diskrdbytes diskwrbytes diskrdiops
|
||||
diskwriops]
|
||||
MONITOR_KEYS = ['cpu', 'memory', 'netrx', 'nettx', 'diskrdbytes', 'diskwrbytes', 'diskrdiops',
|
||||
'diskwriops']
|
||||
|
||||
end
|
||||
|
||||
|
@ -28,8 +28,8 @@ require 'openssl'
|
||||
class MonitorClient
|
||||
|
||||
# Defined in src/monitor/include/MonitorDriverMessages.h
|
||||
MESSAGE_TYPES = %w[MONITOR_VM MONITOR_HOST SYSTEM_HOST BEACON_HOST STATE_VM
|
||||
START_MONITOR STOP_MONITOR].freeze
|
||||
MESSAGE_TYPES = ['MONITOR_VM', 'MONITOR_HOST', 'SYSTEM_HOST', 'BEACON_HOST', 'STATE_VM',
|
||||
'START_MONITOR', 'STOP_MONITOR'].freeze
|
||||
|
||||
MESSAGE_STATUS = { true =>'SUCCESS', false => 'FAILURE' }.freeze
|
||||
|
||||
|
@ -75,7 +75,7 @@ module NUMA
|
||||
hp_info = { 'size' => hp_size }
|
||||
|
||||
begin
|
||||
%w[free nr surplus].each do |var|
|
||||
['free', 'nr', 'surplus'].each do |var|
|
||||
var_path = "#{hpsz_path}/#{var}_hugepages"
|
||||
hp_info[var] = File.read(var_path).chomp
|
||||
end
|
||||
@ -102,7 +102,7 @@ module NUMA
|
||||
|
||||
bind = binding
|
||||
|
||||
mem_vars = %w[MemTotal MemFree MemUsed]
|
||||
mem_vars = ['MemTotal', 'MemFree', 'MemUsed']
|
||||
|
||||
# rubocop:disable Style/DocumentDynamicEvalDefinition
|
||||
mem_vars.each {|var| bind.eval("#{var.downcase.to_sym} = 0") }
|
||||
|
@ -110,7 +110,7 @@ require 'oneprovision'
|
||||
require 'ipaddr'
|
||||
require 'digest'
|
||||
|
||||
IP_TYPE = %w[public_ipv4 global_ipv4]
|
||||
IP_TYPE = ['public_ipv4', 'global_ipv4']
|
||||
|
||||
DEFAULT_PRIVATE_CIDR = '172.16.0.0/12'
|
||||
|
||||
|
@ -111,7 +111,7 @@ require 'opennebula'
|
||||
require 'oneprovision'
|
||||
require 'vultr'
|
||||
|
||||
IP_TYPE = %w[v4 v6]
|
||||
IP_TYPE = ['v4', 'v6']
|
||||
|
||||
DEFAULT_PRIVATE_CIDR = '172.16.0.0/12'
|
||||
|
||||
|
@ -49,8 +49,8 @@ class LinuxContainersMarket
|
||||
:fs => 'ext4',
|
||||
:format => 'raw',
|
||||
:agent => 'OpenNebula',
|
||||
:tested_apps => %w[alpine alt centos rockylinux almalinux oracle debian
|
||||
ubuntu fedora devuan],
|
||||
:tested_apps => ['alpine', 'alt', 'centos', 'rockylinux', 'almalinux', 'oracle', 'debian',
|
||||
'ubuntu', 'fedora', 'devuan'],
|
||||
:skip_untested => 'yes',
|
||||
:memory => '768',
|
||||
:cpu => 1,
|
||||
|
@ -60,11 +60,11 @@ module OpenNebula
|
||||
},
|
||||
'shutdown_action' => {
|
||||
:type => :string,
|
||||
:enum => %w[
|
||||
terminate
|
||||
terminate-hard
|
||||
shutdown
|
||||
shutdown-hard
|
||||
:enum => [
|
||||
'terminate',
|
||||
'terminate-hard',
|
||||
'shutdown',
|
||||
'shutdown-hard'
|
||||
],
|
||||
:required => false
|
||||
},
|
||||
@ -94,10 +94,10 @@ module OpenNebula
|
||||
:properties => {
|
||||
'type' => {
|
||||
:type => :string,
|
||||
:enum => %w[
|
||||
CHANGE
|
||||
CARDINALITY
|
||||
PERCENTAGE_CHANGE
|
||||
:enum => [
|
||||
'CHANGE',
|
||||
'CARDINALITY',
|
||||
'PERCENTAGE_CHANGE'
|
||||
],
|
||||
:required => true
|
||||
},
|
||||
@ -143,10 +143,10 @@ module OpenNebula
|
||||
:properties => {
|
||||
'type' => {
|
||||
:type => :string,
|
||||
:enum => %w[
|
||||
CHANGE
|
||||
CARDINALITY
|
||||
PERCENTAGE_CHANGE
|
||||
:enum => [
|
||||
'CHANGE',
|
||||
'CARDINALITY',
|
||||
'PERCENTAGE_CHANGE'
|
||||
],
|
||||
:required => true
|
||||
},
|
||||
@ -182,7 +182,7 @@ module OpenNebula
|
||||
},
|
||||
'deployment' => {
|
||||
:type => :string,
|
||||
:enum => %w[none straight],
|
||||
:enum => ['none', 'straight'],
|
||||
:default => 'none'
|
||||
},
|
||||
'description' => {
|
||||
@ -191,11 +191,11 @@ module OpenNebula
|
||||
},
|
||||
'shutdown_action' => {
|
||||
:type => :string,
|
||||
:enum => %w[
|
||||
terminate
|
||||
terminate-hard
|
||||
shutdown
|
||||
shutdown-hard
|
||||
:enum => [
|
||||
'terminate',
|
||||
'terminate-hard',
|
||||
'shutdown',
|
||||
'shutdown-hard'
|
||||
],
|
||||
:required => false
|
||||
},
|
||||
@ -245,8 +245,8 @@ module OpenNebula
|
||||
# List of attributes that can't be changed in update operation
|
||||
#
|
||||
# registration_time: this is internal info managed by OneFlow server
|
||||
IMMUTABLE_ATTRS = %w[
|
||||
registration_time
|
||||
IMMUTABLE_ATTRS = [
|
||||
'registration_time'
|
||||
]
|
||||
|
||||
def self.init_default_vn_name_template(vn_name_template)
|
||||
|
@ -314,9 +314,9 @@ module OpenNebula::MarketPlaceAppExt
|
||||
# @param image [OpenNebula::Image] Image information
|
||||
def create_vcenter_template(ds, options, template, image = nil)
|
||||
ret = {}
|
||||
keys = %w[VCENTER_TEMPLATE_REF
|
||||
VCENTER_CCR_REF
|
||||
VCENTER_INSTANCE_ID]
|
||||
keys = ['VCENTER_TEMPLATE_REF',
|
||||
'VCENTER_CCR_REF',
|
||||
'VCENTER_INSTANCE_ID']
|
||||
|
||||
if ds['//VCENTER_TEMPLATE_REF']
|
||||
keys.each do |key|
|
||||
|
@ -79,7 +79,7 @@ module OpenNebula::TemplateExt
|
||||
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
|
||||
|
||||
rollback(ids)
|
||||
@ -204,7 +204,7 @@ module OpenNebula::TemplateExt
|
||||
# @param nic [XMLElement] to delete attributes from
|
||||
#-------------------------------------------------------------------
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
@ -47,17 +47,16 @@ module OpenNebula::VirtualMachineExt
|
||||
# @return [Integer, OpenNebula::Error] the new Template ID in case
|
||||
# of success, error otherwise
|
||||
#-------------------------------------------------------------------
|
||||
REMOVE_VNET_ATTRS = %w[AR_ID BRIDGE CLUSTER_ID IP MAC TARGET NIC_ID
|
||||
NETWORK_ID VN_MAD SECURITY_GROUPS VLAN_ID
|
||||
BRIDGE_TYPE]
|
||||
REMOVE_VNET_ATTRS = ['AR_ID', 'BRIDGE', 'CLUSTER_ID', 'IP', 'MAC', 'TARGET', 'NIC_ID',
|
||||
'NETWORK_ID', 'VN_MAD', 'SECURITY_GROUPS', 'VLAN_ID',
|
||||
'BRIDGE_TYPE']
|
||||
|
||||
REMOVE_IMAGE_ATTRS = %w[DEV_PREFIX SOURCE ORIGINAL_SIZE SIZE
|
||||
DISK_SNAPSHOT_TOTAL_SIZE DRIVER IMAGE_STATE
|
||||
SAVE CLONE READONLY PERSISTENT TARGET
|
||||
ALLOW_ORPHANS CLONE_TARGET CLUSTER_ID
|
||||
DATASTORE DATASTORE_ID DISK_ID DISK_TYPE
|
||||
IMAGE_ID IMAGE IMAGE_UNAME IMAGE_UID
|
||||
LN_TARGET TM_MAD TYPE OPENNEBULA_MANAGED]
|
||||
REMOVE_IMAGE_ATTRS = ['DEV_PREFIX', 'SOURCE', 'ORIGINAL_SIZE', 'SIZE',
|
||||
'DISK_SNAPSHOT_TOTAL_SIZE', 'DRIVER', 'IMAGE_STATE', 'SAVE',
|
||||
'CLONE', 'READONLY', 'PERSISTENT', 'TARGET', 'ALLOW_ORPHANS',
|
||||
'CLONE_TARGET', 'CLUSTER_ID', 'DATASTORE', 'DATASTORE_ID',
|
||||
'DISK_ID', 'DISK_TYPE', 'IMAGE_ID', 'IMAGE', 'IMAGE_UNAME',
|
||||
'IMAGE_UID', 'LN_TARGET', 'TM_MAD', 'TYPE', 'OPENNEBULA_MANAGED']
|
||||
|
||||
def save_as_template(name, desc, opts = {})
|
||||
opts = {
|
||||
|
@ -151,7 +151,7 @@ CommandParser::CmdParser.new(ARGV) do
|
||||
:format => String
|
||||
}
|
||||
|
||||
PATCH_FORMATS = %w[line yaml]
|
||||
PATCH_FORMATS = ['line', 'yaml']
|
||||
|
||||
begin
|
||||
require 'ee'
|
||||
|
@ -84,7 +84,7 @@ module OneCfg::Common
|
||||
# command
|
||||
parsed[:command].downcase!
|
||||
|
||||
if !%w[rm ins set].include?(parsed[:command])
|
||||
if !['rm', 'ins', 'set'].include?(parsed[:command])
|
||||
raise OneCfg::Exception::FileParseError,
|
||||
"Invalid patch action '#{parsed[:command]}'"
|
||||
end
|
||||
|
@ -197,7 +197,7 @@ module OneCfg::Config
|
||||
# @return [Hash] Filtered file data
|
||||
def file4desc(data)
|
||||
data.select do |k, _v|
|
||||
%w[class owner group mode].include?(k)
|
||||
['class', 'owner', 'group', 'mode'].include?(k)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -44,24 +44,22 @@ module OneCfg::Config::Type
|
||||
|
||||
# Parameters which are expected to be specified MULTIPLE
|
||||
# times in the main section of configuration file.
|
||||
MULTIPLE = %w[
|
||||
VM_RESTRICTED_ATTR
|
||||
IMAGE_RESTRICTED_ATTR
|
||||
VNET_RESTRICTED_ATTR
|
||||
USER_RESTRICTED_ATTR
|
||||
GROUP_RESTRICTED_ATTR
|
||||
|
||||
DOCUMENT_ENCRYPTED_ATTR
|
||||
HOST_ENCRYPTED_ATTR
|
||||
IMAGE_ENCRYPTED_ATTR
|
||||
VM_ENCRYPTED_ATTR
|
||||
VNET_ENCRYPTED_ATTR
|
||||
DATASTORE_ENCRYPTED_ATTR
|
||||
CLUSTER_ENCRYPTED_ATTR
|
||||
|
||||
INHERIT_DATASTORE_ATTR
|
||||
INHERIT_IMAGE_ATTR
|
||||
INHERIT_VNET_ATTR
|
||||
MULTIPLE = [
|
||||
'VM_RESTRICTED_ATTR',
|
||||
'IMAGE_RESTRICTED_ATTR',
|
||||
'VNET_RESTRICTED_ATTR',
|
||||
'USER_RESTRICTED_ATTR',
|
||||
'GROUP_RESTRICTED_ATTR',
|
||||
'DOCUMENT_ENCRYPTED_ATTR',
|
||||
'HOST_ENCRYPTED_ATTR',
|
||||
'IMAGE_ENCRYPTED_ATTR',
|
||||
'VM_ENCRYPTED_ATTR',
|
||||
'VNET_ENCRYPTED_ATTR',
|
||||
'DATASTORE_ENCRYPTED_ATTR',
|
||||
'CLUSTER_ENCRYPTED_ATTR',
|
||||
'INHERIT_DATASTORE_ATTR',
|
||||
'INHERIT_IMAGE_ATTR',
|
||||
'INHERIT_VNET_ATTR'
|
||||
]
|
||||
|
||||
# Class constructor
|
||||
|
@ -67,7 +67,7 @@ module OneDBFsck
|
||||
|
||||
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.content = etime if elem.text == '0'
|
||||
|
@ -272,7 +272,7 @@ module OneDBFsck
|
||||
|
||||
type = address_range.at_xpath('TYPE').text
|
||||
|
||||
if %w[IP6 IP4_6].include? type
|
||||
if ['IP6', 'IP4_6'].include? type
|
||||
ipv6[:link_prefix] = 0xfe80000000000000
|
||||
end
|
||||
|
||||
|
@ -272,7 +272,7 @@ module OneDBFsck
|
||||
size = e.at_xpath('SIZE').text.to_i
|
||||
end
|
||||
|
||||
if %w[SWAP FS].include? type
|
||||
if ['SWAP', 'FS'].include? type
|
||||
sys_used += size
|
||||
|
||||
next
|
||||
|
@ -22,7 +22,7 @@ module OneProvision
|
||||
DOCUMENT_TYPE = 102
|
||||
|
||||
# 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
|
||||
CREDENTIALS_FILE = { 'google' => 'credentials' }
|
||||
@ -185,7 +185,7 @@ EOS
|
||||
# @return [JSON] Document information in JSON format
|
||||
def to_json(template)
|
||||
document = {}
|
||||
skip = %w[provider connection registration_time plain]
|
||||
skip = ['provider', 'connection', 'registration_time', 'plain']
|
||||
|
||||
# Create document JSON
|
||||
document['provider'] = template['provider']
|
||||
|
@ -35,28 +35,28 @@ module OneProvision
|
||||
'DELETING' => 5
|
||||
}
|
||||
|
||||
STATE_STR = %w[
|
||||
PENDING
|
||||
DEPLOYING
|
||||
CONFIGURING
|
||||
RUNNING
|
||||
ERROR
|
||||
DELETING
|
||||
STATE_STR = [
|
||||
'PENDING',
|
||||
'DEPLOYING',
|
||||
'CONFIGURING',
|
||||
'RUNNING',
|
||||
'ERROR',
|
||||
'DELETING'
|
||||
]
|
||||
|
||||
# Available resources that can be created with the provision
|
||||
#
|
||||
# Note: order is important, some objects depend on others
|
||||
# Objects without dependencies need to be created firstly, then the rest
|
||||
RESOURCES = %w[images
|
||||
marketplaceapps
|
||||
templates
|
||||
vntemplates
|
||||
flowtemplates]
|
||||
RESOURCES = ['images',
|
||||
'marketplaceapps',
|
||||
'templates',
|
||||
'vntemplates',
|
||||
'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
|
||||
#
|
||||
@ -482,7 +482,7 @@ module OneProvision
|
||||
|
||||
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]
|
||||
end
|
||||
|
||||
|
@ -87,7 +87,7 @@ module OneProvision
|
||||
################################################################
|
||||
|
||||
if @config['hosts']
|
||||
sections = %w[connection provision configuration]
|
||||
sections = ['connection', 'provision', 'configuration']
|
||||
|
||||
@config['hosts'].map! do |host|
|
||||
sections.each do |section|
|
||||
@ -115,7 +115,7 @@ module OneProvision
|
||||
# Datastores & Networks
|
||||
################################################################
|
||||
|
||||
%w[datastores networks].each do |r|
|
||||
['datastores', 'networks'].each do |r|
|
||||
next unless @config[r]
|
||||
|
||||
@config[r].map! do |x|
|
||||
@ -334,26 +334,26 @@ module OneProvision
|
||||
def extra
|
||||
ret = {}
|
||||
|
||||
reject = %w[cluster
|
||||
datastores
|
||||
defaults
|
||||
extends
|
||||
flowtemplates
|
||||
hosts
|
||||
images
|
||||
inputs
|
||||
marketplaceapps
|
||||
name
|
||||
networks
|
||||
playbook
|
||||
templates
|
||||
vntemplates
|
||||
name
|
||||
description
|
||||
state
|
||||
provider
|
||||
provision
|
||||
start_time]
|
||||
reject = ['cluster',
|
||||
'datastores',
|
||||
'defaults',
|
||||
'extends',
|
||||
'flowtemplates',
|
||||
'hosts',
|
||||
'images',
|
||||
'inputs',
|
||||
'marketplaceapps',
|
||||
'name',
|
||||
'networks',
|
||||
'playbook',
|
||||
'templates',
|
||||
'vntemplates',
|
||||
'name',
|
||||
'description',
|
||||
'state',
|
||||
'provider',
|
||||
'provision',
|
||||
'start_time']
|
||||
|
||||
@config.each do |key, value|
|
||||
next if reject.include?(key)
|
||||
@ -423,7 +423,7 @@ module OneProvision
|
||||
end
|
||||
|
||||
# merge each defaults section separately
|
||||
%w[connection provision configuration].each do |section|
|
||||
['connection', 'provision', 'configuration'].each do |section|
|
||||
base['defaults'][section] ||= {}
|
||||
yaml['defaults'][section] ||= {}
|
||||
defaults = yaml['defaults'][section]
|
||||
@ -520,7 +520,7 @@ module OneProvision
|
||||
when 'boolean'
|
||||
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"]
|
||||
when 'list'
|
||||
@ -720,7 +720,7 @@ module OneProvision
|
||||
answer = Base64.encode64(answer).strip.delete("\n")
|
||||
end
|
||||
when 'boolean'
|
||||
until %w[YES NO].include?(answer)
|
||||
until ['YES', 'NO'].include?(answer)
|
||||
print "Bool `#{input['name']}` " \
|
||||
"(default=#{input['default']}): "
|
||||
|
||||
@ -730,7 +730,7 @@ module OneProvision
|
||||
# Add default in case no default value is given
|
||||
answer = 'NO' if !answer || answer.empty?
|
||||
|
||||
unless %w[YES NO].include?(answer)
|
||||
unless ['YES', 'NO'].include?(answer)
|
||||
puts "Invalid boolean #{answer} " \
|
||||
'boolean has to be YES or NO'
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ module OneProvision
|
||||
@p_template['configuration'].to_yaml
|
||||
) 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|
|
||||
xml.HOST do
|
||||
|
@ -20,21 +20,21 @@ module OneProvision
|
||||
class Resource
|
||||
|
||||
# Keys to remove from template
|
||||
REJECT_KEYS = %w[meta]
|
||||
REJECT_KEYS = ['meta']
|
||||
|
||||
# Valid keys in template evaluation
|
||||
EVAL_KEYS = %w[cluster
|
||||
datastore
|
||||
host
|
||||
image
|
||||
network
|
||||
template
|
||||
vntemplate
|
||||
marketplaceapp]
|
||||
EVAL_KEYS = ['cluster',
|
||||
'datastore',
|
||||
'host',
|
||||
'image',
|
||||
'network',
|
||||
'template',
|
||||
'vntemplate',
|
||||
'marketplaceapp']
|
||||
|
||||
S_EVAL_KEYS = %w[index
|
||||
provision
|
||||
provision_id]
|
||||
S_EVAL_KEYS = ['index',
|
||||
'provision',
|
||||
'provision_id']
|
||||
|
||||
# @one ONE object
|
||||
# @pool ONE pool
|
||||
|
@ -25,7 +25,7 @@ module OneProvision
|
||||
DEFAULT_TIMEOUT = 60
|
||||
|
||||
# Supported wait modes
|
||||
SUPPORTED_MODES = %w[true false]
|
||||
SUPPORTED_MODES = ['true', 'false']
|
||||
|
||||
# Delete object
|
||||
def delete(_ = nil, _ = nil, _ = nil)
|
||||
|
@ -32,7 +32,7 @@ module OneProvision
|
||||
:network => 'aws_subnet'
|
||||
}
|
||||
|
||||
KEYS = %w[access_key secret_key region]
|
||||
KEYS = ['access_key', 'secret_key', 'region']
|
||||
|
||||
# Class constructor
|
||||
#
|
||||
|
@ -32,7 +32,7 @@ module OneProvision
|
||||
:network => ''
|
||||
}
|
||||
|
||||
KEYS = %w[token region]
|
||||
KEYS = ['token', 'region']
|
||||
|
||||
# Class constructor
|
||||
#
|
||||
|
@ -31,7 +31,7 @@ module OneProvision
|
||||
:network => 'packet_reserved_ip_block'
|
||||
}
|
||||
|
||||
KEYS = %w[project token facility]
|
||||
KEYS = ['project', 'token', 'facility']
|
||||
|
||||
# Class constructor
|
||||
#
|
||||
|
@ -32,7 +32,7 @@ module OneProvision
|
||||
:network => ''
|
||||
}
|
||||
|
||||
KEYS = %w[credentials project region zone]
|
||||
KEYS = ['credentials', 'project', 'region', 'zone']
|
||||
|
||||
# Class constructor
|
||||
#
|
||||
|
@ -33,7 +33,7 @@ module OneProvision
|
||||
# Vultr Terraform Provider
|
||||
class Vultr < Terraform
|
||||
|
||||
KEYS = %w[key region]
|
||||
KEYS = ['key', 'region']
|
||||
|
||||
# Class constructor
|
||||
#
|
||||
|
@ -51,7 +51,7 @@ class SunstoneGuac < SunstoneRemoteConnections
|
||||
return error(400, error_message)
|
||||
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')
|
||||
end
|
||||
|
||||
|
@ -131,31 +131,30 @@ module TransferManager
|
||||
#-----------------------------------------------------------------------
|
||||
# Attributes that will be rejected when recovering the new template
|
||||
#-----------------------------------------------------------------------
|
||||
DISK_LIST = %w[ALLOW_ORPHANS CLONE CLONE_TARGET CLUSTER_ID DATASTORE
|
||||
DATASTORE_ID DEV_PREFIX DISK_SNAPSHOT_TOTAL_SIZE
|
||||
DISK_TYPE DRIVER IMAGE IMAGE_ID IMAGE_STATE IMAGE_UID
|
||||
IMAGE_UNAME LN_TARGET OPENNEBULA_MANAGED ORIGINAL_SIZE
|
||||
PERSISTENT READONLY SAVE SIZE SOURCE TARGET TM_MAD TYPE
|
||||
FORMAT]
|
||||
DISK_LIST = ['ALLOW_ORPHANS', 'CLONE', 'CLONE_TARGET', 'CLUSTER_ID', 'DATASTORE',
|
||||
'DATASTORE_ID', 'DEV_PREFIX', 'DISK_SNAPSHOT_TOTAL_SIZE', 'DISK_TYPE',
|
||||
'DRIVER', 'IMAGE', 'IMAGE_ID', 'IMAGE_STATE', 'IMAGE_UID', 'IMAGE_UNAME',
|
||||
'LN_TARGET', 'OPENNEBULA_MANAGED', 'ORIGINAL_SIZE', 'PERSISTENT', 'READONLY',
|
||||
'SAVE', 'SIZE', 'SOURCE', 'TARGET', 'TM_MAD', 'TYPE', 'FORMAT']
|
||||
|
||||
NIC_LIST = %w[AR_ID BRIDGE BRIDGE_TYPE CLUSTER_ID NAME NETWORK_ID
|
||||
NIC_ID TARGET VLAN_ID VN_MAD MAC VLAN_TAGGED_ID PHYDEV]
|
||||
NIC_LIST = ['AR_ID', 'BRIDGE', 'BRIDGE_TYPE', 'CLUSTER_ID', 'NAME', 'NETWORK_ID', 'NIC_ID',
|
||||
'TARGET', 'VLAN_ID', 'VN_MAD', 'MAC', 'VLAN_TAGGED_ID', 'PHYDEV']
|
||||
|
||||
GRAPHICS_LIST = %w[PORT]
|
||||
GRAPHICS_LIST = ['PORT']
|
||||
|
||||
CONTEXT_LIST = ['DISK_ID', /ETH[0-9]?/, /PCI[0-9]?/]
|
||||
|
||||
NUMA_NODE_LIST = %w[CPUS MEMORY_NODE_ID NODE_ID]
|
||||
NUMA_NODE_LIST = ['CPUS', 'MEMORY_NODE_ID', 'NODE_ID']
|
||||
|
||||
PCI_COMMON = %w[ADDRESS BUS DOMAIN FUNCTION NUMA_NODE PCI_ID SLOT
|
||||
VM_ADDRESS VM_BUS VM_DOMAIN VM_FUNCTION VM_SLOT]
|
||||
PCI_COMMON = ['ADDRESS', 'BUS', 'DOMAIN', 'FUNCTION', 'NUMA_NODE', 'PCI_ID', 'SLOT',
|
||||
'VM_ADDRESS', 'VM_BUS', 'VM_DOMAIN', 'VM_FUNCTION', 'VM_SLOT']
|
||||
|
||||
PCI_MANUAL_LIST = NIC_LIST + PCI_COMMON + %w[SHORT_ADDRESS]
|
||||
PCI_AUTO_LIST = NIC_LIST + PCI_COMMON + %w[VENDOR DEVICE CLASS]
|
||||
PCI_MANUAL_LIST = NIC_LIST + PCI_COMMON + ['SHORT_ADDRESS']
|
||||
PCI_AUTO_LIST = NIC_LIST + PCI_COMMON + ['VENDOR', 'DEVICE', 'CLASS']
|
||||
|
||||
ATTR_LIST = %w[AUTOMATIC_DS_REQUIREMENTS AUTOMATIC_NIC_REQUIREMENTS
|
||||
AUTOMATIC_REQUIREMENTS VMID TEMPLATE_ID TM_MAD_SYSTEM
|
||||
SECURITY_GROUP_RULE ERROR]
|
||||
ATTR_LIST = ['AUTOMATIC_DS_REQUIREMENTS', 'AUTOMATIC_NIC_REQUIREMENTS',
|
||||
'AUTOMATIC_REQUIREMENTS', 'VMID', 'TEMPLATE_ID', 'TM_MAD_SYSTEM',
|
||||
'SECURITY_GROUP_RULE', 'ERROR']
|
||||
|
||||
# options = {
|
||||
# :vm_xml64 => XML representation of the VM, base64 encoded
|
||||
|
@ -153,7 +153,7 @@ class QemuImg
|
||||
#---------------------------------------------------------------------------
|
||||
# qemu-img command methods
|
||||
#---------------------------------------------------------------------------
|
||||
QEMU_IMG_COMMANDS = %w[convert create rebase info bitmap]
|
||||
QEMU_IMG_COMMANDS = ['convert', 'create', 'rebase', 'info', 'bitmap']
|
||||
|
||||
QEMU_IMG_COMMANDS.each do |command|
|
||||
define_method(command.to_sym) do |args = '', opts|
|
||||
|
@ -179,13 +179,10 @@ class VmmAction
|
||||
|
||||
# List of xpaths required by the VNM driver actions. TEMPLATE/NIC is
|
||||
# also required but added separately to the driver xml
|
||||
XPATH_LIST = %w[
|
||||
ID DEPLOY_ID TEMPLATE/CONTEXT USER_TEMPLATE
|
||||
TEMPLATE/SECURITY_GROUP_RULE
|
||||
HISTORY_RECORDS/HISTORY/HOSTNAME
|
||||
HISTORY_RECORDS/HISTORY/HID
|
||||
HISTORY_RECORDS/HISTORY/DS_ID
|
||||
HISTORY_RECORDS/HISTORY/VM_MAD
|
||||
XPATH_LIST = [
|
||||
'ID', 'DEPLOY_ID', 'TEMPLATE/CONTEXT', 'USER_TEMPLATE', 'TEMPLATE/SECURITY_GROUP_RULE',
|
||||
'HISTORY_RECORDS/HISTORY/HOSTNAME', 'HISTORY_RECORDS/HISTORY/HID',
|
||||
'HISTORY_RECORDS/HISTORY/DS_ID', 'HISTORY_RECORDS/HISTORY/VM_MAD'
|
||||
]
|
||||
|
||||
DRIVER_NAMES = {
|
||||
@ -212,7 +209,7 @@ class VmmAction
|
||||
end
|
||||
end
|
||||
|
||||
%w[NIC NIC_ALIAS PCI].each do |r|
|
||||
['NIC', 'NIC_ALIAS', 'PCI'].each do |r|
|
||||
vm_template_xml.elements.each("TEMPLATE/#{r}") do |element|
|
||||
vn_mad = element.get_text('VN_MAD').to_s
|
||||
|
||||
|
@ -89,10 +89,14 @@ class AzureDriver
|
||||
'OS Disk Write Operations/Sec'
|
||||
]
|
||||
|
||||
AZ_REQUIRED_PARAMS = %w[
|
||||
INSTANCE_TYPE
|
||||
VM_USER VM_PASSWORD
|
||||
IMAGE_PUBLISHER IMAGE_OFFER IMAGE_SKU IMAGE_VERSION
|
||||
AZ_REQUIRED_PARAMS = [
|
||||
'INSTANCE_TYPE',
|
||||
'VM_USER',
|
||||
'VM_PASSWORD',
|
||||
'IMAGE_PUBLISHER',
|
||||
'IMAGE_OFFER',
|
||||
'IMAGE_SKU',
|
||||
'IMAGE_VERSION'
|
||||
]
|
||||
|
||||
STATE_MAP = {
|
||||
@ -225,7 +229,7 @@ class AzureDriver
|
||||
unless @resource_client.resource_groups
|
||||
.check_existence(@rgroup_name)
|
||||
|
||||
if %w[BOOT BOOT_FAILURE].include?(lcm_state)
|
||||
if ['BOOT', 'BOOT_FAILURE'].include?(lcm_state)
|
||||
@defaults = load_default_template_values
|
||||
|
||||
az_info, context = get_deployment_info(host, xml_text)
|
||||
|
@ -143,10 +143,10 @@ module VirtualMachineManagerKVM
|
||||
dev << '</filterref>'
|
||||
end
|
||||
|
||||
inb_keys = %w[INBOUND_AVG_BW INBOUND_PEAK_BW INBOUND_PEAK_KB]
|
||||
inb_keys = ['INBOUND_AVG_BW', 'INBOUND_PEAK_BW', 'INBOUND_PEAK_KB']
|
||||
inbound = inb_keys.any? {|e| exist? e }
|
||||
|
||||
outb_keys = %w[OUTBOUND_AVG_BW OUTBOUND_PEAK_BW OUTBOUND_PEAK_KB]
|
||||
outb_keys = ['OUTBOUND_AVG_BW', 'OUTBOUND_PEAK_BW', 'OUTBOUND_PEAK_KB']
|
||||
outbound = outb_keys.any? {|e| exist? e }
|
||||
|
||||
if inbound || outbound
|
||||
@ -260,7 +260,7 @@ module VirtualMachineManagerKVM
|
||||
|
||||
# Setting Bus address needs to check that a PCI contoller is
|
||||
# present for Bus 1
|
||||
vm_addr = %w[VM_DOMAIN VM_BUS VM_SLOT VM_FUNCTION].all? {|e| exist? e }
|
||||
vm_addr = ['VM_DOMAIN', 'VM_BUS', 'VM_SLOT', 'VM_FUNCTION'].all? {|e| exist? e }
|
||||
|
||||
if vm_addr && opts[:pci]
|
||||
dev << '<address type="pci"'
|
||||
|
@ -25,7 +25,7 @@ require 'storageutils'
|
||||
class Qcow2Mapper
|
||||
|
||||
QEMU_NBD_FORK_VERSION = '2.8.0'
|
||||
CACHE_MODES = %w[none writethrough writeback directsync unsafe]
|
||||
CACHE_MODES = ['none', 'writethrough', 'writeback', 'directsync', 'unsafe']
|
||||
|
||||
COMMANDS = {
|
||||
:map => 'sudo -n qemu-nbd --fork -c',
|
||||
|
@ -127,7 +127,7 @@ end
|
||||
}
|
||||
}
|
||||
NSXV_RULE_BASE = 'xxx'
|
||||
NSX_RULE_IPSEC_PORTS = %w[500 4500]
|
||||
NSX_RULE_IPSEC_PORTS = ['500', '4500']
|
||||
# Logical Ports
|
||||
NSXT_LP_BASE = NSXT_BASE + '/logical-ports/'
|
||||
NSXV_LP_BASE = ''
|
||||
|
@ -743,9 +743,9 @@ module VCenterDriver
|
||||
image_path = ''
|
||||
|
||||
# Skip not relevant files
|
||||
next unless %w[FloppyImageFileInfo
|
||||
IsoImageFileInfo
|
||||
VmDiskFileInfo].include? image.class.to_s
|
||||
next unless ['FloppyImageFileInfo',
|
||||
'IsoImageFileInfo',
|
||||
'VmDiskFileInfo'].include? image.class.to_s
|
||||
|
||||
# Get image path and name
|
||||
image_path << folderpath << image.path
|
||||
|
@ -109,7 +109,7 @@ module VCenterDriver
|
||||
def self.needs_unpack?(file_path)
|
||||
type = get_type(file_path)
|
||||
type.gsub!(%r{^application/(x-)?}, '')
|
||||
%w[bzip2 gzip tar].include?(type)
|
||||
['bzip2', 'gzip', 'tar'].include?(type)
|
||||
end
|
||||
|
||||
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_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_HV = '//HISTORY/VM_MAD'
|
||||
|
||||
OVS_VN_MADS = %w[ovswitch ovswitch_vxlan]
|
||||
OVS_VN_MADS = ['ovswitch', 'ovswitch_vxlan']
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user