Exemplo n.º 1
0
    def setup(self):
        """
        Configure the environment for unattended install.

        Uses an appropriate strategy according to each install model.
        """
        logging.info("Starting unattended install setup")
        if DEBUG:
            virt_utils.display_attributes(self)

        if self.unattended_file and (self.floppy or self.cdrom_unattended):
            self.setup_boot_disk()
        if self.medium in ["cdrom", "kernel_initrd"]:
            if self.kernel and self.initrd:
                self.setup_cdrom()
        elif self.medium == "url":
            self.setup_url()
            if self.url == 'auto':
                self.setup_url_auto()
                self.setup_unattended_http_server()
        elif self.medium == "nfs":
            self.setup_nfs()
        else:
            raise ValueError("Unexpected installation method %s" %
                             self.medium)
Exemplo n.º 2
0
 def setup(self):
     logging.debug("Starting enospc setup")
     error.context("performing enospc setup")
     virt_utils.display_attributes(self)
     # Double check if there aren't any leftovers
     self.cleanup()
     try:
         utils.run("%s create -f raw %s 10G" %
                   (self.qemu_img_binary, self.raw_file_path))
         # Associate a loopback device with the raw file.
         # Subject to race conditions, that's why try here to associate
         # it with the raw file as quickly as possible
         l_result = utils.run("losetup -f")
         utils.run("losetup -f %s" % self.raw_file_path)
         self.loopback = l_result.stdout.strip()
         # Add the loopback device configured to the list of pvs
         # recognized by LVM
         utils.run("pvcreate %s" % self.loopback)
         utils.run("vgcreate %s %s" % (self.vgtest_name, self.loopback))
         # Create an lv inside the vg with starting size of 200M
         utils.run("lvcreate -L 200M -n %s %s" %
                   (self.lvtest_name, self.vgtest_name))
         # Create a 10GB qcow2 image in the logical volume
         utils.run("%s create -f qcow2 %s 10G" %
                   (self.qemu_img_binary, self.lvtest_device))
         # Let's symlink the logical volume with the image name that autotest
         # expects this device to have
         os.symlink(self.lvtest_device, self.qcow_file_path)
     except Exception, e:
         self.cleanup()
         raise
Exemplo n.º 3
0
 def setup(self):
     logging.debug("Starting enospc setup")
     error.context("performing enospc setup")
     virt_utils.display_attributes(self)
     # Double check if there aren't any leftovers
     self.cleanup()
     try:
         utils.run("%s create -f raw %s 10G" %
                   (self.qemu_img_binary, self.raw_file_path))
         # Associate a loopback device with the raw file.
         # Subject to race conditions, that's why try here to associate
         # it with the raw file as quickly as possible
         l_result = utils.run("losetup -f")
         utils.run("losetup -f %s" % self.raw_file_path)
         self.loopback = l_result.stdout.strip()
         # Add the loopback device configured to the list of pvs
         # recognized by LVM
         utils.run("pvcreate %s" % self.loopback)
         utils.run("vgcreate %s %s" % (self.vgtest_name, self.loopback))
         # Create an lv inside the vg with starting size of 200M
         utils.run("lvcreate -L 200M -n %s %s" %
                   (self.lvtest_name, self.vgtest_name))
         # Create a 10GB qcow2 image in the logical volume
         utils.run("%s create -f qcow2 %s 10G" %
                   (self.qemu_img_binary, self.lvtest_device))
         # Let's symlink the logical volume with the image name that autotest
         # expects this device to have
         os.symlink(self.lvtest_device, self.qcow_file_path)
     except Exception, e:
         self.cleanup()
         raise