opennebula-cli 6.10.2 → 6.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de5f626cbb390d51c51c96f9c866e67aefb21beb83bbf7116b56097cfeb52211
4
- data.tar.gz: d9101be349af4f0b9b8dff85446867ac5b8f637275a5d37fa9488e33916b8b4c
3
+ metadata.gz: 9bf87d87657a21425ee5f0aa203425906d8cc72541e86c3861497340d9b531cc
4
+ data.tar.gz: 76239919204d89d7c9b453091181cf3c4796e44e1f98aeb9e494dd032d0dd8fe
5
5
  SHA512:
6
- metadata.gz: dddc332c72fa230035158cb48bdcb07244a896ae25d00b382cc08b6384c76488cbaa1ddaec70d5f154a7519470b5a30cf40001226715ce89170a9da50b447574
7
- data.tar.gz: b298cbe408ad5520c36b35857d34106ac54b01b9f9a469ed8ccc4c344e08af0bb006f3296904cdb198db1bb1a3ff542572aea995a85f66e523c7a3168b6f70d9
6
+ metadata.gz: ea5b2612e5aa757c9130fede54c2043123b5d565bb812d5e1caf2da6e07d897027b6f8de0ca41c3202648d7c7d3979a9a9ab052ceb40f85cfdc79b5f674e4db0
7
+ data.tar.gz: d1238483708055143208387399653372c8c8af8ef4c9b0a15943689464e1fc35bfe534cddcbd0cb872bc909fa8611a74908ea57ef409d30aa10c94b8003e49ee
data/bin/oneacct CHANGED
@@ -97,6 +97,9 @@ CommandParser::CmdParser.new(ARGV) do
97
97
  end_time = t.to_i
98
98
  end
99
99
 
100
+ # User defined timezone
101
+ ENV['TZ'] = options[:timezone] if options[:timezone]
102
+
100
103
  common_opts = {
101
104
  :start_time => start_time,
102
105
  :end_time => end_time,
data/bin/onevm CHANGED
@@ -1140,6 +1140,24 @@ CommandParser::CmdParser.new(ARGV) do
1140
1140
  end
1141
1141
  end
1142
1142
 
1143
+ snapshot_list_desc = <<-EOT.unindent
1144
+ Lists the snapshots of a VM
1145
+ EOT
1146
+
1147
+ command :"snapshot-list", snapshot_list_desc, :vmid do
1148
+ vm = helper.retrieve_resource(args[0])
1149
+ vm.info
1150
+
1151
+ if vm.has_elements?('/VM/TEMPLATE/SNAPSHOT')
1152
+ CLIHelper.print_header('SNAPSHOTS'.ljust(80), false)
1153
+
1154
+ helper.format_template_snapshots(vm)
1155
+ else
1156
+ puts 'No snapshots available'
1157
+ end
1158
+ 0
1159
+ end
1160
+
1143
1161
  disk_snapshot_create_desc = <<-EOT.unindent
1144
1162
  Takes a new snapshot of the given disk. This operation needs support
1145
1163
  from the Datastore drivers: QCOW2 or Ceph.
@@ -1432,9 +1450,9 @@ CommandParser::CmdParser.new(ARGV) do
1432
1450
  GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP", "COMMAND"]
1433
1451
  VIDEO = ["TYPE", "IOMMU", "ATS", "VRAM", "RESOLUTION"]
1434
1452
  RAW = ["DATA", "DATA_VMX", "TYPE", "VALIDATE"]
1435
- CPU_MODEL = ["MODEL"]
1453
+ CPU_MODEL = ["MODEL", "FEATURES"]
1436
1454
  BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE", "INCREMENT_MODE"]
1437
- CONTEXT (any value, except ETH*, **variable substitution will be made**)
1455
+ CONTEXT (any value, ETH* if CONTEXT_ALLOW_ETH_UPDATES set in oned.conf, **variable substitution will be made**)
1438
1456
  EOT
1439
1457
 
1440
1458
  command :updateconf, updateconf_desc, :vmid, [:file, nil],
data/bin/onevrouter CHANGED
@@ -188,7 +188,7 @@ CommandParser::CmdParser.new(ARGV) do
188
188
  end
189
189
 
190
190
  number = options[:multiple] || 1
191
- user_inputs = nil
191
+ user_inputs = options[:user_inputs]
192
192
 
193
193
  helper.perform_action(args[0], options, 'instantiated') do |vr|
194
194
  name = options[:name] || ''
@@ -220,7 +220,16 @@ CommandParser::CmdParser.new(ARGV) do
220
220
  extra_template = res.last
221
221
  end
222
222
 
223
- user_inputs ||= OneTemplateHelper.get_user_inputs(t.to_hash)
223
+ if !user_inputs
224
+ user_inputs = OneTemplateHelper.get_user_inputs(t.to_hash)
225
+ else
226
+ optionals = OneTemplateHelper.get_user_inputs(
227
+ t.to_hash,
228
+ options[:user_inputs_keys]
229
+ )
230
+
231
+ user_inputs = user_inputs + "\n" + optionals
232
+ end
224
233
 
225
234
  extra_template << "\n" << user_inputs
226
235
 
@@ -18,6 +18,14 @@ require 'one_helper'
18
18
  require 'optparse/time'
19
19
 
20
20
  class AcctHelper < OpenNebulaHelper::OneHelper
21
+ TIME_ZONE_CUR = {
22
+ :name => "timezone",
23
+ :short => "-t TZ",
24
+ :large => "--timezone TZ",
25
+ :description => "User defined Time Zone",
26
+ :format => String
27
+ }
28
+
21
29
  START_TIME_ACCT = {
22
30
  :name => "start_time",
23
31
  :short => "-s TIME",
@@ -97,7 +105,7 @@ class AcctHelper < OpenNebulaHelper::OneHelper
97
105
  :description => "Split the output in a table for each VM"
98
106
  }
99
107
 
100
- ACCT_OPTIONS = [START_TIME_ACCT, END_TIME_ACCT, USERFILTER, GROUP, HOST, XPATH, SPLIT]
108
+ ACCT_OPTIONS = [TIME_ZONE_CUR, START_TIME_ACCT, END_TIME_ACCT, USERFILTER, GROUP, HOST, XPATH, SPLIT]
101
109
  SHOWBACK_OPTIONS = [START_TIME_SHOWBACK, END_TIME_SHOWBACK, USERFILTER, GROUP, OpenNebulaHelper::FORMAT]
102
110
 
103
111
  ACCT_OPTIONS << OpenNebulaHelper::XML
@@ -260,7 +260,7 @@ class OneFlowTemplateHelper < OpenNebulaHelper::OneHelper
260
260
  type, resource_id, extra = initial.split(':', -1)
261
261
  end
262
262
 
263
- if (!type || !resource_id) && (initial && !initial.empty?)
263
+ if (!type || !resource_id) && initial && !initial.empty?
264
264
  STDERR.puts 'Wrong type for user input default value:'
265
265
  STDERR.puts " #{key}: #{val}"
266
266
  exit(-1)
@@ -799,9 +799,12 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
799
799
  node['MEMORY']['FREE'] = mon_node['MEMORY']['FREE']
800
800
  node['MEMORY']['USED'] = mon_node['MEMORY']['USED']
801
801
 
802
+ node['HUGEPAGE'] = [node['HUGEPAGE']].flatten.compact
803
+ mon_node['HUGEPAGE'] = [mon_node['HUGEPAGE']].flatten.compact
804
+
802
805
  node['HUGEPAGE'].each do |hp|
803
806
  mon_hp = mon_node['HUGEPAGE'].find {|x| x['SIZE'] == hp['SIZE'] }
804
- hp['FREE'] = mon_hp['FREE']
807
+ hp['FREE'] = mon_hp['FREE'] unless mon_hp.nil?
805
808
  end
806
809
  end
807
810
  end
@@ -936,11 +936,11 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
936
936
  # array. Duplicate IPs are not shown.
937
937
  extra_ips = []
938
938
 
939
- if (val = vm['/VM/MONITORING/GUEST_IP']) && (val && !val.empty?)
939
+ if (val = vm['/VM/MONITORING/GUEST_IP']) && val && !val.empty?
940
940
  extra_ips << val
941
941
  end
942
942
 
943
- if (val = vm['/VM/MONITORING/GUEST_IP_ADDRESSES']) && (val && !val.empty?)
943
+ if (val = vm['/VM/MONITORING/GUEST_IP_ADDRESSES']) && val && !val.empty?
944
944
  extra_ips += val.split(',')
945
945
  end
946
946
 
@@ -1192,23 +1192,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1192
1192
  puts
1193
1193
  CLIHelper.print_header(str_h1 % 'SNAPSHOTS', false)
1194
1194
 
1195
- CLIHelper::ShowTable.new(nil, self) do
1196
- column :ID, '', :size => 4 do |d|
1197
- d['SNAPSHOT_ID'] unless d.nil?
1198
- end
1199
-
1200
- column :TIME, '', :size => 12 do |d|
1201
- OpenNebulaHelper.time_to_str(d['TIME'], false) unless d.nil?
1202
- end
1203
-
1204
- column :NAME, '', :left, :size => 46 do |d|
1205
- d['NAME'] unless d.nil?
1206
- end
1207
-
1208
- column :HYPERVISOR_ID, '', :left, :size => 15 do |d|
1209
- d['HYPERVISOR_ID'] unless d.nil?
1210
- end
1211
- end.show([vm_hash['VM']['TEMPLATE']['SNAPSHOT']].flatten, {})
1195
+ format_template_snapshots(vm)
1212
1196
 
1213
1197
  vm.delete_element('/VM/TEMPLATE/SNAPSHOT')
1214
1198
  end
@@ -1501,6 +1485,28 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1501
1485
  table.show(snapshots)
1502
1486
  end
1503
1487
 
1488
+ def format_template_snapshots(vm)
1489
+ table = CLIHelper::ShowTable.new(nil, self) do
1490
+ column :ID, '', :size => 4 do |d|
1491
+ d['SNAPSHOT_ID'] unless d.nil?
1492
+ end
1493
+
1494
+ column :TIME, '', :size => 12 do |d|
1495
+ OpenNebulaHelper.time_to_str(d['TIME'], false) unless d.nil?
1496
+ end
1497
+
1498
+ column :NAME, '', :left, :size => 46 do |d|
1499
+ d['NAME'] unless d.nil?
1500
+ end
1501
+
1502
+ column :HYPERVISOR_ID, '', :left, :size => 15 do |d|
1503
+ d['HYPERVISOR_ID'] unless d.nil?
1504
+ end
1505
+ end
1506
+ vm_hash = vm.to_hash
1507
+ table.show([vm_hash['VM']['TEMPLATE']['SNAPSHOT']].flatten, {})
1508
+ end
1509
+
1504
1510
  end
1505
1511
 
1506
1512
  # rubocop:enable Naming/UncommunicativeMethodParamName
data/lib/one_helper.rb CHANGED
@@ -421,22 +421,17 @@ Bash symbols must be escaped on STDIN passing'
421
421
  {
422
422
  :name => 'user_inputs',
423
423
  :large => '--user-inputs ui1,ui2,ui3',
424
- :format => Array,
424
+ :format => String,
425
425
  :description => 'Specify the user inputs values when instantiating',
426
- :proc => lambda do |o, options|
427
- # Store user inputs that has been already processed
428
- options[:user_inputs_keys] = []
429
-
430
- # escape values
431
- options[:user_inputs].map! do |user_input|
432
- user_input_split = user_input.split('=')
433
-
434
- options[:user_inputs_keys] << user_input_split[0]
426
+ :proc => lambda do |_o, options|
427
+ keys = options[:user_inputs].scan(/(?:^|,)([^,=]+)=/).flatten
428
+ values = options[:user_inputs].scan(/=(.+?)(?=,[^,]+=|$)/).flatten
435
429
 
436
- "#{user_input_split[0]}=\"#{user_input_split[1]}\""
437
- end
430
+ options[:user_inputs_keys] = keys
438
431
 
439
- options[:user_inputs] = o.join("\n")
432
+ options[:user_inputs] = keys.zip(values).map do |k, v|
433
+ %[#{k}="#{v}"]
434
+ end.join("\n")
440
435
  end
441
436
  },
442
437
  {
@@ -1860,15 +1855,13 @@ Bash symbols must be escaped on STDIN passing'
1860
1855
  [0, template]
1861
1856
  end
1862
1857
 
1863
- def self.create_context(options)
1858
+ def self.create_context_str(options, context_hash)
1864
1859
  context_options = [:ssh, :net_context, :context, :init, :files_ds, :startscript,
1865
1860
  :report_ready]
1866
1861
  if !(options.keys & context_options).empty?
1867
- lines=[]
1868
-
1869
1862
  if options[:ssh]
1870
1863
  if options[:ssh]==true
1871
- lines<<'SSH_PUBLIC_KEY="$USER[SSH_PUBLIC_KEY]"'
1864
+ context_hash['SSH_PUBLIC_KEY'] = "$USER[SSH_PUBLIC_KEY]"
1872
1865
  else
1873
1866
  begin
1874
1867
  key=File.read(options[:ssh]).strip
@@ -1876,30 +1869,24 @@ Bash symbols must be escaped on STDIN passing'
1876
1869
  STDERR.puts e.message
1877
1870
  exit(-1)
1878
1871
  end
1879
- lines<<"SSH_PUBLIC_KEY=\"#{key}\""
1872
+ context_hash['SSH_PUBLIC_KEY'] = key
1880
1873
  end
1881
1874
  end
1882
-
1875
+
1883
1876
  if options[:net_context]
1884
- lines << 'NETWORK = "YES"'
1877
+ context_hash['NETWORK'] = "YES"
1885
1878
  end
1886
1879
 
1887
- lines+=options[:context] if options[:context]
1888
-
1889
1880
  if options[:files_ds]
1890
- text='FILES_DS="'
1891
- text << options[:files_ds].map do |file|
1892
- %($FILE[IMAGE=\\"#{file}\\"])
1893
- end.join(' ')
1894
- text << '"'
1881
+ files = options[:files_ds].map { |file| %($FILE[IMAGE=\\"#{file}\\"]) }.join(" ")
1895
1882
 
1896
- lines << text
1883
+ context_hash['FILES_DS'] = files
1897
1884
  end
1898
-
1885
+
1899
1886
  if options[:init]
1900
- lines << %(INIT_SCRIPTS="#{options[:init].join(' ')}")
1887
+ context_hash['INIT_SCRIPTS'] = options[:init].join(" ")
1901
1888
  end
1902
-
1889
+
1903
1890
  if options[:startscript]
1904
1891
  script = nil
1905
1892
  begin
@@ -1909,15 +1896,23 @@ Bash symbols must be escaped on STDIN passing'
1909
1896
  exit(-1)
1910
1897
  end
1911
1898
  script = Base64.strict_encode64(script)
1912
- lines<<"START_SCRIPT_BASE64=\"#{script}\""
1899
+ context_hash['START_SCRIPT_BASE64'] = script
1900
+
1913
1901
  end
1914
1902
 
1915
1903
  if options[:report_ready]
1916
- lines << 'REPORT_READY = "YES"'
1904
+ context_hash['REPORT_READY'] = "YES"
1917
1905
  end
1918
1906
 
1919
- if !lines.empty?
1920
- "CONTEXT=[\n" << lines.map {|l| ' ' << l }.join(",\n") << "\n]\n"
1907
+ if context_hash.any? || options[:context]
1908
+ formatted_context = "CONTEXT=[\n"
1909
+ formatted_context << options[:context].map {|l| ' ' << l }.join(",\n") if options[:context]
1910
+ if context_hash.any?
1911
+ formatted_context << ",\n" if options[:context]
1912
+ formatted_context << context_hash.map { |k, v| " #{k}=\"#{v}\"" }.join(",\n")
1913
+ end
1914
+ formatted_context << "\n]\n"
1915
+ formatted_context
1921
1916
  else
1922
1917
  nil
1923
1918
  end
@@ -1999,10 +1994,12 @@ Bash symbols must be escaped on STDIN passing'
1999
1994
  end
2000
1995
 
2001
1996
  template<<"VCENTER_VM_FOLDER=#{options[:vcenter_vm_folder]}\n" if options[:vcenter_vm_folder]
2002
-
2003
- context=create_context(options)
2004
- template<<context if context
2005
-
1997
+ context_hash = {}
1998
+ if !template_obj.nil? && template_obj.has_elements?('TEMPLATE/CONTEXT')
1999
+ context_hash = template_obj.to_hash["VMTEMPLATE"]["TEMPLATE"]["CONTEXT"]
2000
+ end
2001
+ context_str=create_context_str(options, context_hash)
2002
+ template<<context_str if context_str
2006
2003
  if options[:userdata] && !template_obj.nil? && template_obj.has_elements?('TEMPLATE/EC2')
2007
2004
  template_obj.add_element(
2008
2005
  'TEMPLATE/EC2',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opennebula-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.10.2
4
+ version: 6.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-17 00:00:00.000000000 Z
11
+ date: 2025-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opennebula
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 6.10.2
19
+ version: 6.10.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 6.10.2
26
+ version: 6.10.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement