opennebula-cli 7.4.0 → 7.4.1

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: ffc90d78c95d12eaa1cc252ba7f1074bd66063bd2ede71145b398484e3982f97
4
- data.tar.gz: 0b00dfb8643967411b0c332750e1d2bb5a8faaff63e9340afdb651f9f76cd721
3
+ metadata.gz: 1d12195ac5f81fb49dacff52feeb49f7084a56e7189ad1b4e16eb998e3c1e714
4
+ data.tar.gz: 321342df45b67dfd31d84a6bae0979c0c730231270f278865daaf54261e7e6eb
5
5
  SHA512:
6
- metadata.gz: 689a42d243447806d3a0653bc0753c4ca3052d1bad68c2f3d5e771b561b2372dac5bbb0258911788db48d4ae9afa7474f4866aaeda36e068cabcb9a1588c2863
7
- data.tar.gz: 00b1576fc2e54a5621f460b081e6fa15a2278642b4eeb1bc8ae8643826fb6433530340536bd48e79ca38f289ea563ddc85183aba9250f9bad09993f60ea25b7e
6
+ metadata.gz: 7453438e378077c78ea2a841caff821ff1865fdc65db7405e8aa2b2f60b45bf8641303a36b28e8f7d1a62e2fba7a2350c5c3770fad792e081ece03f0a305a15c
7
+ data.tar.gz: 9b82fc5f4180cf3088cfb88eb221dc7fbd7b6495e5b7ec145e1355c8c2868242db61c0d420210215290022eea1ef5b0e4eeea4151a889b6873a832f4a5c206b3
data/bin/onevm CHANGED
@@ -1445,7 +1445,7 @@ CommandParser::CmdParser.new(ARGV) do
1445
1445
  INPUT = ["TYPE", "BUS"]
1446
1446
  GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP", "COMMAND"]
1447
1447
  VIDEO = ["TYPE", "IOMMU", "ATS", "VRAM", "RESOLUTION"]
1448
- RAW = ["DATA", "DATA_VMX", "TYPE", "VALIDATE"]
1448
+ RAW = ["DATA", "TYPE", "VALIDATE"]
1449
1449
  CPU_MODEL = ["MODEL", "FEATURES"]
1450
1450
  BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE", "INCREMENT_MODE", "INTERACTIVE"]
1451
1451
  CONTEXT (any value, ETH* if CONTEXT_ALLOW_ETH_UPDATES set in oned.conf, **variable substitution will be made**)
@@ -1720,14 +1720,6 @@ CommandParser::CmdParser.new(ARGV) do
1720
1720
  end
1721
1721
  end
1722
1722
 
1723
- ssh_desc = <<-EOT.unindent
1724
- SSH into VM
1725
-
1726
- Options example:
1727
-
1728
- '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
1729
- EOT
1730
-
1731
1723
  pci_attach_desc = <<-EOT.unindent
1732
1724
  Attaches a PCI to a VM.
1733
1725
 
@@ -1790,6 +1782,14 @@ CommandParser::CmdParser.new(ARGV) do
1790
1782
  end
1791
1783
  end
1792
1784
 
1785
+ ssh_desc = <<-EOT.unindent
1786
+ SSH into VM
1787
+
1788
+ Options example:
1789
+
1790
+ '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
1791
+ EOT
1792
+
1793
1793
  command :ssh,
1794
1794
  ssh_desc,
1795
1795
  :vmid,
@@ -1818,15 +1818,7 @@ CommandParser::CmdParser.new(ARGV) do
1818
1818
  exit(-1)
1819
1819
  end
1820
1820
 
1821
- if options[:nic_id]
1822
- nic = vm.retrieve_xmlelements(
1823
- "//TEMPLATE/NIC[NIC_ID=\"#{options[:nic_id]}\"]"
1824
- )[0]
1825
- else
1826
- nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[SSH="YES"]')[0]
1827
- end
1828
-
1829
- nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[1]')[0] if nic.nil?
1821
+ nic = helper.ssh_nic(vm, options[:nic_id])
1830
1822
 
1831
1823
  if nic.nil?
1832
1824
  STDERR.puts 'No NIC found'
data/bin/onezone CHANGED
@@ -57,6 +57,12 @@ CommandParser::CmdParser.new(ARGV) do
57
57
  :description => 'Also sync database'
58
58
  }
59
59
 
60
+ KEEP_HA = {
61
+ :name => 'keep_ha',
62
+ :large => '--keep-ha',
63
+ :description => 'Keep local HA configuration parameters'
64
+ }
65
+
60
66
  before_proc do
61
67
  helper.set_client(options)
62
68
  end
@@ -247,7 +253,7 @@ CommandParser::CmdParser.new(ARGV) do
247
253
  This command must be executed under root
248
254
  EOT
249
255
 
250
- command :serversync, sync_desc, :server, :options => [DATABASE] do
256
+ command :serversync, sync_desc, :server, :options => [DATABASE, KEEP_HA] do
251
257
  begin
252
258
  require 'augeas'
253
259
  rescue Gem::LoadError
@@ -264,7 +270,7 @@ CommandParser::CmdParser.new(ARGV) do
264
270
  end
265
271
 
266
272
  server = Replicator.new('/var/lib/one/.ssh/id_rsa', args[0])
267
- server.process_files(options[:db])
273
+ server.process_files(options[:db], options[:keep_ha])
268
274
 
269
275
  0
270
276
  end
@@ -610,15 +610,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
610
610
  options[:cmd].nil? ? cmd = '' : cmd = options[:cmd]
611
611
 
612
612
  # Get NIC to connect
613
- if options[:nic_id]
614
- nic = vm.retrieve_xmlelements(
615
- "//TEMPLATE/NIC[NIC_ID=\"#{options[:nic_id]}\"]"
616
- )[0]
617
- else
618
- nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[SSH="YES"]')[0]
619
- end
620
-
621
- nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[1]')[0] if nic.nil?
613
+ nic = ssh_nic(vm, options[:nic_id])
622
614
 
623
615
  if nic.nil?
624
616
  STDERR.puts 'No NIC found'
@@ -657,6 +649,33 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
657
649
  end
658
650
  end
659
651
 
652
+ def ssh_nic(vm, nic_id)
653
+ if nic_id
654
+ nic = vm.retrieve_xmlelements(
655
+ "//TEMPLATE/NIC[NIC_ID=\"#{nic_id}\"]"
656
+ )[0]
657
+ return nic unless nic.nil?
658
+
659
+ nic = vm.retrieve_xmlelements(
660
+ "//TEMPLATE/PCI[TYPE=\"NIC\"][NIC_ID=\"#{nic_id}\"]"
661
+ )[0]
662
+ else
663
+ nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[SSH="YES"]')[0]
664
+ return nic unless nic.nil?
665
+
666
+ nic = vm.retrieve_xmlelements(
667
+ '//TEMPLATE/PCI[TYPE="NIC"][SSH="YES"]'
668
+ )[0]
669
+ end
670
+
671
+ return nic unless nic.nil?
672
+
673
+ nic = vm.retrieve_xmlelements('//TEMPLATE/NIC[1]')[0]
674
+ return nic unless nic.nil?
675
+
676
+ vm.retrieve_xmlelements('//TEMPLATE/PCI[TYPE="NIC"][NIC_ID>-1]')[0]
677
+ end
678
+
660
679
  private
661
680
 
662
681
  def factory(id = nil)
@@ -28,7 +28,15 @@ class Replicator
28
28
 
29
29
  SSH_OPTIONS = '-o stricthostkeychecking=no -o passwordauthentication=no'
30
30
  ONE_AUTH = '/var/lib/one/.one/one_auth'
31
- FED_ATTRS = ['MODE', 'ZONE_ID', 'SERVER_ID', 'MASTER_ONED']
31
+ FED_ATTRS = ['MODE', 'ZONE_ID', 'SERVER_ID', 'MASTER_ONED',
32
+ 'MASTER_ONED_GRPC']
33
+ HA_ATTRS = {
34
+ 'RAFT' => ['LIMIT_PURGE', 'LOG_RETENTION', 'LOG_PURGE_TIMEOUT',
35
+ 'ELECTION_TIMEOUT_MS', 'BROADCAST_TIMEOUT_MS',
36
+ 'XMLRPC_TIMEOUT_MS'],
37
+ 'RAFT_LEADER_HOOK' => ['COMMAND', 'ARGUMENTS'],
38
+ 'RAFT_FOLLOWER_HOOK' => ['COMMAND', 'ARGUMENTS']
39
+ }
32
40
 
