opennebula-cli 6.10.2 → 6.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de5f626cbb390d51c51c96f9c866e67aefb21beb83bbf7116b56097cfeb52211
4
- data.tar.gz: d9101be349af4f0b9b8dff85446867ac5b8f637275a5d37fa9488e33916b8b4c
3
+ metadata.gz: 457eac25c832b616aef506710eef840fe9bc1534749f1d2c2b3e1a1d925cb610
4
+ data.tar.gz: 48c7ef4904fa2fb666fde0a1d9f66a4cade853dec50d6496f755f946922ca7b8
5
5
  SHA512:
6
- metadata.gz: dddc332c72fa230035158cb48bdcb07244a896ae25d00b382cc08b6384c76488cbaa1ddaec70d5f154a7519470b5a30cf40001226715ce89170a9da50b447574
7
- data.tar.gz: b298cbe408ad5520c36b35857d34106ac54b01b9f9a469ed8ccc4c344e08af0bb006f3296904cdb198db1bb1a3ff542572aea995a85f66e523c7a3168b6f70d9
6
+ metadata.gz: 7d072276b229f3f4526d64b3ae52ddd6dc9608f09ab708aff2f8489e46078f225c7cbcc994cac6d59b7bdfc569fa43504bc7bf824d5b74ea3af7e421286523b2
7
+ data.tar.gz: 205e8f6682eecfa14d3a45857e00b9d27ee18486d3956a566f4f151f4855ed658f17e76bba5ae86444664fb6bbe3ba97815a024755e338e62d7accf08ee97c42
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,7 +1450,7 @@ 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
1455
  CONTEXT (any value, except ETH*, **variable substitution will be made**)
1438
1456
  EOT
@@ -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
@@ -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
@@ -1860,15 +1860,13 @@ Bash symbols must be escaped on STDIN passing'
1860
1860
  [0, template]
1861
1861
  end
1862
1862
 
1863
- def self.create_context(options)
1863
+ def self.create_context_str(options, context_hash)
1864
1864
  context_options = [:ssh, :net_context, :context, :init, :files_ds, :startscript,
1865
1865
  :report_ready]
1866
1866
  if !(options.keys & context_options).empty?
1867
- lines=[]
1868
-
1869
1867
  if options[:ssh]
1870
1868
  if options[:ssh]==true
1871
- lines<<'SSH_PUBLIC_KEY="$USER[SSH_PUBLIC_KEY]"'
1869
+ context_hash['SSH_PUBLIC_KEY'] = "$USER[SSH_PUBLIC_KEY]"
1872
1870
  else
1873
1871
  begin
1874
1872
  key=File.read(options[:ssh]).strip
@@ -1876,30 +1874,24 @@ Bash symbols must be escaped on STDIN passing'
1876
1874
  STDERR.puts e.message
1877
1875
  exit(-1)
1878
1876
  end
1879
- lines<<"SSH_PUBLIC_KEY=\"#{key}\""
1877
+ context_hash['SSH_PUBLIC_KEY'] = key
1880
1878
  end
1881
1879
  end
1882
-
1880
+
1883
1881
  if options[:net_context]
1884
- lines << 'NETWORK = "YES"'
1882
+ context_hash['NETWORK'] = "YES"
1885
1883
  end
1886
1884
 
1887
- lines+=options[:context] if options[:context]
1888
-
1889
1885
  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 << '"'
1886
+ files = options[:files_ds].map { |file| %($FILE[IMAGE=\\"#{file}\\"]) }.join(" ")
1895
1887
 
1896
- lines << text
1888
+ context_hash['FILES_DS'] = files
1897
1889
  end
1898
-
1890
+
1899
1891
  if options[:init]
1900
- lines << %(INIT_SCRIPTS="#{options[:init].join(' ')}")
1892
+ context_hash['INIT_SCRIPTS'] = options[:init].join(" ")
1901
1893
  end
1902
-
1894
+
1903
1895
  if options[:startscript]
1904
1896
  script = nil
1905
1897
  begin
@@ -1909,15 +1901,23 @@ Bash symbols must be escaped on STDIN passing'
1909
1901
  exit(-1)
1910
1902
  end
1911
1903
  script = Base64.strict_encode64(script)
1912
- lines<<"START_SCRIPT_BASE64=\"#{script}\""
1904
+ context_hash['START_SCRIPT_BASE64'] = script
1905
+
1913
1906
  end
1914
1907
 
1915
1908
  if options[:report_ready]
1916
- lines << 'REPORT_READY = "YES"'
1909
+ context_hash['REPORT_READY'] = "YES"
1917
1910
  end
1918
1911
 
1919
- if !lines.empty?
1920
- "CONTEXT=[\n" << lines.map {|l| ' ' << l }.join(",\n") << "\n]\n"
1912
+ if context_hash.any? || options[:context]
1913
+ formatted_context = "CONTEXT=[\n"
1914
+ formatted_context << options[:context].map {|l| ' ' << l }.join(",\n") if options[:context]
1915
+ if context_hash.any?
1916
+ formatted_context << ",\n" if options[:context]
1917
+ formatted_context << context_hash.map { |k, v| " #{k}=\"#{v}\"" }.join(",\n")
1918
+ end
1919
+ formatted_context << "\n]\n"
1920
+ formatted_context
1921
1921
  else
1922
1922
  nil
1923
1923
  end
@@ -1999,10 +1999,12 @@ Bash symbols must be escaped on STDIN passing'
1999
1999
  end
2000
2000
 
2001
2001
  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
-
2002
+ context_hash = {}
2003
+ if !template_obj.nil? && template_obj.has_elements?('TEMPLATE/CONTEXT')
2004
+ context_hash = template_obj.to_hash["VMTEMPLATE"]["TEMPLATE"]["CONTEXT"]
2005
+ end
2006
+ context_str=create_context_str(options, context_hash)
2007
+ template<<context_str if context_str
2006
2008
  if options[:userdata] && !template_obj.nil? && template_obj.has_elements?('TEMPLATE/EC2')
2007
2009
  template_obj.add_element(
2008
2010
  '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.3
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-02-18 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.3
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.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement