opennebula-cli 4.13.80.beta1 → 4.13.85.beta2

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
  SHA1:
3
- metadata.gz: d11d3a159c5097cd0867e860e3830a6caf5847b9
4
- data.tar.gz: 096c01365fc81804718fe90037c31d4fdbbe76cb
3
+ metadata.gz: 5fca91efa12f85597ee352ef8adde81871f59fe1
4
+ data.tar.gz: 9bbb6d98f3434e31f02d11d14f7a3daa694f34a2
5
5
  SHA512:
6
- metadata.gz: 93738a9b287d2bf42334703b3de47516b2c9f2dcc77212bd98548f08e624bd125a7f399c314f9d68ed01cce0e29ccf96d47ecffc7eef0b698e0a2d2f670662d0
7
- data.tar.gz: e15e685a4061d48d2e81b1baa99edd11ee22665dc49f3f0db42283d229a73d05e18595a21bc047bf153c9d6916231581cc75310aaaff76a98ce9e1b3c88daf9c
6
+ metadata.gz: 53809bc7e557e85afa901241fe8b548ca151c2ce155c32d221e61c0df9f0cda3b3f5878774cecf05043c7077669877ee508c626a42f5ee131404008b37277a9d
7
+ data.tar.gz: 9770250b6a5dbea174bd51248d3985ac6b9d12595ad82ece9af4a3fe163c90992a6bfa09d948974c027e75788aca1f52aa0c92a2d031347d1236dd0580323a9a
data/bin/onetemplate CHANGED
@@ -319,7 +319,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
319
319
  Shows information for the given Template
320
320
  EOT
321
321
 
322
- command :show, show_desc, :templateid, :options=>OpenNebulaHelper::XML do
322
+ command :show, show_desc, :templateid,
323
+ :options=>[OpenNebulaHelper::XML,OneTemplateHelper::EXTENDED] do
324
+
323
325
  helper.show_resource(args[0],options)
324
326
  end
325
327
 
data/bin/onevcenter CHANGED
@@ -115,7 +115,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
115
115
  next if STDIN.gets.strip.downcase != 'y'
116
116
 
117
117
  if cluster.empty?
118
- STDOUT.puts " No clusters found in #{dc}..."
118
+ STDOUT.puts " No new clusters found in #{dc}..."
119
119
  next
120
120
  end
121
121
 
data/bin/onevm CHANGED
@@ -812,7 +812,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
812
812
  Takes a new snapshot of the given disk. This operation needs support
813
813
  from the Datastore drivers: QCOW2 or Ceph.
814
814
 
815
- States: POWEROFF
815
+ States: RUNNING, POWEROFF, SUSPENDED
816
816
  EOT
817
817
 
818
818
  command :"disk-snapshot-create", disk_snapshot_create_desc,
@@ -825,7 +825,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
825
825
  disk_snapshot_revert_desc = <<-EOT.unindent
826
826
  Reverts disk state to a previously taken snapshot.
827
827
 
828
- States: POWEROFF
828
+ States: RUNNING, POWEROFF, SUSPENDED
829
829
  EOT
830
830
 
831
831
  command :"disk-snapshot-revert", disk_snapshot_revert_desc,
@@ -838,7 +838,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
838
838
  disk_snapshot_delete_desc = <<-EOT.unindent
839
839
  Deletes a disk snapshot.
840
840
 
841
- States: POWEROFF
841
+ States: RUNNING, POWEROFF, SUSPENDED
842
842
  EOT
843
843
  command :"disk-snapshot-delete", disk_snapshot_delete_desc,
844
844
  :vmid, :diskid, :snapshot_id do
@@ -117,8 +117,8 @@ class OneGroupHelper < OpenNebulaHelper::OneHelper
117
117
  "CPU_USED" => "0",
118
118
  "MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
119
119
  "MEMORY_USED" => "0",
120
- "VOLATILE_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
121
- "VOLATILE_SIZE_USED" => "0"
120
+ "SYSTEM_DISK_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
121
+ "SYSTEM_DISK_SIZE_USED" => "0"
122
122
  }
123
123
 
124
124
  quotas[d['ID']] = q
@@ -154,8 +154,8 @@ class OneGroupHelper < OpenNebulaHelper::OneHelper
154
154
  "CPU_USED" => "0",
155
155
  "MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
156
156
  "MEMORY_USED" => "0",
157
- "VOLATILE_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
158
- "VOLATILE_SIZE_USED" => "0"
157
+ "SYSTEM_DISK_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
158
+ "SYSTEM_DISK_SIZE_USED" => "0"
159
159
  }
160
160
 
161
161
  quotas[d['ID']] = q
@@ -194,8 +194,8 @@ class OneGroupHelper < OpenNebulaHelper::OneHelper
194
194
  "CPU_USED" => "0",
195
195
  "MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
196
196
  "MEMORY_USED" => "0",
197
- "VOLATILE_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
198
- "VOLATILE_SIZE_USED" => "0"
197
+ "SYSTEM_DISK_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
198
+ "SYSTEM_DISK_SIZE_USED" => "0"
199
199
  }
200
200
 
201
201
  quotas[d['ID']] = q
@@ -413,11 +413,22 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
413
413
 
414
414
  wilds = host.wilds
415
415
 
416
+ begin
417
+ pcis = [host.to_hash['HOST']['HOST_SHARE']['PCI_DEVICES']['PCI']]
418
+ pcis = pcis.flatten.compact
419
+ rescue
420
+ pcis = nil
421
+ end
422
+
416
423
  host.delete_element("TEMPLATE/VM")
417
424
  host.delete_element("TEMPLATE_WILDS")
418
425
 
419
426
  puts host.template_str
420
427
 
428
+ if pcis && !pcis.empty?
429
+ print_pcis(pcis)
430
+ end
431
+
421
432
  puts
422
433
  CLIHelper.print_header("WILD VIRTUAL MACHINES", false)
423
434
  puts
@@ -457,4 +468,45 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
457
468
  onevm_helper.client=@client
458
469
  onevm_helper.list_pool({:filter=>["HOST=#{host.name}"]}, false)
459
470
  end
471
+
472
+ def print_pcis(pcis)
473
+ puts
474
+ CLIHelper.print_header("PCI DEVICES", false)
475
+ puts
476
+
477
+ table=CLIHelper::ShowTable.new(nil, self) do
478
+ column :VM, "Used by VM", :size => 5, :left => false do |d|
479
+ if d["VMID"] == "-1"
480
+ ""
481
+ else
482
+ d["VMID"]
483
+ end
484
+ end
485
+
486
+ column :ADDR, "PCI Address", :size => 7, :left => true do |d|
487
+ d["SHORT_ADDRESS"]
488
+ end
489
+
490
+ column :TYPE, "Type", :size => 14, :left => true do |d|
491
+ d["TYPE"]
492
+ end
493
+
494
+ column :CLASS, "Class", :size => 12, :left => true do |d|
495
+ d["CLASS_NAME"]
496
+ end
497
+
498
+ column :NAME, "Name", :size => 50, :left => true do |d|
499
+ d["DEVICE_NAME"]
500
+ end
501
+
502
+ column :VENDOR, "Vendor", :size => 8, :left => true do |d|
503
+ d["VENDOR_NAME"]
504
+ end
505
+
506
+ default :VM, :ADDR, :TYPE, :NAME
507
+
508
+ end
509
+
510
+ table.show(pcis)
511
+ end
460
512
  end
@@ -339,7 +339,19 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
339
339
  d["CHILDREN"]
340
340
  end
341
341
 
342
- column :NAME, "Snapshot Name", :left, :size=>45 do |d|
342
+ column :SIZE, "", :left, :size=>8 do |d|
343
+ if d["SIZE"]
344
+ OpenNebulaHelper.unit_to_str(
345
+ d['SIZE'].to_i,
346
+ {},
347
+ "M"
348
+ )
349
+ else
350
+ "-"
351
+ end
352
+ end
353
+
354
+ column :NAME, "Snapshot Name", :left, :size=>37 do |d|
343
355
  d["NAME"]
344
356
  end
345
357
 
@@ -347,7 +359,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
347
359
  OpenNebulaHelper.time_to_str(d["DATE"])
348
360
  end
349
361
 
350
- default :AC, :ID, :PARENT, :DATE, :CHILDREN, :NAME
362
+ default :AC, :ID, :PARENT, :DATE, :SIZE, :NAME
351
363
  end
352
364
 
353
365
  # Convert snapshot data to an array
@@ -34,10 +34,10 @@ class OneQuotaHelper
34
34
  # ]
35
35
  #
36
36
  # VM = [
37
- # VMS = <Max. number of VMs>
38
- # MEMORY = <Max. allocated memory (MB)>
39
- # CPU = <Max. allocated CPU>
40
- # VOLATILE_SIZE = <Max. allocated volatile disks (MB)>
37
+ # VMS = <Max. number of VMs>
38
+ # MEMORY = <Max. allocated memory (MB)>
39
+ # CPU = <Max. allocated CPU>
40
+ # SYSTEM_DISK_SIZE = <Max. allocated system disk (MB)>
41
41
  # ]
42
42
  #
43
43
  # NETWORK = [
@@ -216,8 +216,8 @@ class OneQuotaHelper
216
216
  "CPU_USED" => "0",
217
217
  "MEMORY" => limit,
218
218
  "MEMORY_USED" => "0",
219
- "VOLATILE_SIZE" => limit,
220
- "VOLATILE_SIZE_USED" => "0"
219
+ "SYSTEM_DISK_SIZE" => limit,
220
+ "SYSTEM_DISK_SIZE_USED" => "0"
221
221
  }]
222
222
  end
223
223
 
@@ -273,20 +273,20 @@ class OneQuotaHelper
273
273
  end
274
274
  end
275
275
 
276
- column :"VOLATILE_SIZE", "", :right, :size=>20 do |d|
276
+ column :"SYSTEM_DISK_SIZE", "", :right, :size=>20 do |d|
277
277
  if !d.nil?
278
- elem = 'VOLATILE_SIZE'
278
+ elem = 'SYSTEM_DISK_SIZE'
279
279
  limit = d[elem]
280
280
  limit = helper.get_default_limit(
281
281
  limit, "VM_QUOTA/VM/#{elem}")
282
282
 
283
283
  if limit == LIMIT_UNLIMITED
284
284
  "%8s / -" % [
285
- OpenNebulaHelper.unit_to_str(d["VOLATILE_SIZE_USED"].to_i,{},"M")
285
+ OpenNebulaHelper.unit_to_str(d["SYSTEM_DISK_SIZE_USED"].to_i,{},"M")
286
286
  ]
287
287
  else
288
288
  "%8s / %8s" % [
289
- OpenNebulaHelper.unit_to_str(d["VOLATILE_SIZE_USED"].to_i,{},"M"),
289
+ OpenNebulaHelper.unit_to_str(d["SYSTEM_DISK_SIZE_USED"].to_i,{},"M"),
290
290
  OpenNebulaHelper.unit_to_str(limit.to_i,{},"M")
291
291
  ]
292
292
  end
@@ -43,6 +43,13 @@ EOT
43
43
  :description => "Integrate userdata into the EC2 section"
44
44
  }
45
45
 
46
+ EXTENDED={
47
+ :name => "extended",
48
+ :large => "--extended",
49
+ :description => "Process the template and included extended "+
50
+ "information, such as the SIZE for each DISK"
51
+ }
52
+
46
53
  def self.rname
47
54
  "VMTEMPLATE"
48
55
  end
@@ -51,6 +58,26 @@ EOT
51
58
  "onetemplate.yaml"
52
59
  end
53
60
 
61
+
62
+ def show_resource(id, options)
63
+ resource = retrieve_resource(id)
64
+
65
+ if !options[:extended].nil?
66
+ rc = resource.info(options[:extended])
67
+ else
68
+ rc = resource.info
69
+ end
70
+
71
+ return -1, rc.message if OpenNebula.is_error?(rc)
72
+
73
+ if options[:xml]
74
+ return 0, resource.to_xml(true)
75
+ else
76
+ format_resource(resource, options)
77
+ return 0
78
+ end
79
+ end
80
+
54
81
  def format_pool(options)
55
82
  config_file = self.class.table_conf
56
83
 
@@ -260,8 +260,8 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
260
260
  "CPU_USED" => "0",
261
261
  "MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
262
262
  "MEMORY_USED" => "0",
263
- "VOLATILE_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
264
- "VOLATILE_SIZE_USED" => "0"
263
+ "SYSTEM_DISK_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
264
+ "SYSTEM_DISK_SIZE_USED" => "0"
265
265
  }
266
266
 
267
267
  quotas[d['ID']] = q
@@ -299,8 +299,8 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
299
299
  "CPU_USED" => "0",
300
300
  "MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
301
301
  "MEMORY_USED" => "0",
302
- "VOLATILE_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
303
- "VOLATILE_SIZE_USED" => "0"
302
+ "SYSTEM_DISK_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
303
+ "SYSTEM_DISK_SIZE_USED" => "0"
304
304
  }
305
305
 
306
306
  quotas[d['ID']] = q
@@ -341,8 +341,8 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
341
341
  "CPU_USED" => "0",
342
342
  "MEMORY" => OneQuotaHelper::LIMIT_DEFAULT,
343
343
  "MEMORY_USED" => "0",
344
- "VOLATILE_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
345
- "VOLATILE_SIZE_USED" => "0"
344
+ "SYSTEM_DISK_SIZE" => OneQuotaHelper::LIMIT_DEFAULT,
345
+ "SYSTEM_DISK_SIZE_USED" => "0"
346
346
  }
347
347
 
348
348
  quotas[d['ID']] = q
@@ -28,7 +28,6 @@ $: << MAD_LOCATION
28
28
 
29
29
  require 'one_helper'
30
30
  require 'optparse/time'
31
- require 'one_tm'
32
31
 
33
32
  class String
34
33
  def red
@@ -46,6 +45,13 @@ private
46
45
  end
47
46
  end
48
47
 
48
+ EXTERNAL_IP_ATTRS = [
49
+ 'GUEST_IP',
50
+ 'AWS_IP_ADDRESS',
51
+ 'AZ_IPADDRESS',
52
+ 'SL_PRIMARYIPADDRESS'
53
+ ];
54
+
49
55
 
50
56
  class OneVMHelper < OpenNebulaHelper::OneHelper
51
57
  MULTIPLE={
@@ -237,11 +243,14 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
237
243
  end
238
244
 
239
245
  column :UCPU, "CPU percentage used by the VM", :size=>4 do |d|
240
- d["CPU"]
246
+ cpu = d["MONITORING"]["CPU"]
247
+ cpu = "0" if cpu.nil?
248
+
249
+ cpu
241
250
  end
242
251
 
243
252
  column :UMEM, "Memory used by the VM", :size=>7 do |d|
244
- OpenNebulaHelper.unit_to_str(d["MEMORY"].to_i, options)
253
+ OpenNebulaHelper.unit_to_str(d["MONITORING"]["MEMORY"].to_i, options)
245
254
  end
246
255
 
247
256
  column :HOST, "Host where the VM is running", :left, :size=>10 do |d|
@@ -333,6 +342,16 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
333
342
  }
334
343
 
335
344
  def recover_retry_interactive(vm)
345
+ begin
346
+ require 'one_tm'
347
+ rescue LoadError
348
+ STDERR.puts <<-EOT
349
+ one_tm library not found. Make sure you execute recover --interactive
350
+ in the frontend machine.
351
+ EOT
352
+ exit(-1)
353
+ end
354
+
336
355
  # Disable CTRL-C in the menu
337
356
  trap("SIGINT") { }
338
357
 
@@ -505,6 +524,14 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
505
524
 
506
525
  vm_monitoring = vm.to_hash['VM']['MONITORING']
507
526
 
527
+ # Find out if it is a hybrid VM to avoid showing local IPs
528
+ isHybrid=false
529
+ vm_monitoring.each{|key, value|
530
+ if EXTERNAL_IP_ATTRS.include? key
531
+ isHybrid=true
532
+ end
533
+ }
534
+
508
535
  order_attrs = %w(CPU MEMORY NETTX NETRX)
509
536
 
510
537
  vm_monitoring_sort = []
@@ -674,7 +701,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
674
701
  end
675
702
  end
676
703
 
677
- if vm.has_elements?("/VM/TEMPLATE/NIC")
704
+ if vm.has_elements?("/VM/TEMPLATE/NIC") and !isHybrid
678
705
  puts
679
706
  CLIHelper.print_header(str_h1 % "VM NICS",false)
680
707
 
@@ -777,7 +804,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
777
804
  vm.delete_element("/VM/TEMPLATE/NIC")
778
805
  end if !options[:all]
779
806
 
780
- if vm.has_elements?("/VM/TEMPLATE/SECURITY_GROUP_RULE")
807
+ if vm.has_elements?("/VM/TEMPLATE/SECURITY_GROUP_RULE") and !isHybrid
781
808
  puts
782
809
  CLIHelper.print_header(str_h1 % "SECURITY",false)
783
810
  puts
@@ -1012,7 +1039,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1012
1039
  d["CHILDREN"]
1013
1040
  end
1014
1041
 
1015
- column :SIZE, "", :left, :size=>9 do |d|
1042
+ column :SIZE, "", :left, :size=>12 do |d|
1016
1043
  if d["SIZE"]
1017
1044
  size = OpenNebulaHelper.unit_to_str(
1018
1045
  d['SIZE'].to_i,
@@ -1036,15 +1063,15 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1036
1063
  "#{monitor_size}/#{size}"
1037
1064
  end
1038
1065
 
1039
- column :NAME, "Snapshot Name", :left, :size=>26 do |d|
1066
+ column :NAME, "Snapshot Name", :left, :size=>32 do |d|
1040
1067
  d["NAME"]
1041
1068
  end
1042
1069
 
1043
- column :DATE, "Snapshot creation date", :size=>10 do |d|
1070
+ column :DATE, "Snapshot creation date", :size=>15 do |d|
1044
1071
  OpenNebulaHelper.time_to_str(d["DATE"])
1045
1072
  end
1046
1073
 
1047
- default :AC, :ID, :DISK, :PARENT, :DATE, :CHILDREN, :SIZE, :NAME
1074
+ default :AC, :ID, :DISK, :PARENT, :DATE, :SIZE, :NAME
1048
1075
  end
1049
1076
 
1050
1077
  # Convert snapshot data to an array
data/lib/one_helper.rb CHANGED
@@ -226,14 +226,20 @@ EOT
226
226
  :name => 'disk',
227
227
  :large => '--disk image0,image1',
228
228
  :description => "Disks to attach. To use an image owned by"<<
229
- " other user use user[disk]",
229
+ " other user use user[disk]. Add any additional"<<
230
+ " attributes separated by ':' and in the shape of"<<
231
+ " KEY=VALUE. For example, if the disk must be"<<
232
+ " resized, use image0:size=1000 . Or"<<
233
+ " image0:size=1000:target=vda,image1:target=vdb",
230
234
  :format => Array
231
235
  },
232
236
  {
233
237
  :name => 'nic',
234
238
  :large => '--nic network0,network1',
235
239
  :description => "Networks to attach. To use a network owned by"<<
236
- " other user use user[network]",
240
+ " other user use user[network]. Additional"<<
241
+ " attributes are supported like with the --disk"<<
242
+ " option.",
237
243
  :format => Array
238
244
  },
239
245
  {
@@ -879,12 +885,17 @@ EOT
879
885
  template=''
880
886
 
881
887
  objects.each do |obj|
888
+ obj, *extra_attributes = obj.split(":")
882
889
  res=parse_user_object(obj)
883
890
  return [-1, "#{section.capitalize} \"#{obj}\" malformed"] if !res
884
891
  user, object=*res
885
892
 
886
893
  template<<"#{section.upcase}=[\n"
887
894
  template<<" #{name.upcase}_UNAME=\"#{user}\",\n" if user
895
+ extra_attributes.each do |extra_attribute|
896
+ key, value = extra_attribute.split("=")
897
+ template<<" #{key.upcase}=\"#{value}\",\n"
898
+ end
888
899
  if object.match(/^\d+$/)
889
900
  template<<" #{name.upcase}_ID=#{object}\n"
890
901
  else
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: 4.13.80.beta1
4
+ version: 4.13.85.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-28 00:00:00.000000000 Z
11
+ date: 2015-09-08 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: 4.13.80.beta1
19
+ version: 4.13.85.beta2
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: 4.13.80.beta1
26
+ version: 4.13.85.beta2
27
27
  description: Commands used to talk to OpenNebula
28
28
  email: contact@opennebula.org
29
29
  executables:
@@ -39,12 +39,12 @@ executables:
39
39
  - onevnet
40
40
  - onezone
41
41
  - oneacl
42
+ - oneflow
42
43
  - onehost
43
44
  - oneimage
45
+ - onetemplate
44
46
  - onevcenter
45
- - oneflow
46
47
  - onevm
47
- - onetemplate
48
48
  extensions: []
49
49
  extra_rdoc_files: []
50
50
  files:
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: 1.3.1
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.4.5
109
+ rubygems_version: 2.4.5.1
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: OpenNebula Command Line Interface