---
p2v/client/lib/virt-p2v/ui/gtk.rb | 7 +++++++
p2v/client/lib/virt-p2v/ui/main.rb | 7 +++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/p2v/client/lib/virt-p2v/ui/gtk.rb b/p2v/client/lib/virt-p2v/ui/gtk.rb
index 38b9184..daa9ad8 100644
--- a/p2v/client/lib/virt-p2v/ui/gtk.rb
+++ b/p2v/client/lib/virt-p2v/ui/gtk.rb
@@ -113,6 +113,12 @@ if Kernel.const_defined?(:NOGUI) && NOGUI == true
end
end
+ def _set_selected_name(name)
+ @idx = @items.index([name]) ||
+ (@main.get_object('connect_error').text="Cannot select
'#{name}' \
+on '#{@name}'. Available items are: #{(a)items.join(', ')}.")
+ end
+
def each(&block)
@items.each do |item|
# block accepts three params:
@@ -159,6 +165,7 @@ if Kernel.const_defined?(:NOGUI) && NOGUI == true
unless str == ''
puts "Error connecting: '#{str}'"
puts "Giving up."
+ STDOUT.flush
exit(3)
end
end
diff --git a/p2v/client/lib/virt-p2v/ui/main.rb b/p2v/client/lib/virt-p2v/ui/main.rb
index bd0a0f8..bdfbd69 100644
--- a/p2v/client/lib/virt-p2v/ui/main.rb
+++ b/p2v/client/lib/virt-p2v/ui/main.rb
@@ -187,12 +187,12 @@ class NewMain < Main
def expected_param_keys
['ip_manual', 'ip_address', 'ip_prefix',
'ip_gateway', 'ip_dns',
'server_hostname', 'server_username',
'server_password',
- 'convert_name', 'disks', 'nics', 'rems']
+ 'convert_name', 'disks', 'nics', 'rems',
'profile']
end
def is_param_optional?(name)
['ip_address', 'ip_prefix', 'ip_gateway',
'ip_dns',
- 'disks', 'nics', 'rems'].include?(name)
+ 'disks', 'nics', 'rems',
'profile'].include?(name)
end
def validate_params(params)
@@ -279,6 +279,9 @@ class NewMain < Main
def fill_and_click_convert
fill_widgets_from_params(['convert_name'])
+ get_object('convert_profile_list').
+ _set_selected_name(@cmd_params['profile']) if
@cmd_params['profile']
+
{'disks' => 'convert_fixed_list',
'nics' => 'convert_network_list',
'rems' => 'convert_removable_list'}.each do |p,w|
--
1.8.3.1