opennebula-cli 7.4.0 → 7.4.2

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.
@@ -133,6 +133,10 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
133
133
  VLAN_ID
134
134
  ]
135
135
 
136
+ MIRROR_COLUMNS = [
137
+ 'MIRROR_ID', 'NAME', 'TYPE', 'DIRECTION', 'VLANS', 'PORTS'
138
+ ].freeze
139
+
136
140
  def self.rname
137
141
  'VNET'
138
142
  end
@@ -349,6 +353,10 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
349
353
 
350
354
  def format_resource(vn, options = {})
351
355
  vn_hash = vn.to_hash
356
+ mirrors = [vn_hash['VNET']['TEMPLATE']['MIRROR']].flatten.compact
357
+ mirror_xpath = '/VNET/TEMPLATE/MIRROR'
358
+
359
+ vn.delete_element(mirror_xpath) while vn.has_elements?(mirror_xpath)
352
360
 
353
361
  str_h1='%-80s'
354
362
  CLIHelper.print_header(format(str_h1,
@@ -398,6 +406,46 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
398
406
 
399
407
  puts vn.template_str(false)
400
408
 
409
+ unless mirrors.empty?
410
+ puts
411
+ CLIHelper.print_header(format(str_h1, 'MIRRORS'), false)
412
+
413
+ CLIHelper::ShowTable.new(nil, self) do
414
+ column :ID, '', :adjust, :size => 3 do |d|
415
+ d['MIRROR_ID']
416
+ end
417
+
418
+ column :NAME, '', :left, :adjust, :size => 12 do |d|
419
+ d['NAME']
420
+ end
421
+
422
+ column :TYPE, '', :left, :size => 7 do |d|
423
+ d['TYPE']
424
+ end
425
+
426
+ column :DIRECTION, '', :left, :size => 9 do |d|
427
+ d['DIRECTION']
428
+ end
429
+
430
+ column :VLANS, '', :left, :adjust, :size => 8 do |d|
431
+ d['VLANS']
432
+ end
433
+
434
+ column :PORTS, '', :left, :adjust, :size => 12 do |d|
435
+ d['PORTS']
436
+ end
437
+
438
+ column :OPTIONS, '', :left, :adjust, :size => 15 do |d|
439
+ d.reject {|key, _value| MIRROR_COLUMNS.include?(key) }
440
+ .sort
441
+ .map {|key, value| "#{key}=#{value}" }
442
+ .join(',')
443
+ end
444
+
445
+ default :ID, :NAME, :TYPE, :DIRECTION, :VLANS, :PORTS, :OPTIONS
446
+ end.show(mirrors, {})
447
+ end
448
+
401
449
  puts
402
450
 
403
451
  CLIHelper.print_header(format(str_h1, 'ADDRESS RANGE POOL'), false)
@@ -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
@@ -14,6 +14,7 @@
14
14
  # limitations under the License. #
15
15
  #--------------------------------------------------------------------------- #
16
16
 
17
+ require 'base64'
17
18
  require 'cli_helper'
18
19
  require 'open3'
19
20
  require 'io/console'
@@ -1380,9 +1381,8 @@ Bash symbols must be escaped on STDIN passing'
1380
1381
  xsd = xsd['element']
1381
1382
  end
1382
1383
 
1383
- # rubocop:disable Style/ArrayCoercion
1384
+ # rubocop:disable-next Style/ArrayCoercion
1384
1385
  xsd = [xsd] unless xsd.is_a? Array
1385
- # rubocop:enable Style/ArrayCoercion
1386
1386
 
1387
1387
  check_xsd(hash[ename], xsd)
1388
1388
 
@@ -1436,6 +1436,12 @@ Bash symbols must be escaped on STDIN passing'
1436
1436
 
1437
1437
  hash = hash['schema']['element']
1438
1438
 
1439
+ # Schemas may define several top-level elements (e.g. vnet.xsd
1440
+ # defines MIRROR and VNET), pick the one matching the resource
1441
+ if hash.is_a?(Array)
1442
+ hash = hash.find {|e| e['name'] == ename } || hash.first
1443
+ end
1444
+
1439
1445
  replace_refs(hash)
1440
1446
  end
1441
1447
 
@@ -1872,7 +1878,7 @@ Bash symbols must be escaped on STDIN passing'
1872
1878
  res=parse_user_object(obj)
1873
1879
  return [-1, "#{section.capitalize} \"#{obj}\" malformed"] unless res
1874
1880
 
1875
- user, object=*res
1881
+ user, object = res
1876
1882
 
1877
1883
  template<<"#{section.upcase}=[\n"
1878
1884
  if section.upcase == 'NIC' && ['auto', 'dummy'].include?(object.downcase)
@@ -2440,9 +2446,8 @@ Bash symbols must be escaped on STDIN passing'
2440
2446
  when 'g'
2441
2447
  ret += rwx * 10
2442
2448
  else
2443
- # rubocop:disable Lint/UselessNumericOperation
2449
+ # rubocop:disable-next Lint/UselessNumericOperation
2444
2450
  ret += rwx * 1
2445
- # rubocop:enable Lint/UselessNumericOperation
2446
2451
  end
2447
2452
  end
2448
2453
 
@@ -77,9 +77,13 @@
77
77
  <xs:element name="DEVICE" type="xs:string"/>
78
78
  <xs:element name="DEVICE_NAME" type="xs:string"/>
79
79
  <xs:element name="DOMAIN" type="xs:string"/>
80
+ <xs:element name="ESWITCH_MODE" type="xs:string" minOccurs="0"/>
80
81
  <xs:element name="FUNCTION" type="xs:string"/>
81
82
  <xs:element name="IFNAME" type="xs:string"/>
82
83
  <xs:element name="NUMA_NODE" type="xs:string"/>
84
+ <xs:element name="PASSTHROUGH" type="xs:string" minOccurs="0"/>
85
+ <xs:element name="PF_ADDRESS" type="xs:string" minOccurs="0"/>
86
+ <xs:element name="PF_IFNAME" type="xs:string" minOccurs="0"/>
83
87
  <xs:element name="PROFILES" type="xs:string" minOccurs="0"/>
84
88
  <xs:element name="SHORT_ADDRESS" type="xs:string"/>
85
89
  <xs:element name="SLOT" type="xs:string"/>
@@ -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">
@@ -328,6 +329,8 @@
328
329
  <xs:element name="DS_MIGRATE" type="xs:string" minOccurs="0" maxOccurs="1"/>
329
330
  <xs:element name="DS_LIVE_MIGRATE" type="xs:string" minOccurs="0" maxOccurs="1"/>
330
331
  <xs:element name="DS_MIGRATE_SNAP" type="xs:string" minOccurs="0" maxOccurs="1"/>
332
+ <xs:element name="INTERACTIVE_BACKUP" type="xs:string" minOccurs="0" maxOccurs="1"/>
333
+ <xs:element name="INTERACTIVE_BACKUP_FORMATS" type="xs:string" minOccurs="0" maxOccurs="1"/>
331
334
  <xs:element name="LN_TARGET" type="xs:string" minOccurs="0" maxOccurs="1"/>
332
335
  <xs:element name="LN_TARGET_SHARED" type="xs:string" minOccurs="0" maxOccurs="1"/>
333
336
  <xs:element name="LN_TARGET_SSH" type="xs:string" minOccurs="0" maxOccurs="1"/>
@@ -124,6 +124,7 @@
124
124
  <xs:element name="MEMORY_MAX" type="xs:string" minOccurs="0" maxOccurs="1"/>
125
125
  <xs:element name="MEMORY_SLOTS" type="xs:string" minOccurs="0" maxOccurs="1"/>
126
126
  <xs:element name="MEMORY_RESIZE_MODE" type="xs:string" minOccurs="0" maxOccurs="1"/>
127
+ <xs:element name="MIRROR" minOccurs="0" maxOccurs="unbounded"/>
127
128
  <xs:element name="NIC" minOccurs="0" maxOccurs="unbounded">
128
129
  <xs:complexType>
129
130
  <xs:sequence>
@@ -193,6 +194,7 @@
193
194
  <xs:element name="VCPU_MAX" type="xs:string" minOccurs="0" maxOccurs="1"/>
194
195
  <xs:element name="VMGROUP" minOccurs="0" maxOccurs="1"/>
195
196
  <xs:element name="VMID" type="xs:string"/>
197
+ <xs:element name="VNET_UPDATE" minOccurs="0" maxOccurs="1"/>
196
198
  <xs:element name="VROUTER_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
197
199
  <xs:element name="VROUTER_KEEPALIVED_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
198
200
  <xs:element name="VROUTER_KEEPALIVED_PASSWORD" type="xs:string" minOccurs="0" maxOccurs="1"/>
@@ -2,6 +2,108 @@
2
2
  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
3
3
  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
4
4
  <xs:include schemaLocation="shared.xsd"/>
5
+ <xs:element name="MIRROR">
6
+ <xs:annotation>
7
+ <xs:documentation>
8
+ Canonical Virtual Network mirror definition. RSPAN requires OUTPUT_VLAN;
9
+ GRE and ERSPAN require
10
+ REMOTE_IP. ERSPAN requires ERSPAN_TYPE and ERSPAN_KEY, with ERSPAN_INDEX
11
+ for type II or ERSPAN_HWID for type III. These conditional requirements
12
+ and restrictions are enforced by the mirror API.
13
+ </xs:documentation>
14
+ </xs:annotation>
15
+ <xs:complexType>
16
+ <xs:all>
17
+ <xs:element name="MIRROR_ID" type="xs:nonNegativeInteger"/>
18
+ <xs:element name="NAME">
19
+ <xs:simpleType>
20
+ <xs:restriction base="xs:string">
21
+ <xs:minLength value="1"/>
22
+ </xs:restriction>
23
+ </xs:simpleType>
24
+ </xs:element>
25
+ <xs:element name="TYPE">
26
+ <xs:simpleType>
27
+ <xs:restriction base="xs:string">
28
+ <xs:enumeration value="RSPAN"/>
29
+ <xs:enumeration value="GRE"/>
30
+ <xs:enumeration value="ERSPAN"/>
31
+ </xs:restriction>
32
+ </xs:simpleType>
33
+ </xs:element>
34
+ <xs:element name="DIRECTION">
35
+ <xs:simpleType>
36
+ <xs:restriction base="xs:string">
37
+ <xs:enumeration value="IN"/>
38
+ <xs:enumeration value="OUT"/>
39
+ <xs:enumeration value="BOTH"/>
40
+ </xs:restriction>
41
+ </xs:simpleType>
42
+ </xs:element>
43
+ <xs:element name="PORTS" type="xs:string">
44
+ <xs:annotation>
45
+ <xs:documentation>Comma-separated regular VM NIC references as VM_ID:NIC_ID pairs, or empty for an inactive mirror.</xs:documentation>
46
+ </xs:annotation>
47
+ </xs:element>
48
+ <xs:element name="VLANS" type="xs:string">
49
+ <xs:annotation>
50
+ <xs:documentation>Optional filter on selected ports: comma-separated VLAN IDs from 0 to 4094, or empty. Does not enable VLAN-only capture.</xs:documentation>
51
+ </xs:annotation>
52
+ </xs:element>
53
+ <xs:element name="DESCRIPTION" type="xs:string" minOccurs="0"/>
54
+ <xs:element name="OUTPUT_VLAN" minOccurs="0">
55
+ <xs:simpleType>
56
+ <xs:restriction base="xs:integer">
57
+ <xs:minInclusive value="1"/>
58
+ <xs:maxInclusive value="4094"/>
59
+ </xs:restriction>
60
+ </xs:simpleType>
61
+ </xs:element>
62
+ <xs:element name="REMOTE_IP" type="xs:string" minOccurs="0">
63
+ <xs:annotation>
64
+ <xs:documentation>Collector IPv4 address for GRE or ERSPAN.</xs:documentation>
65
+ </xs:annotation>
66
+ </xs:element>
67
+ <xs:element name="LOCAL_IP" type="xs:string" minOccurs="0">
68
+ <xs:annotation>
69
+ <xs:documentation>Source IPv4 address or interface:name reference.</xs:documentation>
70
+ </xs:annotation>
71
+ </xs:element>
72
+ <xs:element name="ERSPAN_TYPE" minOccurs="0">
73
+ <xs:simpleType>
74
+ <xs:restriction base="xs:string">
75
+ <xs:enumeration value="II"/>
76
+ <xs:enumeration value="III"/>
77
+ </xs:restriction>
78
+ </xs:simpleType>
79
+ </xs:element>
80
+ <xs:element name="ERSPAN_KEY" minOccurs="0">
81
+ <xs:simpleType>
82
+ <xs:restriction base="xs:integer">
83
+ <xs:minInclusive value="0"/>
84
+ <xs:maxInclusive value="1023"/>
85
+ </xs:restriction>
86
+ </xs:simpleType>
87
+ </xs:element>
88
+ <xs:element name="ERSPAN_INDEX" minOccurs="0">
89
+ <xs:simpleType>
90
+ <xs:restriction base="xs:integer">
91
+ <xs:minInclusive value="0"/>
92
+ <xs:maxInclusive value="1048575"/>
93
+ </xs:restriction>
94
+ </xs:simpleType>
95
+ </xs:element>
96
+ <xs:element name="ERSPAN_HWID" minOccurs="0">
97
+ <xs:simpleType>
98
+ <xs:restriction base="xs:integer">
99
+ <xs:minInclusive value="0"/>
100
+ <xs:maxInclusive value="63"/>
101
+ </xs:restriction>
102
+ </xs:simpleType>
103
+ </xs:element>
104
+ </xs:all>
105
+ </xs:complexType>
106
+ </xs:element>
5
107
  <xs:element name="VNET">
6
108
  <xs:complexType>
7
109
  <xs:sequence>
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.2
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-11-11 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.2
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.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement