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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ffc90d78c95d12eaa1cc252ba7f1074bd66063bd2ede71145b398484e3982f97
4
- data.tar.gz: 0b00dfb8643967411b0c332750e1d2bb5a8faaff63e9340afdb651f9f76cd721
3
+ metadata.gz: 14c05f2cc71209cc247927e1ab5c4b1db6f5f7fa5bbdc557bc973616c82133d2
4
+ data.tar.gz: c6caf1dcaf934eace2c4abfe96627fe97b16c2def9027c36bb17cb160985b337
5
5
  SHA512:
6
- metadata.gz: 689a42d243447806d3a0653bc0753c4ca3052d1bad68c2f3d5e771b561b2372dac5bbb0258911788db48d4ae9afa7474f4866aaeda36e068cabcb9a1588c2863
7
- data.tar.gz: 00b1576fc2e54a5621f460b081e6fa15a2278642b4eeb1bc8ae8643826fb6433530340536bd48e79ca38f289ea563ddc85183aba9250f9bad09993f60ea25b7e
6
+ metadata.gz: bcb4e95506ee403a8bf99b9cbc861c624ff1d37e81a885c21d19f07f771926270cb39488925ec07a57b2c49ad43a80db6f1c291881792c119aa3933f138890c2
7
+ data.tar.gz: 589bd2f618df0a2732888d43617ad040526a91fbf08fc2ffb2c714454f13c84c983def1eecdaa561be6757728660ac2ec0b9607c1d1fc8f380d588d5890a06c0
data/bin/oneform CHANGED
@@ -38,8 +38,6 @@ USER_AGENT = 'CLI'
38
38
  require 'command_parser'
39
39
  require 'one_helper'
40
40
  require 'opennebula/oneform_client'
41
- require 'tempfile'
42
-
43
41
  require 'one_helper/oneform_helper'
44
42
 
45
43
  CommandParser::CmdParser.new(ARGV) do
@@ -56,7 +54,7 @@ CommandParser::CmdParser.new(ARGV) do
56
54
  :name => 'enabled',
57
55
  :short => '-e',
58
56
  :large => '--enabled',
59
- :description => 'Show only enabled providers',
57
+ :description => 'Show only enabled drivers',
60
58
  :default => false
61
59
  }
62
60
 
@@ -73,8 +71,10 @@ CommandParser::CmdParser.new(ARGV) do
73
71
  command :list,
74
72
  list_desc,
75
73
  :options => FORMAT + CLIHelper::OPTIONS + [OpenNebulaHelper::DESCRIBE, ENABLED] do
76
- enabled = options[:enabled] || false
77
- helper.list_driver_pool(helper.client(options), options, :enabled => enabled)
74
+ helper.list(helper.client(options), options)
75
+ rescue Interrupt
76
+ puts
77
+ exit(1)
78
78
  end
79
79
 
80
80
  top_desc = <<-EOT.unindent
@@ -84,11 +84,11 @@ CommandParser::CmdParser.new(ARGV) do
84
84
  command :top,
85
85
  top_desc,
86
86
  :options => FORMAT + [CLIHelper::DELAY, ENABLED] do
87
- Signal.trap('INT') { exit(-1) }
88
- enabled = options[:enabled] || false
89
- helper.top_driver_pool(helper.client(options), options, :enabled => enabled)
90
-
91
- 0
87
+ Signal.trap('INT') { exit(1) }
88
+ helper.top(helper.client(options), options)
89
+ rescue Interrupt
90
+ puts
91
+ exit(1)
92
92
  end
93
93
 
94
94
  show_desc = <<-EOT.unindent
@@ -96,9 +96,10 @@ CommandParser::CmdParser.new(ARGV) do
96
96
  EOT
97
97
 
98
98
  command :show, show_desc, :driver_name, :options => FORMAT do
99
- driver_name = args[0]
100
-
101
- helper.format_resource(helper.client(options), driver_name, options)
99
+ helper.show(helper.client(options), args[0], options)
100
+ rescue Interrupt
101
+ puts
102
+ exit(1)
102
103
  end
103
104
 
104
105
  sync_desc = <<-EOT.unindent
@@ -106,14 +107,10 @@ CommandParser::CmdParser.new(ARGV) do
106
107
  EOT
107
108
 
108
109
  command :sync, sync_desc do
109
- client = helper.client(options)
110
-
111
- response = client.sync_drivers
112
-
113
- return [response[:err_code], response[:message]] \
114
- if CloudClient.is_error?(response)
115
-
116
- 0
110
+ helper.sync(helper.client(options))
111
+ rescue Interrupt
112
+ puts
113
+ exit(1)
117
114
  end
118
115
 
119
116
  enable_desc = <<-EOT.unindent
@@ -121,15 +118,10 @@ CommandParser::CmdParser.new(ARGV) do
121
118
  EOT
122
119
 
123
120
  command :enable, enable_desc, :driver_name do
124
- client = helper.client(options)
125
- driver_name = args[0]
126
-
127
- response = client.enable_driver(driver_name)
128
-
129
- return [response[:err_code], response[:message]] \
130
- if CloudClient.is_error?(response)
131
-
132
- 0
121
+ helper.enable(helper.client(options), args[0])
122
+ rescue Interrupt
123
+ puts
124
+ exit(1)
133
125
  end
134
126
 
135
127
  disable_desc = <<-EOT.unindent
@@ -137,14 +129,9 @@ CommandParser::CmdParser.new(ARGV) do
137
129
  EOT
138
130
 
139
131
  command :disable, disable_desc, :driver_name do
140
- client = helper.client(options)
141
- driver_name = args[0]
142
-
143
- response = client.disable_driver(driver_name)
144
-
145
- return [response[:err_code], response[:message]] \
146
- if CloudClient.is_error?(response)
147
-
148
- 0
132
+ helper.disable(helper.client(options), args[0])
133
+ rescue Interrupt
134
+ puts
135
+ exit(1)
149
136
  end
150
137
  end
data/bin/oneuser CHANGED
@@ -773,13 +773,11 @@ CommandParser::CmdParser.new(ARGV) do
773
773
  auth_string = "#{user['NAME']}:#{token}"
774
774
  auth_file = helper.auth_file(auth_string)
775
775
 
776
- # rubocop:disable Lint/SuppressedException
777
776
  begin
778
777
  File.unlink(auth_file)
779
778
  puts "Removing #{auth_file}"
780
779
  rescue Errno::ENOENT
781
780
  end
782
- # rubocop:enable Lint/SuppressedException
783
781
 
784
782
  0
785
783
  end
data/bin/onevm CHANGED
@@ -237,6 +237,13 @@ CommandParser::CmdParser.new(ARGV) do
237
237
  :description => 'Select PCI device by its class ID'
238
238
  }
239
239
 
240
+ PF = {
241
+ :name => 'pf',
242
+ :large => '--pf interface',
243
+ :format => String,
244
+ :description => 'Select a virtual function by its parent PF interface name'
245
+ }
246
+
240
247
  RESET_BACKUP = {
241
248
  :name => 'reset',
242
249
  :large => '--reset',
@@ -659,10 +666,10 @@ CommandParser::CmdParser.new(ARGV) do
659
666
  end
660
667
 
661
668
  migrate_desc = <<-EOT.unindent
662
- Migrates the given running VM to another Host. If used with --live
669
+ Migrates the given VM to another Host. If used with --live
663
670
  parameter the migration is done without downtime.
664
671
 
665
- States: RUNNING
672
+ States: RUNNING, SUSPENDED, POWEROFF
666
673
  EOT
667
674
 
668
675
  command :migrate, migrate_desc, [:range, :vmid_list], :hostid,
@@ -867,6 +874,8 @@ CommandParser::CmdParser.new(ARGV) do
867
874
  To hotplug a PCI device and use it as a NIC interface in the VM select
868
875
  it with --pci (short_address) or --pci_device (device ID),
869
876
  --pci_class (class ID) and/or --pci_vendor (vendor ID).
877
+ Use --pf (interface name) to select a virtual function from a physical
878
+ function. Specify the virtual network with --network.
870
879
 
871
880
  States: RUNNING, POWEROFF
872
881
  EOT
@@ -881,7 +890,8 @@ CommandParser::CmdParser.new(ARGV) do
881
890
  PCI,
882
891
  PCI_CLASS,
883
892
  PCI_VENDOR,
884
- PCI_DEVICE
893
+ PCI_DEVICE,
894
+ PF
885
895
  ] do
886
896
  if options[:file]
887
897
  template = File.read(options[:file])
@@ -893,7 +903,7 @@ CommandParser::CmdParser.new(ARGV) do
893
903
  nic_alias = options[:alias]
894
904
  nic_name = options[:nic_name]
895
905
 
896
- is_pci = [:pci, :pci_device, :pci_vendor, :pci_class].any? do |o|
906
+ is_pci = [:pci, :pci_device, :pci_vendor, :pci_class, :pf].any? do |o|
897
907
  !options[o].nil?
898
908
  end
899
909
 
@@ -902,6 +912,7 @@ CommandParser::CmdParser.new(ARGV) do
902
912
  pcid = options[:pci_device]
903
913
  pcic = options[:pci_class]
904
914
  pciv = options[:pci_vendor]
915
+ pf = options[:pf]
905
916
 
906
917
  template = 'PCI = [ TYPE = NIC'
907
918
  template << ", NETWORK_ID = #{network_id}"
@@ -909,6 +920,7 @@ CommandParser::CmdParser.new(ARGV) do
909
920
  template << ", DEVICE = \"#{pcid}\"" if pcid
910
921
  template << ", CLASS = \"#{pcic}\"" if pcic
911
922
  template << ", VENDOR = \"#{pciv}\"" if pciv
923
+ template << ", PF_IFNAME = \"#{pf}\"" if pf
912
924
  elsif nic_alias
913
925
  template = "NIC_ALIAS = [ PARENT = #{nic_alias}"
914
926
  template << ", NETWORK_ID = #{network_id}"
@@ -946,7 +958,13 @@ CommandParser::CmdParser.new(ARGV) do
946
958
  end
947
959
 
948
960
  nic_update_desc = <<-EOT.unindent
949
- Updates a NIC for a VM. In case the VM is running, trigger NIC update on the host.
961
+ Updates the QoS attributes of a VM NIC. If the VM is running, also updates the NIC
962
+ on the host.
963
+
964
+ Only the following attributes can be updated:
965
+ INBOUND_AVG_BW, INBOUND_PEAK_BW, INBOUND_PEAK_KB,
966
+ OUTBOUND_AVG_BW, OUTBOUND_PEAK_BW, OUTBOUND_PEAK_KB.
967
+ Other NIC attributes are ignored.
950
968
 
951
969
  States: Almost all, except BOOT*, MIGRATE and HOTPLUG-NIC
952
970
  EOT
@@ -1445,10 +1463,10 @@ CommandParser::CmdParser.new(ARGV) do
1445
1463
  INPUT = ["TYPE", "BUS"]
1446
1464
  GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP", "COMMAND"]
1447
1465
  VIDEO = ["TYPE", "IOMMU", "ATS", "VRAM", "RESOLUTION"]
1448
- RAW = ["DATA", "DATA_VMX", "TYPE", "VALIDATE"]
1466
+ RAW = ["DATA", "TYPE", "VALIDATE"]
1449
1467
  CPU_MODEL = ["MODEL", "FEATURES"]
1450
1468
  BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE", "INCREMENT_MODE", "INTERACTIVE"]
1451
- CONTEXT (any value, ETH* if CONTEXT_ALLOW_ETH_UPDATES set in oned.conf, **variable substitution will be made**)
1469
+ CONTEXT (any value, ETH* if NETWORK is not YES or CONTEXT_ALLOW_ETH_UPDATES set in oned.conf, **variable substitution will be made**)
1452
1470
  EOT
1453
1471
 
1454
1472
  command :updateconf, updateconf_desc, :vmid, [:file, nil],
@@ -1720,14 +1738,6 @@ CommandParser::CmdParser.new(ARGV) do
1720
1738
  end
1721
1739
  end
1722
1740
 
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
1741
  pci_attach_desc = <<-EOT.unindent
1732
1742
  Attaches a PCI to a VM.
1733
1743
 
@@ -1790,6 +1800,14 @@ CommandParser::CmdParser.new(ARGV) do
1790
1800
  end
1791
1801
  end
1792
1802
 
1803
+ ssh_desc = <<-EOT.unindent
1804
+ SSH into VM
1805
+
1806
+ Options example:
1807
+
1808
+ '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
1809
+ EOT
1810
+
1793
1811
  command :ssh,
1794
1812
  ssh_desc,
1795
1813
  :vmid,
@@ -1818,15 +1836,7 @@ CommandParser::CmdParser.new(ARGV) do
1818
1836
  exit(-1)
1819
1837
  end
1820
1838
 
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?
1839
+ nic = helper.ssh_nic(vm, options[:nic_id])
1830
1840
 
1831
1841
  if nic.nil?
1832
1842
  STDERR.puts 'No NIC found'
data/bin/onevnet CHANGED
@@ -474,4 +474,99 @@ CommandParser::CmdParser.new(ARGV) do
474
474
  vn.recover(result)
