Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Side by Side Diff: client/virt/kvm_installer.py

Issue 6883246: Merge autotest upstream from @5318 ~ @5336 (Closed) Base URL: ssh://gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/virt/common.py ('k') | client/virt/kvm_monitor.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import os, logging, datetime, glob 1 import os, logging, datetime, glob, shutil
2 import shutil
3 from autotest_lib.client.bin import utils, os_dep 2 from autotest_lib.client.bin import utils, os_dep
4 from autotest_lib.client.common_lib import error 3 from autotest_lib.client.common_lib import error
5 import kvm_utils 4 import virt_utils, virt_installer
6
7
8 def check_configure_options(script_path):
9 """
10 Return the list of available options (flags) of a given kvm configure build
11 script.
12
13 @param script: Path to the configure script
14 """
15 abspath = os.path.abspath(script_path)
16 help_raw = utils.system_output('%s --help' % abspath, ignore_status=True)
17 help_output = help_raw.split("\n")
18 option_list = []
19 for line in help_output:
20 cleaned_line = line.lstrip()
21 if cleaned_line.startswith("--"):
22 option = cleaned_line.split()[0]
23 option = option.split("=")[0]
24 option_list.append(option)
25
26 return option_list
27 5
28 6
29 def kill_qemu_processes(): 7 def kill_qemu_processes():
30 """ 8 """
31 Kills all qemu processes, also kills all processes holding /dev/kvm down. 9 Kills all qemu processes, also kills all processes holding /dev/kvm down.
32 """ 10 """
33 logging.debug("Killing any qemu processes that might be left behind") 11 logging.debug("Killing any qemu processes that might be left behind")
34 utils.system("pkill qemu", ignore_status=True) 12 utils.system("pkill qemu", ignore_status=True)
35 # Let's double check to see if some other process is holding /dev/kvm 13 # Let's double check to see if some other process is holding /dev/kvm
36 if os.path.isfile("/dev/kvm"): 14 if os.path.isfile("/dev/kvm"):
37 utils.system("fuser -k /dev/kvm", ignore_status=True) 15 utils.system("fuser -k /dev/kvm", ignore_status=True)
38 16
39 17
40 def cpu_vendor():
41 vendor = "intel"
42 if os.system("grep vmx /proc/cpuinfo 1>/dev/null") != 0:
43 vendor = "amd"
44 logging.debug("Detected CPU vendor as '%s'", vendor)
45 return vendor
46
47
48 def _unload_kvm_modules(mod_list): 18 def _unload_kvm_modules(mod_list):
49 logging.info("Unloading previously loaded KVM modules") 19 logging.info("Unloading previously loaded KVM modules")
50 for module in reversed(mod_list): 20 for module in reversed(mod_list):
51 utils.unload_module(module) 21 utils.unload_module(module)
52 22
53 23
54 def _load_kvm_modules(mod_list, module_dir=None, load_stock=False): 24 def _load_kvm_modules(mod_list, module_dir=None, load_stock=False):
55 """ 25 """
56 Just load the KVM modules, without killing Qemu or unloading previous 26 Just load the KVM modules, without killing Qemu or unloading previous
57 modules. 27 modules.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 123
154 def install_roms(rom_dir, prefix): 124 def install_roms(rom_dir, prefix):
155 logging.debug("Path to roms specified. Copying roms to install prefix") 125 logging.debug("Path to roms specified. Copying roms to install prefix")
156 rom_dst_dir = os.path.join(prefix, 'share', 'qemu') 126 rom_dst_dir = os.path.join(prefix, 'share', 'qemu')
157 for rom_src in glob.glob('%s/*.bin' % rom_dir): 127 for rom_src in glob.glob('%s/*.bin' % rom_dir):
158 rom_dst = os.path.join(rom_dst_dir, os.path.basename(rom_src)) 128 rom_dst = os.path.join(rom_dst_dir, os.path.basename(rom_src))
159 logging.debug("Copying rom file %s to %s", rom_src, rom_dst) 129 logging.debug("Copying rom file %s to %s", rom_src, rom_dst)
160 shutil.copy(rom_src, rom_dst) 130 shutil.copy(rom_src, rom_dst)
161 131
162 132
163 def save_build(build_dir, dest_dir):
164 logging.debug('Saving the result of the build on %s', dest_dir)
165 base_name = os.path.basename(build_dir)
166 tarball_name = base_name + '.tar.bz2'
167 os.chdir(os.path.dirname(build_dir))
168 utils.system('tar -cjf %s %s' % (tarball_name, base_name))
169 shutil.move(tarball_name, os.path.join(dest_dir, tarball_name))
170
171
172 class KvmInstallException(Exception): 133 class KvmInstallException(Exception):
173 pass 134 pass
174 135
175 136
176 class FailedKvmInstall(KvmInstallException): 137 class FailedKvmInstall(KvmInstallException):
177 pass 138 pass
178 139
179 140
180 class KvmNotInstalled(KvmInstallException): 141 class KvmNotInstalled(KvmInstallException):
181 pass 142 pass
(...skipping 11 matching lines...) Expand all
193 154
194 load_modules = params.get('load_modules', 'no') 155 load_modules = params.get('load_modules', 'no')
195 if not load_modules or load_modules == 'yes': 156 if not load_modules or load_modules == 'yes':
196 self.should_load_modules = True 157 self.should_load_modules = True
197 elif load_modules == 'no': 158 elif load_modules == 'no':
198 self.should_load_modules = False 159 self.should_load_modules = False
199 default_extra_modules = str(None) 160 default_extra_modules = str(None)
200 self.extra_modules = eval(params.get("extra_modules", 161 self.extra_modules = eval(params.get("extra_modules",
201 default_extra_modules)) 162 default_extra_modules))
202 163
203 self.cpu_vendor = cpu_vendor() 164 self.cpu_vendor = virt_installer.cpu_vendor()
204 165
205 self.srcdir = test.srcdir 166 self.srcdir = test.srcdir
206 if not os.path.isdir(self.srcdir): 167 if not os.path.isdir(self.srcdir):
207 os.makedirs(self.srcdir) 168 os.makedirs(self.srcdir)
208 169
209 self.test_bindir = test.bindir 170 self.test_bindir = test.bindir
210 self.results_dir = test.resultsdir 171 self.results_dir = test.resultsdir
211 172
212 # KVM build prefix, for the modes that do need it 173 # KVM build prefix, for the modes that do need it
213 prefix = os.path.join(test.bindir, 'build') 174 prefix = os.path.join(test.bindir, 'build')
(...skipping 19 matching lines...) Expand all
233 194
234 def install_unittests(self): 195 def install_unittests(self):
235 userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace") 196 userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace")
236 test_repo = self.params.get("test_git_repo") 197 test_repo = self.params.get("test_git_repo")
237 test_branch = self.params.get("test_branch", "master") 198 test_branch = self.params.get("test_branch", "master")
238 test_commit = self.params.get("test_commit", None) 199 test_commit = self.params.get("test_commit", None)
239 test_lbranch = self.params.get("test_lbranch", "master") 200 test_lbranch = self.params.get("test_lbranch", "master")
240 201
241 if test_repo: 202 if test_repo:
242 test_srcdir = os.path.join(self.srcdir, "kvm-unit-tests") 203 test_srcdir = os.path.join(self.srcdir, "kvm-unit-tests")
243 kvm_utils.get_git_branch(test_repo, test_branch, test_srcdir, 204 virt_utils.get_git_branch(test_repo, test_branch, test_srcdir,
244 test_commit, test_lbranch) 205 test_commit, test_lbranch)
245 unittest_cfg = os.path.join(test_srcdir, 'x86', 206 unittest_cfg = os.path.join(test_srcdir, 'x86',
246 'unittests.cfg') 207 'unittests.cfg')
247 self.test_srcdir = test_srcdir 208 self.test_srcdir = test_srcdir
248 else: 209 else:
249 unittest_cfg = os.path.join(userspace_srcdir, 'kvm', 'test', 'x86', 210 unittest_cfg = os.path.join(userspace_srcdir, 'kvm', 'test', 'x86',
250 'unittests.cfg') 211 'unittests.cfg')
251 self.unittest_cfg = None 212 self.unittest_cfg = None
252 if os.path.isfile(unittest_cfg): 213 if os.path.isfile(unittest_cfg):
253 self.unittest_cfg = unittest_cfg 214 self.unittest_cfg = unittest_cfg
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 def install(self): 340 def install(self):
380 self.install_unittests() 341 self.install_unittests()
381 self._clean_previous_installs() 342 self._clean_previous_installs()
382 self._get_packages() 343 self._get_packages()
383 self._install_packages() 344 self._install_packages()
384 create_symlinks(test_bindir=self.test_bindir, 345 create_symlinks(test_bindir=self.test_bindir,
385 bin_list=self.qemu_bin_paths, 346 bin_list=self.qemu_bin_paths,
386 unittest=self.unittest_prefix) 347 unittest=self.unittest_prefix)
387 self.reload_modules_if_needed() 348 self.reload_modules_if_needed()
388 if self.save_results: 349 if self.save_results:
389 save_build(self.srcdir, self.results_dir) 350 virt_installer.save_build(self.srcdir, self.results_dir)
390 351
391 352
392 class KojiInstaller(YumInstaller): 353 class KojiInstaller(YumInstaller):
393 """ 354 """
394 Class that handles installing KVM from the fedora build service, koji. 355 Class that handles installing KVM from the fedora build service, koji.
395 356 It uses yum to install and remove packages.
396 It uses yum to install and remove packages. Packages are specified
397 according to the syntax defined in the PkgSpec class.
398 """ 357 """
399 load_stock_modules = True 358 load_stock_modules = True
400 def set_install_params(self, test, params): 359 def set_install_params(self, test, params):
401 """ 360 """
402 Gets parameters and initializes the package downloader. 361 Gets parameters and initializes the package downloader.
403 362
404 @param test: kvm test object 363 @param test: kvm test object
405 @param params: Dictionary with test arguments 364 @param params: Dictionary with test arguments
406 """ 365 """
407 super(KojiInstaller, self).set_install_params(test, params) 366 super(KojiInstaller, self).set_install_params(test, params)
367 default_koji_cmd = '/usr/bin/koji'
368 default_src_pkg = 'qemu'
369 self.src_pkg = params.get("src_pkg", default_src_pkg)
408 self.tag = params.get("koji_tag", None) 370 self.tag = params.get("koji_tag", None)
409 self.koji_cmd = params.get("koji_cmd", None) 371 self.build = params.get("koji_build", None)
410 if self.tag is not None: 372 self.koji_cmd = params.get("koji_cmd", default_koji_cmd)
411 kvm_utils.set_default_koji_tag(self.tag)
412 self.koji_pkgs = eval(params.get("koji_pkgs", "[]"))
413 373
414 374
415 def _get_packages(self): 375 def _get_packages(self):
416 """ 376 """
417 Downloads the specific arch RPMs for the specific build name. 377 Downloads the specific arch RPMs for the specific build name.
418 """ 378 """
419 koji_client = kvm_utils.KojiClient(cmd=self.koji_cmd) 379 downloader = virt_utils.KojiDownloader(cmd=self.koji_cmd)
420 for pkg_text in self.koji_pkgs: 380 downloader.get(src_package=self.src_pkg, tag=self.tag,
421 pkg = kvm_utils.KojiPkgSpec(pkg_text) 381 build=self.build, dst_dir=self.srcdir)
422 if pkg.is_valid():
423 koji_client.get_pkgs(pkg, dst_dir=self.srcdir)
424 else:
425 logging.error('Package specification (%s) is invalid: %s', pkg,
426 pkg.describe_invalid())
427
428
429 def _clean_previous_installs(self):
430 kill_qemu_processes()
431 removable_packages = " ".join(self._get_rpm_names())
432 utils.system("yum -y remove %s" % removable_packages)
433 382
434 383
435 def install(self): 384 def install(self):
436 self._clean_previous_installs() 385 super(KojiInstaller, self)._clean_previous_installs()
437 self._get_packages() 386 self._get_packages()
438 self._install_packages() 387 super(KojiInstaller, self)._install_packages()
439 self.install_unittests() 388 self.install_unittests()
440 create_symlinks(test_bindir=self.test_bindir, 389 create_symlinks(test_bindir=self.test_bindir,
441 bin_list=self.qemu_bin_paths, 390 bin_list=self.qemu_bin_paths,
442 unittest=self.unittest_prefix) 391 unittest=self.unittest_prefix)
443 self.reload_modules_if_needed() 392 self.reload_modules_if_needed()
444 if self.save_results: 393 if self.save_results:
445 save_build(self.srcdir, self.results_dir) 394 virt_installer.save_build(self.srcdir, self.results_dir)
446
447
448 def _get_rpm_names(self):
449 all_rpm_names = []
450 koji_client = kvm_utils.KojiClient(cmd=self.koji_cmd)
451 for pkg_text in self.koji_pkgs:
452 pkg = kvm_utils.KojiPkgSpec(pkg_text)
453 rpm_names = koji_client.get_pkg_rpm_names(pkg)
454 all_rpm_names += rpm_names
455 return all_rpm_names
456
457
458 def _get_rpm_file_names(self):
459 all_rpm_file_names = []
460 koji_client = kvm_utils.KojiClient(cmd=self.koji_cmd)
461 for pkg_text in self.koji_pkgs:
462 pkg = kvm_utils.KojiPkgSpec(pkg_text)
463 rpm_file_names = koji_client.get_pkg_rpm_file_names(pkg)
464 all_rpm_file_names += rpm_file_names
465 return all_rpm_file_names
466
467
468 def _install_packages(self):
469 """
470 Install all downloaded packages.
471 """
472 os.chdir(self.srcdir)
473 rpm_file_names = " ".join(self._get_rpm_file_names())
474 utils.system("yum --nogpgcheck -y localinstall %s" % rpm_file_names)
475 395
476 396
477 class SourceDirInstaller(BaseInstaller): 397 class SourceDirInstaller(BaseInstaller):
478 """ 398 """
479 Class that handles building/installing KVM directly from a tarball or 399 Class that handles building/installing KVM directly from a tarball or
480 a single source code dir. 400 a single source code dir.
481 """ 401 """
482 def set_install_params(self, test, params): 402 def set_install_params(self, test, params):
483 """ 403 """
484 Initializes class attributes, and retrieves KVM code. 404 Initializes class attributes, and retrieves KVM code.
(...skipping 17 matching lines...) Expand all
502 "control file.") 422 "control file.")
503 else: 423 else:
504 shutil.copytree(srcdir, self.srcdir) 424 shutil.copytree(srcdir, self.srcdir)
505 425
506 if self.install_mode == 'release': 426 if self.install_mode == 'release':
507 release_tag = params.get("release_tag") 427 release_tag = params.get("release_tag")
508 release_dir = params.get("release_dir") 428 release_dir = params.get("release_dir")
509 release_listing = params.get("release_listing") 429 release_listing = params.get("release_listing")
510 logging.info("Installing KVM from release tarball") 430 logging.info("Installing KVM from release tarball")
511 if not release_tag: 431 if not release_tag:
512 release_tag = kvm_utils.get_latest_kvm_release_tag( 432 release_tag = virt_utils.get_latest_kvm_release_tag(
513 release_listing) 433 release_listing)
514 tarball = os.path.join(release_dir, 'kvm', release_tag, 434 tarball = os.path.join(release_dir, 'kvm', release_tag,
515 "kvm-%s.tar.gz" % release_tag) 435 "kvm-%s.tar.gz" % release_tag)
516 logging.info("Retrieving release kvm-%s" % release_tag) 436 logging.info("Retrieving release kvm-%s" % release_tag)
517 tarball = utils.unmap_url("/", tarball, "/tmp") 437 tarball = utils.unmap_url("/", tarball, "/tmp")
518 438
519 elif self.install_mode == 'snapshot': 439 elif self.install_mode == 'snapshot':
520 logging.info("Installing KVM from snapshot") 440 logging.info("Installing KVM from snapshot")
521 snapshot_dir = params.get("snapshot_dir") 441 snapshot_dir = params.get("snapshot_dir")
522 if not snapshot_dir: 442 if not snapshot_dir:
(...skipping 15 matching lines...) Expand all
538 raise error.TestError("KVM Tarball install specified but no" 458 raise error.TestError("KVM Tarball install specified but no"
539 " tarball provided on control file.") 459 " tarball provided on control file.")
540 logging.info("Installing KVM from a local tarball") 460 logging.info("Installing KVM from a local tarball")
541 logging.info("Using tarball %s") 461 logging.info("Using tarball %s")
542 tarball = utils.unmap_url("/", params.get("tarball"), "/tmp") 462 tarball = utils.unmap_url("/", params.get("tarball"), "/tmp")
543 463
544 if self.install_mode in ['release', 'snapshot', 'localtar']: 464 if self.install_mode in ['release', 'snapshot', 'localtar']:
545 utils.extract_tarball_to_dir(tarball, self.srcdir) 465 utils.extract_tarball_to_dir(tarball, self.srcdir)
546 466
547 if self.install_mode in ['release', 'snapshot', 'localtar', 'srcdir']: 467 if self.install_mode in ['release', 'snapshot', 'localtar', 'srcdir']:
548 self.repo_type = kvm_utils.check_kvm_source_dir(self.srcdir) 468 self.repo_type = virt_utils.check_kvm_source_dir(self.srcdir)
549 configure_script = os.path.join(self.srcdir, 'configure') 469 p = os.path.join(self.srcdir, 'configure')
550 self.configure_options = check_configure_options(configure_script) 470 self.configure_options = virt_installer.check_configure_options(p)
551 471
552 472
553 def _build(self): 473 def _build(self):
554 make_jobs = utils.count_cpus() 474 make_jobs = utils.count_cpus()
555 os.chdir(self.srcdir) 475 os.chdir(self.srcdir)
556 # For testing purposes, it's better to build qemu binaries with 476 # For testing purposes, it's better to build qemu binaries with
557 # debugging symbols, so we can extract more meaningful stack traces. 477 # debugging symbols, so we can extract more meaningful stack traces.
558 cfg = "./configure --prefix=%s" % self.prefix 478 cfg = "./configure --prefix=%s" % self.prefix
559 if "--disable-strip" in self.configure_options: 479 if "--disable-strip" in self.configure_options:
560 cfg += " --disable-strip" 480 cfg += " --disable-strip"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 else: 548 else:
629 logging.info("Loading stock KVM modules") 549 logging.info("Loading stock KVM modules")
630 _load_kvm_modules(mod_list, load_stock=True) 550 _load_kvm_modules(mod_list, load_stock=True)
631 551
632 552
633 def install(self): 553 def install(self):
634 self._build() 554 self._build()
635 self._install() 555 self._install()
636 self.reload_modules_if_needed() 556 self.reload_modules_if_needed()
637 if self.save_results: 557 if self.save_results:
638 save_build(self.srcdir, self.results_dir) 558 virt_installer.save_build(self.srcdir, self.results_dir)
639 559
640 560
641 class GitInstaller(SourceDirInstaller): 561 class GitInstaller(SourceDirInstaller):
642 def _pull_code(self): 562 def _pull_code(self):
643 """ 563 """
644 Retrieves code from git repositories. 564 Retrieves code from git repositories.
645 """ 565 """
646 params = self.params 566 params = self.params
647 567
648 kernel_repo = params.get("git_repo") 568 kernel_repo = params.get("git_repo")
(...skipping 15 matching lines...) Expand all
664 kernel_patches = eval(params.get("kernel_patches", "[]")) 584 kernel_patches = eval(params.get("kernel_patches", "[]"))
665 user_patches = eval(params.get("user_patches", "[]")) 585 user_patches = eval(params.get("user_patches", "[]"))
666 kmod_patches = eval(params.get("user_patches", "[]")) 586 kmod_patches = eval(params.get("user_patches", "[]"))
667 587
668 if not user_repo: 588 if not user_repo:
669 message = "KVM user git repository path not specified" 589 message = "KVM user git repository path not specified"
670 logging.error(message) 590 logging.error(message)
671 raise error.TestError(message) 591 raise error.TestError(message)
672 592
673 userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace") 593 userspace_srcdir = os.path.join(self.srcdir, "kvm_userspace")
674 kvm_utils.get_git_branch(user_repo, user_branch, userspace_srcdir, 594 virt_utils.get_git_branch(user_repo, user_branch, userspace_srcdir,
675 user_commit, user_lbranch) 595 user_commit, user_lbranch)
676 self.userspace_srcdir = userspace_srcdir 596 self.userspace_srcdir = userspace_srcdir
677 597
678 if user_patches: 598 if user_patches:
679 os.chdir(self.userspace_srcdir) 599 os.chdir(self.userspace_srcdir)
680 for patch in user_patches: 600 for patch in user_patches:
681 utils.get_file(patch, os.path.join(self.userspace_srcdir, 601 utils.get_file(patch, os.path.join(self.userspace_srcdir,
682 os.path.basename(patch))) 602 os.path.basename(patch)))
683 utils.system('patch -p1 < %s' % os.path.basename(patch)) 603 utils.system('patch -p1 < %s' % os.path.basename(patch))
684 604
685 if kernel_repo: 605 if kernel_repo:
686 kernel_srcdir = os.path.join(self.srcdir, "kvm") 606 kernel_srcdir = os.path.join(self.srcdir, "kvm")
687 kvm_utils.get_git_branch(kernel_repo, kernel_branch, kernel_srcdir, 607 virt_utils.get_git_branch(kernel_repo, kernel_branch, kernel_srcdir,
688 kernel_commit, kernel_lbranch) 608 kernel_commit, kernel_lbranch)
689 self.kernel_srcdir = kernel_srcdir 609 self.kernel_srcdir = kernel_srcdir
690 if kernel_patches: 610 if kernel_patches:
691 os.chdir(self.kernel_srcdir) 611 os.chdir(self.kernel_srcdir)
692 for patch in kernel_patches: 612 for patch in kernel_patches:
693 utils.get_file(patch, os.path.join(self.userspace_srcdir, 613 utils.get_file(patch, os.path.join(self.userspace_srcdir,
694 os.path.basename(patch))) 614 os.path.basename(patch)))
695 utils.system('patch -p1 < %s' % os.path.basename(patch)) 615 utils.system('patch -p1 < %s' % os.path.basename(patch))
696 else: 616 else:
697 self.kernel_srcdir = None 617 self.kernel_srcdir = None
698 618
699 if kmod_repo: 619 if kmod_repo:
700 kmod_srcdir = os.path.join (self.srcdir, "kvm_kmod") 620 kmod_srcdir = os.path.join (self.srcdir, "kvm_kmod")
701 kvm_utils.get_git_branch(kmod_repo, kmod_branch, kmod_srcdir, 621 virt_utils.get_git_branch(kmod_repo, kmod_branch, kmod_srcdir,
702 kmod_commit, kmod_lbranch) 622 kmod_commit, kmod_lbranch)
703 self.kmod_srcdir = kmod_srcdir 623 self.kmod_srcdir = kmod_srcdir
704 if kmod_patches: 624 if kmod_patches:
705 os.chdir(self.kmod_srcdir) 625 os.chdir(self.kmod_srcdir)
706 for patch in kmod_patches: 626 for patch in kmod_patches:
707 utils.get_file(patch, os.path.join(self.userspace_srcdir, 627 utils.get_file(patch, os.path.join(self.userspace_srcdir,
708 os.path.basename(patch))) 628 os.path.basename(patch)))
709 utils.system('patch -p1 < %s' % os.path.basename(patch)) 629 utils.system('patch -p1 < %s' % os.path.basename(patch))
710 else: 630 else:
711 self.kmod_srcdir = None 631 self.kmod_srcdir = None
712 632
713 configure_script = os.path.join(self.userspace_srcdir, 'configure') 633 p = os.path.join(self.userspace_srcdir, 'configure')
714 self.configure_options = check_configure_options(configure_script) 634 self.configure_options = virt_installer.check_configure_options(p)
715 635
716 636
717 def _build(self): 637 def _build(self):
718 make_jobs = utils.count_cpus() 638 make_jobs = utils.count_cpus()
719 cfg = './configure' 639 cfg = './configure'
720 if self.kmod_srcdir: 640 if self.kmod_srcdir:
721 logging.info('Building KVM modules') 641 logging.info('Building KVM modules')
722 os.chdir(self.kmod_srcdir) 642 os.chdir(self.kmod_srcdir)
723 module_build_steps = [cfg, 643 module_build_steps = [cfg,
724 'make clean', 644 'make clean',
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 bin_list=None, 697 bin_list=None,
778 unittest=self.unittest_prefix) 698 unittest=self.unittest_prefix)
779 699
780 700
781 def install(self): 701 def install(self):
782 self._pull_code() 702 self._pull_code()
783 self._build() 703 self._build()
784 self._install() 704 self._install()
785 self.reload_modules_if_needed() 705 self.reload_modules_if_needed()
786 if self.save_results: 706 if self.save_results:
787 save_build(self.srcdir, self.results_dir) 707 virt_installer.save_build(self.srcdir, self.results_dir)
788 708
789 709
790 class PreInstalledKvm(BaseInstaller): 710 class PreInstalledKvm(BaseInstaller):
791 # load_modules() will use the stock modules: 711 # load_modules() will use the stock modules:
792 load_stock_modules = True 712 load_stock_modules = True
793 def install(self): 713 def install(self):
794 logging.info("Expecting KVM to be already installed. Doing nothing") 714 logging.info("Expecting KVM to be already installed. Doing nothing")
795 715
796 716
797 class FailedInstaller: 717 class FailedInstaller:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 return c 749 return c
830 750
831 751
832 def make_installer(params): 752 def make_installer(params):
833 # priority: 753 # priority:
834 # - 'install_mode' param 754 # - 'install_mode' param
835 # - 'mode' param 755 # - 'mode' param
836 mode = params.get("install_mode", params.get("mode")) 756 mode = params.get("install_mode", params.get("mode"))
837 klass = _installer_class(mode) 757 klass = _installer_class(mode)
838 return klass(mode) 758 return klass(mode)
OLDNEW
« no previous file with comments | « client/virt/common.py ('k') | client/virt/kvm_monitor.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698