Skip to content

Commit dd7a04b

Browse files
committed
F #-: added hybrid mode, other fixes
Signed-off-by: Neal Hansen <nhansen@opennebula.io>
1 parent 8ca8315 commit dd7a04b

File tree

2 files changed

+183
-52
lines changed

2 files changed

+183
-52
lines changed

oneswap

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ CommandParser::CmdParser.new(ARGV) do
239239
:description => 'If the virt-v2v conversion fails, attempt the OpenNebula Custom Conversion process.'
240240
}
241241

242+
HYBRID = {
243+
:name => 'hybrid',
244+
:large => '--hybrid',
245+
}
246+
242247
WIN_GA = {
243248
:name => 'qemu_ga_win',
244249
:large => '--win-qemu-ga /path/to/iso',
@@ -249,7 +254,7 @@ CommandParser::CmdParser.new(ARGV) do
249254
LNX_GA = {
250255
:name => 'qemu_ga_linux',
251256
:large => '--qemu-ga',
252-
:description => 'Install qemu-guest-agent package to a Linux guest'
257+
:description => 'Install qemu-guest-agent package to a Linux guest, useful with --custom or --fallback'
253258
}
254259

255260
VIRTIO = {
@@ -280,12 +285,33 @@ CommandParser::CmdParser.new(ARGV) do
280285
:format => Integer
281286
}
282287

288+
ONE_DS = {
289+
:name => 'one_datastore',
290+
:large => '--one-sys-ds id',
291+
:description => 'ID of the System Datastore in OpenNebula the VM should be scheduled to',
292+
:format => Integer
293+
}
294+
295+
ONE_DS_CLUSTER = {
296+
:name => 'one_datastore_cluster',
297+
:large => '--one-ds-cluster id',
298+
:description => 'ID of the Cluster in OpenNebula the System Datastore should be scheduled to',
299+
:format => Integer
300+
}
301+
302+
V2V_PATH = {
303+
:name => 'v2v_path',
304+
:large => '--v2v-path /path/to/custom/v2v',
305+
:description => 'Path to custom virt-v2v executable if necessary',
306+
:format => String
307+
}
308+
283309
ESXI_OPTS = [ESXI, ESXI_USER, ESXI_PASS]
284310
V2V_OPTS = [WORK_DIR, FORMAT, VIRTIO, WIN_GA, LNX_GA, DELETE, VDDK, RHSRVANY]
285311

286312
LIST_OPTS = [NAME, DATACENTER, CLUSTER, STATE] + AUTH_OPTS
287-
CONVERT_OPTS = [NETWORK, NO_IP, NO_MAC, DATASTORE, CONTEXT, FALLBACK, CUSTOM,
288-
ONE_CLUSTER, ONE_HOST] + AUTH_OPTS + ESXI_OPTS
313+
CONVERT_OPTS = [NETWORK, NO_IP, NO_MAC, DATASTORE, CONTEXT, FALLBACK, CUSTOM, HYBRID, V2V_PATH,
314+
ONE_DS, ONE_DS_CLUSTER, ONE_CLUSTER, ONE_HOST] + AUTH_OPTS + ESXI_OPTS + V2V_OPTS
289315

290316
set :option, CommandParser::OPTIONS + OpenNebulaHelper::CLIENT_OPTIONS
291317

@@ -352,6 +378,9 @@ CommandParser::CmdParser.new(ARGV) do
352378
begin
353379
raise 'ESXi Transfer requires at least IP and Password' if options[:esxi_ip] && options[:esxi_pass].nil?
354380
raise 'ESXI and VDDK cannot be used at same time, recommend VDDK.' if options[:esxi_ip] && options[:vddk]
381+
if options[:hybrid] && ( options[:custom] || options[:esxi_ip] || options[:vddk] )
382+
raise 'Cannot use Hybrid option with Custom, ESXi, or VDDK options.'
383+
end
355384
if options[:virtio_path] && !File.exist?(options[:virtio_path])
356385
raise "Windows VirtIO ISO cannot be found at #{options[:virtio_path]}"
357386
end
@@ -375,6 +404,7 @@ CommandParser::CmdParser.new(ARGV) do
375404
options[:esxi_user] ||= 'root'
376405
options[:datastore] ||= 1
377406
options[:virt_tools] ||= '/usr/share/virt-tools'
407+
options[:v2v_path] ||= 'virt-v2v'
378408

379409
helper.convert(args[0], options)
380410
rescue StandardError => e

0 commit comments

Comments
 (0)