33
41
  FILES = [
34
42
  { :name => 'monitord.conf',
@@ -99,9 +107,10 @@ class Replicator
99
107
  # Process files and folders
100
108
  #
101
109
  # @param sync_database [Boolean] True to sync database
102
- def process_files(sync_database)
110
+ # @param keep_ha [Boolean] True to keep local HA configuration
111
+ def process_files(sync_database, keep_ha = false)
103
112
  # Files to be copied
104
- copy_onedconf
113
+ copy_onedconf(keep_ha)
105
114
 
106
115
  FILES.each do |file|
107
116
  copy_and_check(file[:name], file[:service])
@@ -216,8 +225,10 @@ class Replicator
216
225
  # oned.conf file on distributed environments will always be different,
217
226
  # due to the federation section.
218
227
  # Replace oned.conf based on a remote server's version maintaining
219
- # the old FEDERATION section
220
- def copy_onedconf
228
+ # the old FEDERATION section and, optionally, the local HA parameters.
229
+ #
230
+ # @param keep_ha [Boolean] True to keep local HA configuration
231
+ def copy_onedconf(keep_ha)
221
232
  puts 'Checking oned.conf'
222
233
 
223
234
  # Create temporarhy files
@@ -266,6 +277,19 @@ class Replicator
266
277
  fed_attrs << l_aug.get("FEDERATION/#{attr}")
267
278
  end
268
279
 
280
+ ha_attrs = {}
281
+
282
+ if keep_ha
283
+ HA_ATTRS.each do |section, attrs|
284
+ ha_attrs[section] = attrs.map do |attr|
285
+ l_aug.get("#{section}/#{attr}")
286
+ end
287
+
288
+ l_aug.rm(section)
289
+ r_aug.rm(section)
290
+ end
291
+ end
292
+
269
293
  # Remove federation section
270
294
  l_aug.rm('FEDERATION')
271
295
  r_aug.rm('FEDERATION')
@@ -286,6 +310,12 @@ class Replicator
286
310
  r_aug.set("FEDERATION/#{name}", value)
287
311
  end
288
312
 
313
+ ha_attrs.each do |section, values|
314
+ HA_ATTRS[section].zip(values) do |name, value|
315
+ r_aug.set("#{section}/#{name}", value) unless value.nil?
316
+ end
317
+ end
318
+
289
319
  r_aug.save
290
320
 
291
321
  FileUtils.cp(r_oned.path, '/etc/one/oned.conf')
data/lib/one_helper.rb CHANGED
@@ -1872,7 +1872,7 @@ Bash symbols must be escaped on STDIN passing'
1872
1872
  res=parse_user_object(obj)
1873
1873
  return [-1, "#{section.capitalize} \"#{obj}\" malformed"] unless res
1874
1874
 
1875
- user, object=*res
1875
+ user, object = res
1876
1876
 
1877
1877
  template<<"#{section.upcase}=[\n"
1878
1878
  if section.upcase == 'NIC' && ['auto', 'dummy'].include?(object.downcase)
@@ -285,6 +285,7 @@
285
285
  </xs:complexType>
286
286
  </xs:element>
287
287
 
288
+ <xs:element name="REUSE_ADDRESS" type="xs:string" minOccurs="0" maxOccurs="1"/>
288
289
  <xs:element name="RPC_LOG" type="xs:string" minOccurs="0" maxOccurs="1"/>
289
290
 
290
291
  <xs:element name="SCHED_MAD" minOccurs="0" maxOccurs="1">
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: 7.4.0
4
+ version: 7.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-07-27 00:00:00.000000000 Z
11
+ date: 2026-09-09 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: 7.4.0
19
+ version: 7.4.1
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: 7.4.0
26
+ version: 7.4.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement