Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
client/tests/virt_v2v/tests/convert_libvirt.py | 2 +-
client/tests/virt_v2v/tests/convert_ovirt.py | 2 +-
client/virt/env_process.py | 2 +-
client/virt/v2v.py | 60 ++++++++++++++++++++++++++
client/virt/virt_v2v.py | 60 --------------------------
5 files changed, 63 insertions(+), 63 deletions(-)
create mode 100644 client/virt/v2v.py
delete mode 100644 client/virt/virt_v2v.py
diff --git a/client/tests/virt_v2v/tests/convert_libvirt.py
b/client/tests/virt_v2v/tests/convert_libvirt.py
index 9c5895b..c7b4455 100644
--- a/client/tests/virt_v2v/tests/convert_libvirt.py
+++ b/client/tests/virt_v2v/tests/convert_libvirt.py
@@ -1,5 +1,5 @@
import os, logging
-from autotest.client.virt import virt_v2v as v2v
+from autotest.client.virt import v2v
def get_args_dict(params):
args_dict = {}
diff --git a/client/tests/virt_v2v/tests/convert_ovirt.py
b/client/tests/virt_v2v/tests/convert_ovirt.py
index 81eb081..60545d8 100644
--- a/client/tests/virt_v2v/tests/convert_ovirt.py
+++ b/client/tests/virt_v2v/tests/convert_ovirt.py
@@ -1,5 +1,5 @@
import os, logging
-from autotest.client.virt import virt_v2v as v2v
+from autotest.client.virt import v2v
def get_args_dict(params):
args_dict = {}
diff --git a/client/virt/env_process.py b/client/virt/env_process.py
index a20ec15..5e5e70c 100644
--- a/client/virt/env_process.py
+++ b/client/virt/env_process.py
@@ -3,7 +3,7 @@ from autotest.client import utils
from autotest.client.shared import error
import aexpect, kvm_monitor, ppm_utils, test_setup, virt_vm, kvm_vm
import libvirt_vm, virt_video_maker, virt_utils, storage, kvm_storage
-import remote, virt_v2v, ovirt
+import remote, ovirt
try:
import PIL.Image
diff --git a/client/virt/v2v.py b/client/virt/v2v.py
new file mode 100644
index 0000000..405bda7
--- /dev/null
+++ b/client/virt/v2v.py
@@ -0,0 +1,60 @@
+"""
+Utility functions to handle Virtual Machine conversion using virt-v2v.
+
+@copyright: 2008-2012 Red Hat Inc.
+"""
+
+import logging
+
+from autotest.client import os_dep, utils
+from autotest.client.shared import ssh_key
+from autotest.client.virt import utils_v2v as v2v_utils
+
+DEBUG = False
+
+try:
+ V2V_EXEC = os_dep.command('virt-v2v')
+except ValueError:
+ V2V_EXEC = None
+
+
+def v2v_cmd(params):
+ """
+ Append cmd to 'virt-v2v' and execute, optionally return full results.
+
+ @param: params: A dictionary includes all of required parameters such as
+ 'target', 'hypervisor' and 'hostname', etc.
+ @return: stdout of command
+ """
+ if V2V_EXEC is None:
+ raise ValueError('Missing command: virt-v2v')
+
+ target = params.get('target')
+ hypervisor = params.get('hypervisor')
+ hostname = params.get('hostname')
+ username = params.get('username')
+ password = params.get('password')
+
+ uri_obj = v2v_utils.Uri(hypervisor)
+ # Return actual 'uri' according to 'hostname' and 'hypervisor'
+ uri = uri_obj.get_uri(hostname)
+
+ tgt_obj = v2v_utils.Target(target, uri)
+ # Return virt-v2v command line options based on 'target' and 'hypervisor'
+ options = tgt_obj.get_cmd_options(params)
+
+ # Convert a existing VM without or with connection authorization.
+ if hypervisor == 'esx':
+ v2v_utils.build_esx_no_verify(params)
+ elif hypervisor == 'xen' or hypervisor == 'kvm':
+ # Setup ssh key for build connection without password.
+ ssh_key.setup_ssh_key(hostname, user=username, port=22,
+ password=password)
+ else:
+ pass
+
+ # Construct a final virt-v2v command
+ cmd = '%s %s' % (V2V_EXEC, options)
+ logging.debug('%s' % cmd)
+ cmd_result = utils.run(cmd, verbose=DEBUG)
+ return cmd_result
diff --git a/client/virt/virt_v2v.py b/client/virt/virt_v2v.py
deleted file mode 100644
index 405bda7..0000000
--- a/client/virt/virt_v2v.py
+++ /dev/null
@@ -1,60 +0,0 @@
-"""
-Utility functions to handle Virtual Machine conversion using virt-v2v.
-
-@copyright: 2008-2012 Red Hat Inc.
-"""
-
-import logging
-
-from autotest.client import os_dep, utils
-from autotest.client.shared import ssh_key
-from autotest.client.virt import utils_v2v as v2v_utils
-
-DEBUG = False
-
-try:
- V2V_EXEC = os_dep.command('virt-v2v')
-except ValueError:
- V2V_EXEC = None
-
-
-def v2v_cmd(params):
- """
- Append cmd to 'virt-v2v' and execute, optionally return full results.
-
- @param: params: A dictionary includes all of required parameters such as
- 'target', 'hypervisor' and 'hostname', etc.
- @return: stdout of command
- """
- if V2V_EXEC is None:
- raise ValueError('Missing command: virt-v2v')
-
- target = params.get('target')
- hypervisor = params.get('hypervisor')
- hostname = params.get('hostname')
- username = params.get('username')
- password = params.get('password')
-
- uri_obj = v2v_utils.Uri(hypervisor)
- # Return actual 'uri' according to 'hostname' and 'hypervisor'
- uri = uri_obj.get_uri(hostname)
-
- tgt_obj = v2v_utils.Target(target, uri)
- # Return virt-v2v command line options based on 'target' and 'hypervisor'
- options = tgt_obj.get_cmd_options(params)
-
- # Convert a existing VM without or with connection authorization.
- if hypervisor == 'esx':
- v2v_utils.build_esx_no_verify(params)
- elif hypervisor == 'xen' or hypervisor == 'kvm':
- # Setup ssh key for build connection without password.
- ssh_key.setup_ssh_key(hostname, user=username, port=22,
- password=password)
- else:
- pass
-
- # Construct a final virt-v2v command
- cmd = '%s %s' % (V2V_EXEC, options)
- logging.debug('%s' % cmd)
- cmd_result = utils.run(cmd, verbose=DEBUG)
- return cmd_result
--
1.7.11.2
_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel