| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 """ | 2 """ |
| 3 Program to help setup kvm test environment | 3 Program to help setup kvm test environment |
| 4 | 4 |
| 5 @copyright: Red Hat 2010 | 5 @copyright: Red Hat 2010 |
| 6 """ | 6 """ |
| 7 | 7 |
| 8 import os, sys, logging, shutil | 8 import os, sys, logging, shutil |
| 9 import common, kvm_utils | 9 import common |
| 10 from autotest_lib.client.common_lib import logging_manager | 10 from autotest_lib.client.common_lib import logging_manager |
| 11 from autotest_lib.client.bin import utils | 11 from autotest_lib.client.bin import utils |
| 12 from autotest_lib.client.virt import virt_utils |
| 12 | 13 |
| 13 | 14 |
| 14 def check_iso(url, destination, hash): | 15 def check_iso(url, destination, hash): |
| 15 """ | 16 """ |
| 16 Verifies if ISO that can be find on url is on destination with right hash. | 17 Verifies if ISO that can be find on url is on destination with right hash. |
| 17 | 18 |
| 18 This function will verify the SHA1 hash of the ISO image. If the file | 19 This function will verify the SHA1 hash of the ISO image. If the file |
| 19 turns out to be missing or corrupted, let the user know we can download it. | 20 turns out to be missing or corrupted, let the user know we can download it. |
| 20 | 21 |
| 21 @param url: URL where the ISO file can be found. | 22 @param url: URL where the ISO file can be found. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 33 iso_download = raw_input() | 34 iso_download = raw_input() |
| 34 if iso_download == 'y': | 35 if iso_download == 'y': |
| 35 utils.unmap_url_cache(destination, url, hash, method="sha1") | 36 utils.unmap_url_cache(destination, url, hash, method="sha1") |
| 36 else: | 37 else: |
| 37 logging.warning("Missing file %s. Please download it", iso_path) | 38 logging.warning("Missing file %s. Please download it", iso_path) |
| 38 else: | 39 else: |
| 39 logging.debug("%s present, with proper checksum", iso_path) | 40 logging.debug("%s present, with proper checksum", iso_path) |
| 40 | 41 |
| 41 | 42 |
| 42 if __name__ == "__main__": | 43 if __name__ == "__main__": |
| 43 logging_manager.configure_logging(kvm_utils.KvmLoggingConfig(), | 44 logging_manager.configure_logging(virt_utils.VirtLoggingConfig(), |
| 44 verbose=True) | 45 verbose=True) |
| 45 logging.info("KVM test config helper") | 46 logging.info("KVM test config helper") |
| 46 | 47 |
| 47 logging.info("1 - Verifying directories (check if the directory structure " | 48 logging.info("1 - Verifying directories (check if the directory structure " |
| 48 "expected by the default test config is there)") | 49 "expected by the default test config is there)") |
| 49 base_dir = "/tmp/kvm_autotest_root" | 50 base_dir = "/tmp/kvm_autotest_root" |
| 50 sub_dir_list = ["images", "isos", "steps_data"] | 51 sub_dir_list = ["images", "isos", "steps_data"] |
| 51 for sub_dir in sub_dir_list: | 52 for sub_dir in sub_dir_list: |
| 52 sub_dir_path = os.path.join(base_dir, sub_dir) | 53 sub_dir_path = os.path.join(base_dir, sub_dir) |
| 53 if not os.path.isdir(sub_dir_path): | 54 if not os.path.isdir(sub_dir_path): |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 "(session 'Install Prerequisite packages')") | 125 "(session 'Install Prerequisite packages')") |
| 125 | 126 |
| 126 client_dir = os.path.abspath(os.path.join(kvm_test_dir, "..", "..")) | 127 client_dir = os.path.abspath(os.path.join(kvm_test_dir, "..", "..")) |
| 127 autotest_bin = os.path.join(client_dir, 'bin', 'autotest') | 128 autotest_bin = os.path.join(client_dir, 'bin', 'autotest') |
| 128 control_file = os.path.join(kvm_test_dir, 'control') | 129 control_file = os.path.join(kvm_test_dir, 'control') |
| 129 logging.info("When you are done fixing eventual warnings found, " | 130 logging.info("When you are done fixing eventual warnings found, " |
| 130 "you can run the kvm test using the command line AS ROOT:") | 131 "you can run the kvm test using the command line AS ROOT:") |
| 131 logging.info("%s --verbose %s", autotest_bin, control_file) | 132 logging.info("%s --verbose %s", autotest_bin, control_file) |
| 132 logging.info("You can also edit the test config files (see output of " | 133 logging.info("You can also edit the test config files (see output of " |
| 133 "step 2 for a list)") | 134 "step 2 for a list)") |
| OLD | NEW |