475
475
  end
476
476
  end
477
+
478
+ mirror_create_desc = <<-EOT.unindent
479
+ Creates a traffic mirror on the Virtual Network
480
+ EOT
481
+
482
+ command :'mirror-create', mirror_create_desc, :vnetid, [:file, nil] do
483
+ helper.perform_action(args[0], options, 'mirror created') do |vn|
484
+ template = args[1] ? File.read(args[1]) : OpenNebulaHelper.read_stdin
485
+
486
+ if template.empty?
487
+ STDERR.puts 'A mirror template must be provided as a file or on stdin'
488
+ exit(-1)
489
+ end
490
+
491
+ mirror_id = vn.mirror_create(template)
492
+
493
+ puts "Mirror ID: #{mirror_id}" unless OpenNebula.is_error?(mirror_id)
494
+
495
+ mirror_id
496
+ end
497
+ end
498
+
499
+ mirror_update_desc = <<-EOT.unindent
500
+ Updates traffic mirror configuration. Use mirror-addport and
501
+ mirror-delport to change selected VM NICs. If a path is not provided,
502
+ the editor will be launched with the current mirror configuration.
503
+ EOT
504
+
505
+ command :'mirror-update', mirror_update_desc, :vnetid, :mirror_id,
506
+ [:file, nil], :options => OpenNebulaHelper::APPEND do
507
+ begin
508
+ mirror_id = Integer(args[1], 10)
509
+ rescue ArgumentError, TypeError
510
+ STDERR.puts "Invalid mirror ID: #{args[1]}"
511
+ exit(-1)
512
+ end
513
+
514
+ helper.perform_action(args[0], options, 'mirror updated') do |vn|
515
+ if args[2]
516
+ template = File.read(args[2])
517
+ elsif !(stdin = OpenNebulaHelper.read_stdin).empty?
518
+ template = stdin
519
+ else
520
+ rc = vn.info
521
+
522
+ if OpenNebula.is_error?(rc)
523
+ STDERR.puts rc.message
524
+ exit(-1)
525
+ end
526
+
527
+ template = vn.template_like_str(
528
+ 'TEMPLATE', true, "MIRROR[MIRROR_ID=#{mirror_id}]"
529
+ )
530
+
531
+ if template.empty?
532
+ STDERR.puts "MIRROR_ID #{mirror_id} does not exist"
533
+ exit(-1)
534
+ end
535
+
536
+ template = OpenNebulaHelper.editor_input(template)
537
+ end
538
+
539
+ vn.mirror_update(mirror_id, template, options[:append])
540
+ end
541
+ end
542
+
543
+ mirror_addport_desc = <<-EOT.unindent
544
+ Adds a comma-separated VM_ID:NIC_ID list to a traffic mirror
545
+ EOT
546
+
547
+ command :'mirror-addport', mirror_addport_desc, :vnetid, :mirror_id, :ports do
548
+ helper.perform_action(args[0], options, 'mirror ports added') do |vn|
549
+ vn.mirror_addport(args[1], args[2])
550
+ end
551
+ end
552
+
553
+ mirror_delport_desc = <<-EOT.unindent
554
+ Removes a comma-separated VM_ID:NIC_ID list from a traffic mirror
555
+ EOT
556
+
557
+ command :'mirror-delport', mirror_delport_desc, :vnetid, :mirror_id, :ports do
558
+ helper.perform_action(args[0], options, 'mirror ports removed') do |vn|
559
+ vn.mirror_delport(args[1], args[2])
560
+ end
561
+ end
562
+
563
+ mirror_delete_desc = <<-EOT.unindent
564
+ Deletes a traffic mirror from the Virtual Network
565
+ EOT
566
+
567
+ command :'mirror-delete', mirror_delete_desc, :vnetid, :mirror_id do
568
+ helper.perform_action(args[0], options, 'mirror deleted') do |vn|
569
+ vn.mirror_delete(args[1])
570
+ end
571
+ end
477
572
  end
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
@@ -97,9 +97,8 @@ module CommandParser
97
97
  # @param [String] str
98
98
  def usage(str)
99
99
  @usage = str
100
- # rubocop:disable Naming/MemoizedInstanceVariableName
100
+ # rubocop:disable-next Naming/MemoizedInstanceVariableName
101
101
  @name ||= @usage.split(' ').first
102
- # rubocop:enable Naming/MemoizedInstanceVariableName
103
102
  end
104
103
 
105
104
  # Defines the version the command