Esempio 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:
            utils_misc.display_attributes(self)

        if self.syslog_server_enabled == 'yes':
            start_syslog_server_thread(self.syslog_server_ip,
                                       self.syslog_server_port,
                                       self.syslog_server_tcp)

        if self.medium in ["cdrom", "kernel_initrd"]:
            if self.kernel and self.initrd:
                self.setup_cdrom()
        elif self.medium == "url":
            self.setup_url()
        elif self.medium == "nfs":
            self.setup_nfs()
        elif self.medium == "import":
            self.setup_import()
        else:
            raise ValueError("Unexpected installation method %s" % self.medium)
        if self.unattended_file and (self.floppy or self.cdrom_unattended):
            self.setup_boot_disk()
Esempio n. 2
0
 def setup(self):
     logging.debug("Starting enospc setup")
     error.context("performing enospc setup")
     utils_misc.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
Esempio n. 3
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:
            utils_misc.display_attributes(self)

        if self.syslog_server_enabled == 'yes':
            start_syslog_server_thread(self.syslog_server_ip,
                                       self.syslog_server_port,
                                       self.syslog_server_tcp)

        if self.medium in ["cdrom", "kernel_initrd"]:
            if self.kernel and self.initrd:
                self.setup_cdrom()
        elif self.medium == "url":
            self.setup_url()
        elif self.medium == "nfs":
            self.setup_nfs()
        elif self.medium == "import":
            self.setup_import()
        else:
            raise ValueError("Unexpected installation method %s" %
                             self.medium)
        if self.unattended_file and (self.floppy or self.cdrom_unattended):
            self.setup_boot_disk()
Esempio n. 4
0
 def setup(self):
     logging.debug("Starting enospc setup")
     error.context("performing enospc setup")
     utils_misc.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:
         self.cleanup()
         raise