opennebula-cli 6.8.0 → 6.8.1

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: 67cef3295aa89ae688e917b2f9586251ad2c1ef2a965cccd75103a8a987ea980
4
- data.tar.gz: 6959a48ef8b61e696c4d68b6d6fd5fcb225a62a451ec4e455354abd21aa75b7b
3
+ metadata.gz: 6cf54d4b60a559aec10ac15e21dbbe7b6ec46f6955552809d39f520ef764933f
4
+ data.tar.gz: b329c6848fd04338713db8c31728254d54a885fd0c24094d1f67d199a9722b29
5
5
  SHA512:
6
- metadata.gz: 1dc2353d7f82ad36dedad8979b1071483f01306e5ec6aedcbd81aa9142f60b2cbdb260a2ce2a9289293ad9851b169ac942c1587054067e9416a0e03b2941a410
7
- data.tar.gz: c11031e925a29e9cc260117a17c6cf4ac956f381502124ea7a7e0c9aba360a704f59f71a8eabff0b527121a2ca7e179d6df2143f357a347fd26e5e3c1e2b75fc
6
+ metadata.gz: 7509c3cce87f1fc8c0e185612a98b60a91fce02b605c0ba1d551174793730991d099f1f3f66f392c3f0b3a715d8296880da6b4506b578e9017cccce3cdc3ebe2
7
+ data.tar.gz: 3c7fde70522ba16e9bbf3e7b8b6719962a23d6c6c51ea21c2ab73151655699aeec66729c2b26213ab91cd432bae5c7932fccdd4d8cc4044eb0ab1604cd9c1000
data/bin/oneacct CHANGED
@@ -75,7 +75,7 @@ CommandParser::CmdParser.new(ARGV) do
75
75
  exit(0)
76
76
  end
77
77
 
78
- filter_flag = (options[:userfilter] || VirtualMachinePool::INFO_ALL)
78
+ filter_flag = options[:userfilter] || VirtualMachinePool::INFO_ALL
79
79
  if options[:start_time]
80
80
  start_time = options[:start_time].to_i
81
81
  else
data/bin/onebackupjob CHANGED
@@ -130,6 +130,10 @@ CommandParser::CmdParser.new(ARGV) do
130
130
  - using a template description file:
131
131
 
132
132
  onebackupjob create weekly_backup.tmpl
133
+
134
+ - using a template description via stdin:
135
+
136
+ cat $bj_template | onebackupjob create
133
137
  EOT
134
138
 
135
139
  command :create,
@@ -143,6 +147,8 @@ CommandParser::CmdParser.new(ARGV) do
143
147
  begin
144
148
  if args[0]
145
149
  template = File.read(args[0])
150
+ elsif STDIN.wait_readable?(0)
151
+ template = STDIN.read
146
152
  else
147
153
  template = OneBackupJobHelper.create_backupjob_template(options)
148
154
  end
data/bin/onedatastore CHANGED
@@ -113,8 +113,11 @@ CommandParser::CmdParser.new(ARGV) do
113
113
 
114
114
  helper.create_resource(options) do |datastore|
115
115
  begin
116
- template = File.read(args[0]) if args[0]
117
- template = STDIN.read if STDIN.wait_readable(0)
116
+ if args[0]
117
+ template = File.read(args[0])
118
+ elsif STDIN.wait_readable(0)
119
+ template = STDIN.read
120
+ end
118
121
  datastore.allocate(template, cid)
119
122
  rescue StandardError => e
120
123
  STDERR.puts e.message
data/bin/oneflow CHANGED
@@ -79,7 +79,7 @@ CommandParser::CmdParser.new(ARGV) do
79
79
  DELETE = {
80
80
  :name => 'delete',
81
81
  :large => '--delete',
82
- :description => 'Force flow necover delete'
82
+ :description => 'Force flow recover delete'
83
83
  }
84
84
 
85
85
  APPEND = {
@@ -130,7 +130,8 @@ CommandParser::CmdParser.new(ARGV) do
130
130
  List the available services
131
131
  EOT
132
132
 
133
- command :list, list_desc, :options => FORMAT do
133
+ command :list, list_desc,
134
+ :options => FORMAT + CLIHelper::OPTIONS + [OpenNebulaHelper::DESCRIBE] do
134
135
  helper.list_service_pool(helper.client(options), options)
135
136
  end
136
137
 
@@ -162,6 +163,7 @@ CommandParser::CmdParser.new(ARGV) do
162
163
 
163
164
  delete_desc = <<-EOT.unindent
164
165
  Delete a given service
166
+ To force service removal please use 'oneflow recover --delete <service_id>' command
165
167
  EOT
166
168
 
167
169
  command :delete, delete_desc, [:range, :service_id_list] do
data/bin/oneflow-template CHANGED
@@ -143,7 +143,8 @@ CommandParser::CmdParser.new(ARGV) do
143
143
  List the available Service Templates
144
144
  EOT
145
145
 
146
- command :list, list_desc, :options => FORMAT do
146
+ command :list, list_desc,
147
+ :options => FORMAT + CLIHelper::OPTIONS + [OpenNebulaHelper::DESCRIBE] do
147
148
  helper.list_service_template_pool(helper.client(options), options)
148
149
  end
149
150
 
@@ -186,11 +187,13 @@ CommandParser::CmdParser.new(ARGV) do
186
187
  command :create, create_desc, [:file, nil], :options => Service::JSON_FORMAT do
187
188
  client = helper.client(options)
188
189
 
189
- template = nil
190
- template = File.read(args[0]) if args[0]
191
- template = STDIN.read if STDIN.wait_readable(0)
190
+ if args[0]
191
+ template = File.read(args[0])
192
+ elsif STDIN.wait_readable(0)
193
+ template = STDIN.read
194
+ end
192
195
 
193
- if template.nil?
196
+ if !template
194
197
  STDERR.puts 'A template must be provided'
195
198
  exit(-1)
196
199
  end
@@ -257,38 +260,40 @@ CommandParser::CmdParser.new(ARGV) do
257
260
  rc = 0
258
261
  client = helper.client(options)
259
262
 
260
- number.times do
261
- template = nil
262
- template = File.read(args[1]) if args[1]
263
- template = STDIN.read if STDIN.wait_readable(0)
263
+ if args[1]
264
+ template = File.read(args[1])
265
+ elsif STDIN.wait_readable(0)
266
+ template = STDIN.read
267
+ end
268
+ params['merge_template'] = JSON.parse(template) if template
264
269
 
265
- params['merge_template'] = JSON.parse(template) if template
270
+ unless params['merge_template']
271
+ response = client.get("#{RESOURCE_PATH}/#{args[0]}")
266
272
 
267
- unless params['merge_template']
268
- response = client.get("#{RESOURCE_PATH}/#{args[0]}")
273
+ if CloudClient.is_error?(response)
274
+ rc = [response.code.to_i, response.to_s]
275
+ break
276
+ end
269
277
 
270
- if CloudClient.is_error?(response)
271
- rc = [response.code.to_i, response.to_s]
272
- break
273
- end
278
+ params['merge_template'] = {}
279
+ body = JSON.parse(response.body)['DOCUMENT']['TEMPLATE']['BODY']
274
280
 
275
- params['merge_template'] = {}
276
- body = JSON.parse(response.body)['DOCUMENT']['TEMPLATE']['BODY']
281
+ # Check global custom attributes
282
+ custom_attrs = helper.custom_attrs(body['custom_attrs'])
283
+ params['merge_template'].merge!(custom_attrs) unless custom_attrs.nil?
277
284
 
278
- # Check global custom attributes
279
- custom_attrs = helper.custom_attrs(body['custom_attrs'])
280
- params['merge_template'].merge!(custom_attrs) unless custom_attrs.nil?
285
+ # Check role level custom attributes
286
+ custom_role_attrs = helper.custom_role_attrs(body['roles'])
287
+ params['merge_template'].merge!(custom_role_attrs) unless custom_role_attrs.nil?
281
288
 
282
- # Check role level custom attributes
283
- custom_role_attrs = helper.custom_role_attrs(body['roles'])
284
- params['merge_template'].merge!(custom_role_attrs) unless custom_role_attrs.nil?
289
+ # Check vnets attributes
290
+ vnets = helper.networks(body['networks'])
291
+ params['merge_template'].merge!(vnets) unless vnets.nil?
292
+ end
285
293
 
286
- # Check vnets attributes
287
- vnets = helper.networks(body['networks'])
288
- params['merge_template'].merge!(vnets) unless vnets.nil?
289
- end
294
+ json = Service.build_json_action('instantiate', params)
290
295
 
291
- json = Service.build_json_action('instantiate', params)
296
+ number.times do
292
297
  response = client.post("#{RESOURCE_PATH}/#{args[0]}/action", json)
293
298
 
294
299
  if CloudClient.is_error?(response)
data/bin/onehook CHANGED
@@ -164,6 +164,10 @@ CommandParser::CmdParser.new(ARGV) do
164
164
 
165
165
  onehook create hook.tmpl
166
166
 
167
+ - using a Hook description file via stdin:
168
+
169
+ cat $hook_template | onehook create
170
+
167
171
  EOT
168
172
 
169
173
  command :create, create_desc, :file, :options =>
@@ -172,6 +176,11 @@ CommandParser::CmdParser.new(ARGV) do
172
176
  begin
173
177
  if args[0]
174
178
  template = File.read(args[0])
179
+ elsif STDIN.wait_readable(0)
180
+ template = STDIN.read
181
+ else
182
+ STDERR.puts 'No hook template provided'
183
+ exit(-1)
175
184
  end
176
185
 
177
186
  if options[:dry]
data/bin/oneimage CHANGED
@@ -130,6 +130,7 @@ CommandParser::CmdParser.new(ARGV) do
130
130
  list_options += OpenNebulaHelper::FORMAT
131
131
  list_options << OpenNebulaHelper::NUMERIC
132
132
  list_options << OpenNebulaHelper::DESCRIBE
133
+ list_options << OneImageHelper::FILTERS
133
134
 
134
135
  CREATE_OPTIONS = [OneDatastoreHelper::DATASTORE,
135
136
  OneImageHelper::IMAGE,
@@ -487,6 +488,16 @@ CommandParser::CmdParser.new(ARGV) do
487
488
  EOT
488
489
 
489
490
  command :list, list_desc, [:filterflag, nil], :options => list_options do
491
+ if options.key?(:backup)
492
+ filter = 'TYPE=BK'
493
+
494
+ if options[:filter]
495
+ options[:filter] << filter
496
+ else
497
+ options[:filter] = [filter]
498
+ end
499
+ options.delete(:backup)
500
+ end
490
501
  helper.list_pool(options, false, args[0])
491
502
  end
492
503
 
data/bin/onemarket CHANGED
@@ -105,8 +105,11 @@ CommandParser::CmdParser.new(ARGV) do
105
105
  command :create, create_desc, [:file, nil] do
106
106
  helper.create_resource(options) do |marketplace|
107
107
  begin
108
- template = File.read(args[0]) if args[0]
109
- template = STDIN.read if STDIN.wait_readable(0)
108
+ if args[0]
109
+ template = File.read(args[0])
110
+ elsif STDIN.wait_readable(0)
111
+ template = STDIN.read
112
+ end
110
113
  marketplace.allocate(template)
111
114
  rescue StandardError => e
112
115
  STDERR.puts e.message
data/bin/onesecgroup CHANGED
@@ -110,7 +110,14 @@ CommandParser::CmdParser.new(ARGV) do
110
110
  command :create, create_desc, :file do
111
111
  helper.create_resource(options) do |obj|
112
112
  begin
113
- template = File.read(args[0])
113
+ if args[0]
114
+ template = File.read(args[0])
115
+ elsif STDIN.wait_readable(0)
116
+ template = STDIN.read
117
+ else
118
+ STDERR.puts 'No Security Group description provided'
119
+ exit(-1)
120
+ end
114
121
 
115
122
  obj.allocate(template)
116
123
  rescue StandardError => e
data/bin/oneshowback CHANGED
@@ -77,7 +77,7 @@ CommandParser::CmdParser.new(ARGV) do
77
77
  exit(0)
78
78
  end
79
79
 
80
- filter_flag = (options[:userfilter] || VirtualMachinePool::INFO_ALL)
80
+ filter_flag = options[:userfilter] || VirtualMachinePool::INFO_ALL
81
81
 
82
82
  start_month = -1
83
83
  start_year = -1
data/bin/onevm CHANGED
@@ -1267,8 +1267,7 @@ CommandParser::CmdParser.new(ARGV) do
1267
1267
  end
1268
1268
 
1269
1269
  resize_desc = <<-EOT.unindent
1270
- Resizes the capacity of a Virtual Machine (offline, the VM cannot be
1271
- RUNNING)
1270
+ Resizes the capacity of a Virtual Machine
1272
1271
 
1273
1272
  #{OpenNebulaHelper::TEMPLATE_INPUT}
1274
1273
  EOT
@@ -1325,6 +1324,26 @@ CommandParser::CmdParser.new(ARGV) do
1325
1324
  end
1326
1325
  end
1327
1326
 
1327
+ backupmode_set_desc = <<-EOT.unindent
1328
+ Updates the backup mode of a VM. Can be #{OpenNebulaHelper::BACKUP_MODES.join('|')}
1329
+ EOT
1330
+
1331
+ command :backupmode, backupmode_set_desc, :vmid, :mode do
1332
+ vm_ref = args[0]
1333
+ backup_mode = args[1]
1334
+
1335
+ if !helper.backup_mode_valid?(backup_mode)
1336
+ err_msg = "Invalid backup mode: #{backup_mode}\n"
1337
+ err_msg << "Valid backup modes are: #{OpenNebulaHelper::BACKUP_MODES.join(',')}"
1338
+
1339
+ STDERR.puts err_msg
1340
+ exit(-1)
1341
+ end
1342
+
1343
+ # TODO: Ensure other BACKUP_CONFIG is not overwritten
1344
+ helper.set_backup_mode(vm_ref, backup_mode)
1345
+ end
1346
+
1328
1347
  updateconf_desc = <<-EOT.unindent
1329
1348
  Updates the configuration of a VM. Valid states are: running, pending,
1330
1349
  failure, poweroff, undeploy, hold or cloning.
@@ -1337,13 +1356,13 @@ CommandParser::CmdParser.new(ARGV) do
1337
1356
  The full list of configuration attributes are:
1338
1357
 
1339
1358
  OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT", "UUID"]
1340
- FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT", "IOTHREADS"]
1359
+ FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT", "VIRTIO_SCSI_QUEUES", "VIRTIO_BLK_QUEUES", "IOTHREADS"]
1341
1360
  INPUT = ["TYPE", "BUS"]
1342
1361
  GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
1343
1362
  VIDEO = ["TYPE", "IOMMU", "ATS", "VRAM", "RESOLUTION"]
1344
1363
  RAW = ["DATA", "DATA_VMX", "TYPE", "VALIDATE"]
1345
1364
  CPU_MODEL = ["MODEL"]
1346
- BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE"]
1365
+ BACKUP_CONFIG = ["FS_FREEZE", "KEEP_LAST", "BACKUP_VOLATILE", "MODE", "INCREMENT_MODE"]
1347
1366
  CONTEXT (any value, **variable substitution will be made**)
1348
1367
  EOT
1349
1368
 
@@ -1352,15 +1371,17 @@ CommandParser::CmdParser.new(ARGV) do
1352
1371
  template = ''
1353
1372
 
1354
1373
  begin
1355
- template = File.read(args[1]) if args[1]
1356
- template = STDIN.read if STDIN.wait_readable(0)
1374
+ if args[1]
1375
+ template = File.read(args[1])
1376
+ elsif STDIN.wait_readable(0)
1377
+ template = STDIN.read
1378
+ end
1357
1379
  rescue StandardError => e
1358
1380
  STDERR.puts "Error reading template: #{e.message}."
1359
1381
  exit(-1)
1360
1382
  end
1361
1383
 
1362
- helper.perform_action(args[0], options,
1363
- 'Updating VM configuration') do |vm|
1384
+ helper.perform_action(args[0], options, 'Updating VM configuration') do |vm|
1364
1385
  if template.empty?
1365
1386
  rc = vm.info
1366
1387
 
data/bin/onevmgroup CHANGED
@@ -136,7 +136,14 @@ CommandParser::CmdParser.new(ARGV) do
136
136
  command :create, create_desc, :file do
137
137
  helper.create_resource(options) do |obj|
138
138
  begin
139
- template = File.read(args[0])
139
+ if args[0]
140
+ template = File.read(args[0])
141
+ elsif STDIN.wait_readable(0)
142
+ template = STDIN.read
143
+ else
144
+ STDERR.puts 'No VM Group description provided'
145
+ exit(-1)
146
+ end
140
147
 
141
148
  obj.allocate(template)
142
149
  rescue StandardError => e
@@ -283,8 +290,11 @@ CommandParser::CmdParser.new(ARGV) do
283
290
 
284
291
  command :"role-add", role_add_desc, :vmgroupid, [:file, nil] do
285
292
  begin
286
- template = File.read(args[1]) if args[1]
287
- template = STDIN.read if STDIN.wait_readable(0)
293
+ if args[1]
294
+ template = File.read(args[1])
295
+ elsif STDIN.wait_readable(0)
296
+ template = STDIN.read
297
+ end
288
298
  rescue StandardError => e
289
299
  STDERR.puts "Error reading template: #{e.message}."
290
300
  exit(-1)
data/bin/onevnet CHANGED
@@ -171,8 +171,11 @@ CommandParser::CmdParser.new(ARGV) do
171
171
 
172
172
  helper.create_resource(options) do |vn|
173
173
  begin
174
- template = File.read(args[0]) if args[0]
175
- template = STDIN.read if STDIN.wait_readable(0)
174
+ if args[0]
175
+ template = File.read(args[0])
176
+ elsif STDIN.wait_readable(0)
177
+ template = STDIN.read
178
+ end
176
179
  vn.allocate(template, cid)
177
180
  rescue StandardError => e
178
181
  STDERR.puts "Error creating network: #{e.message}"
@@ -200,6 +203,8 @@ CommandParser::CmdParser.new(ARGV) do
200
203
  helper.perform_action(args[0], options, 'address range added') do |vn|
201
204
  if args[1]
202
205
  ar = File.read(args[1])
206
+ elsif STDIN.wait_readable(0)
207
+ ar = STDIN.read
203
208
  else
204
209
  ar = OpenNebulaHelper.create_ar(options)
205
210
  end
data/bin/onevntemplate CHANGED
@@ -149,6 +149,10 @@ CommandParser::CmdParser.new(ARGV) do
149
149
 
150
150
  onevntemplate create vn_description.tmpl
151
151
 
152
+ - using a Virtual Network Template description file via stdin:
153
+
154
+ cat $vn_template | onevntemplate create
155
+
152
156
  EOT
153
157
 
154
158
  command :create, create_desc, [:file, nil], :options =>
@@ -157,6 +161,8 @@ CommandParser::CmdParser.new(ARGV) do
157
161
  begin
158
162
  if args[0]
159
163
  template = File.read(args[0])
164
+ elsif STDIN.wait_readable(0)
165
+ template = STDIN.read
160
166
  end
161
167
 
162
168
  if options[:dry]
@@ -250,6 +256,8 @@ CommandParser::CmdParser.new(ARGV) do
250
256
 
251
257
  if args[1]
252
258
  extra_template = File.read(args[1])
259
+ elsif STDIN.wait_readable(0)
260
+ extra_template = STDIN.read
253
261
  else
254
262
  res = OpenNebulaHelper.create_template(options, t)
255
263
 
data/bin/onevrouter CHANGED
@@ -140,8 +140,11 @@ CommandParser::CmdParser.new(ARGV) do
140
140
  command :create, create_desc, [:file, nil] do
141
141
  helper.create_resource(options) do |obj|
142
142
  begin
143
- template = File.read(args[0]) if args[0]
144
- template = STDIN.read if STDIN.wait_readable(0)
143
+ if args[0]
144
+ template = File.read(args[0])
145
+ elsif STDIN.wait_readable(0)
146
+ template = STDIN.read
147
+ end
145
148
  obj.allocate(template)
146
149
  rescue StandardError => e
147
150
  STDERR.puts e.message
data/bin/onezone CHANGED
@@ -109,7 +109,14 @@ CommandParser::CmdParser.new(ARGV) do
109
109
  command :create, create_desc, :file do
110
110
  helper.create_resource(options) do |zone|
111
111
  begin
112
- template = File.read(args[0])
112
+ if args[0]
113
+ template = File.read(args[0])
114
+ elsif STDIN.wait_readable(0)
115
+ template = STDIN.read
116
+ else
117
+ STDERR.puts 'No zone template provided'
118
+ exit(-1)
119
+ end
113
120
  zone.allocate(template)
114
121
  rescue StandardError => e
115
122
  STDERR.puts e.message
@@ -155,6 +155,8 @@ class OneBackupJobHelper < OpenNebulaHelper::OneHelper
155
155
  # Get user information
156
156
  if file
157
157
  str = File.read(file)
158
+ elsif STDIN.wait_readable(0)
159
+ str = STDIN.read
158
160
  else
159
161
  str = OpenNebulaHelper.update_template(id, bj, nil, xpath)
160
162
  end
@@ -105,7 +105,10 @@ class OneFlowHelper < OpenNebulaHelper::OneHelper
105
105
  elsif options[:yaml]
106
106
  [0, array_list.to_yaml(:indent => 4)]
107
107
  else
108
- format_service_pool.show(array_list)
108
+ table = format_service_pool
109
+
110
+ table.show(array_list, options)
111
+ table.describe_columns if options[:describe]
109
112
 
110
113
  0
111
114
  end
@@ -85,8 +85,11 @@ class OneFlowTemplateHelper < OpenNebulaHelper::OneHelper
85
85
  elsif options[:yaml]
86
86
  [0, JSON.parse(response.body).to_yaml(:indent => 4)]
87
87
  else
88
+ table = format_service_template_pool
88
89
  documents = JSON.parse(response.body)['DOCUMENT_POOL']
89
- format_service_template_pool.show(documents['DOCUMENT'])
90
+
91
+ table.show(documents['DOCUMENT'], options)
92
+ table.describe_columns if options[:describe]
90
93
 
91
94
  0
92
95
  end
@@ -173,6 +173,15 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
173
173
  :format => String
174
174
  }
175
175
 
176
+ FILTERS = [
177
+ {
178
+ :name => 'backup',
179
+ :large => '--backup',
180
+ :description => 'Show only backup type images',
181
+ :format => String
182
+ }
183
+ ]
184
+
176
185
  def self.rname
177
186
  'IMAGE'
178
187
  end
@@ -263,13 +272,13 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
263
272
  tmpl_pool.info
264
273
 
265
274
  pool.each do |img|
275
+ next if img['TYPE'].to_i == 6 # skip backup images
276
+
266
277
  attrs = { :id => img['ID'],
267
278
  :name => img['NAME'],
268
279
  :uname => img['UNAME'] }
269
280
 
270
- orphans << img['ID'] if check_orphan(tmpl_pool,
271
- xpath,
272
- 'IMAGE', attrs)
281
+ orphans << img['ID'] if check_orphan(tmpl_pool, xpath, 'IMAGE', attrs)
273
282
  end
274
283
 
275
284
  orphans
@@ -397,6 +397,8 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
397
397
  # Get user information
398
398
  if file
399
399
  str = File.read(file)
400
+ elsif STDIN.wait_readable(0)
401
+ str = STDIN.read
400
402
  else
401
403
  str = OpenNebulaHelper.update_template(vm_id, vm, nil, xpath)
402
404
  end
@@ -637,6 +639,21 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
637
639
  # rubocop:enable Style/SpecialGlobalVars
638
640
  end
639
641
 
642
+ def get_backup_mode(vm_id)
643
+ vm = retrieve_resource(vm_id)
644
+
645
+ if vm.has_elements?('/VM/BACKUPS/BACKUP_CONFIG')
646
+ vm.template_like_str('BACKUPS/BACKUP_CONFIG/MODE')
647
+ else
648
+ nil
649
+ end
650
+ end
651
+
652
+ def set_backup_mode(vm_ref, backup_mode)
653
+ vm = retrieve_resource(vm_ref)
654
+ vm.updateconf("BACKUP_CONFIG = [\"MODE\"=\"#{backup_mode}\"]")
655
+ end
656
+
640
657
  private
641
658
 
642
659
  def factory(id = nil)
@@ -1449,7 +1466,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
1449
1466
  vm_snapshots.each do |disk|
1450
1467
  disk_id = disk['DISK_ID']
1451
1468
 
1452
- sshots = [disk['SNAPSHOT']].flatten
1469
+ sshots = [disk['SNAPSHOT'] || []].flatten
1453
1470
  sshots.each do |snapshot|
1454
1471
  data = snapshot.merge('DISK_ID' => disk_id)
1455
1472
  snapshots << data
data/lib/one_helper.rb CHANGED
@@ -593,6 +593,8 @@ Bash symbols must be escaped on STDIN passing'
593
593
 
594
594
  OPTIONS = FORMAT, EXTENDED, NUMERIC, KILOBYTES
595
595
 
596
+ BACKUP_MODES = ['FULL', 'INCREMENT']
597
+
596
598
  class OneHelper
597
599
 
598
600
  attr_accessor :client
@@ -717,6 +719,14 @@ Bash symbols must be escaped on STDIN passing'
717
719
  end
718
720
  end
719
721
 
722
+ def backup_mode_valid?(sus_backup_mode)
723
+ BACKUP_MODES.each do |backup_mode|
724
+ return true if backup_mode.casecmp?(sus_backup_mode)
725
+ end
726
+
727
+ false
728
+ end
729
+
720
730
  #-----------------------------------------------------------------------
721
731
  # List pool functions
722
732
  #-----------------------------------------------------------------------
@@ -2313,7 +2323,7 @@ Bash symbols must be escaped on STDIN passing'
2313
2323
  answer = STDIN.readline.chop
2314
2324
 
2315
2325
  answer = initial if answer == ''
2316
- noanswer = ((answer == '') && optional)
2326
+ noanswer = (answer == '') && optional
2317
2327
  end while !noanswer && (answer =~ exp).nil?
2318
2328
 
2319
2329
  if noanswer
@@ -2379,7 +2389,7 @@ Bash symbols must be escaped on STDIN passing'
2379
2389
  answer = options[answer.to_i]
2380
2390
  end
2381
2391
 
2382
- noanswer = ((answer == '') && optional)
2392
+ noanswer = (answer == '') && optional
2383
2393
  end while !noanswer && !options.include?(answer)
2384
2394
 
2385
2395
  if noanswer
@@ -162,6 +162,7 @@
162
162
  <xs:element name="BACKUP_VOLATILE" type="xs:string" minOccurs="0" maxOccurs="1"/>
163
163
  <xs:element name="FS_FREEZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
164
164
  <xs:element name="INCREMENTAL_BACKUP_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
165
+ <xs:element name="INCREMENT_MODE" type="xs:string" minOccurs="0" maxOccurs="1"/>
165
166
  <xs:element name="KEEP_LAST" type="xs:string" minOccurs="0" maxOccurs="1"/>
166
167
  <xs:element name="LAST_BACKUP_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
167
168
  <xs:element name="LAST_BACKUP_SIZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
@@ -27,6 +27,7 @@
27
27
  <xs:element name="BACKUP_VMS" type="xs:string"/>
28
28
  <xs:element name="BACKUP_VOLATILE" type="xs:string" minOccurs="0" maxOccurs="1"/>
29
29
  <xs:element name="DATASTORE_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
30
+ <xs:element name="ERROR" type="xs:string" minOccurs="0" maxOccurs="1"/>
30
31
  <xs:element name="EXECUTION" type="xs:string" minOccurs="0" maxOccurs="1"/>
31
32
  <xs:element name="FS_FREEZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
32
33
  <xs:element name="KEEP_LAST" type="xs:integer" minOccurs="0" maxOccurs="1"/>
@@ -299,6 +299,7 @@
299
299
  <xs:element name="BACKUP_VOLATILE" type="xs:string" minOccurs="0" maxOccurs="1"/>
300
300
  <xs:element name="FS_FREEZE" type="xs:string" minOccurs="0" maxOccurs="1"/>
301
301
  <xs:element name="INCREMENTAL_BACKUP_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
302
+ <xs:element name="INCREMENT_MODE" type="xs:string" minOccurs="0" maxOccurs="1"/>
302
303
  <xs:element name="KEEP_LAST" type="xs:string" minOccurs="0" maxOccurs="1"/>
303
304
  <xs:element name="LAST_BACKUP_ID" type="xs:string" minOccurs="0" maxOccurs="1"/>
304
305
  <xs:element name="LAST_BACKUP_SIZE" type="xs:string" 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: 6.8.0
4
+ version: 6.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenNebula
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-17 00:00:00.000000000 Z
11
+ date: 2023-12-16 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.8.0
19
+ version: 6.8.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: 6.8.0
26
+ version: 6.8.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement