Ejemplo n.º 1
0
 def setup(self):
     error.context("performing setup", logging.debug)
     utils_misc.display_attributes(self)
     # Double check if there aren't any leftovers
     self.cleanup()
     try:
         for f in self.raw_files:
             utils.run("%s create -f raw %s 10G" %
                       (self.qemu_img_binary, f))
             # 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" % f)
             loopback = l_result.stdout.strip()
             self.loopback.append(loopback)
             # Add the loopback device configured to the list of pvs
             # recognized by LVM
             utils.run("pvcreate %s" % loopback)
         loopbacks = " ".join(self.loopback)
         utils.run("vgcreate %s %s" % (self.vgtest_name, loopbacks))
         # Create an lv inside the vg with starting size of 200M
         utils.run("lvcreate -L 19G -n %s %s" %
                   (self.lvtest_name, self.vgtest_name))
     except Exception:
         try:
             self.cleanup()
         except Exception, e:
             logging.warn(e)
         raise
Ejemplo 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:
         self.cleanup()
         raise
Ejemplo n.º 3
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:
         try:
             self.cleanup()
         except Exception, e:
             logging.warn(e)
         raise
Ejemplo n.º 4
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()

        # Update params dictionary as some of the values could be updated
        for a in self.attributes:
            self.params[a] =  getattr(self, a)
Ejemplo n.º 5
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()
Ejemplo n.º 6
0
 def setup(self):
     error_context.context("performing setup", logging.debug)
     utils_misc.display_attributes(self)
     # Double check if there aren't any leftovers
     self.cleanup()
     try:
         for f in self.raw_files:
             process.run("%s create -f raw %s 10G" %
                         (self.qemu_img_binary, f))
             # 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 = process.run("losetup -f")
             process.run("losetup -f %s" % f)
             loopback = l_result.stdout.strip()
             self.loopback.append(loopback)
             # Add the loopback device configured to the list of pvs
             # recognized by LVM
             process.run("pvcreate %s" % loopback)
         loopbacks = " ".join(self.loopback)
         process.run("vgcreate %s %s" % (self.vgtest_name, loopbacks))
         # Create an lv inside the vg with starting size of 200M
         process.run("lvcreate -L 19G -n %s %s" %
                     (self.lvtest_name, self.vgtest_name))
     except Exception:
         try:
             self.cleanup()
         except Exception as e:
             logging.warn(e)
         raise
Ejemplo n.º 7
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()
            if self.params.get("store_boot_disk") == "yes":
                logging.info("Sotre the boot disk to result directory for"
                             " further debug")
                src_dir = self.floppy or self.cdrom_unattended
                dst_dir = self.results_dir
                shutil.copy(src_dir, dst_dir)

        # Update params dictionary as some of the values could be updated
        for a in self.attributes:
            self.params[a] = getattr(self, a)