コード例 #1
0
ファイル: lxc.py プロジェクト: seojineer/infrastructure_lava
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self,
                                       job=self.job,
                                       parameters=parameters)
     if parameters['nexell_ext']:
         self.internal_pipeline.add_action(NexellCreateAction())
         self.internal_pipeline.add_action(OverlayAction())
         self.internal_pipeline.add_action(ApplyNexellOverlay())
     else:
         self.internal_pipeline.add_action(LxcCreateAction())
         self.internal_pipeline.add_action(OverlayAction())
         self.internal_pipeline.add_action(ApplyLxcOverlay())
コード例 #2
0
ファイル: image.py プロジェクト: cdaudt/lava-dispatcher
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self,
                                       job=self.job,
                                       parameters=parameters)
     path = self.mkdtemp()
     if 'uefi' in parameters:
         uefi_path = self.mkdtemp()
         download = DownloaderAction('uefi', uefi_path)
         download.max_retries = 3
         self.internal_pipeline.add_action(download)
         # uefi option of QEMU needs a directory, not the filename
         self.set_common_data('image', 'uefi_dir',
                              uefi_path)  # just the path, not the filename
         # alternatively use the -bios option and standard image args
     for image in parameters['images'].keys():
         if image != 'yaml_line':
             download = DownloaderAction(image, path)
             download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
             self.internal_pipeline.add_action(download)
             if parameters['images'][image].get('format', '') == 'qcow2':
                 self.internal_pipeline.add_action(
                     QCowConversionAction(image))
     self.internal_pipeline.add_action(CustomisationAction())
     self.internal_pipeline.add_action(
         OverlayAction())  # idempotent, includes testdef
     self.internal_pipeline.add_action(ApplyOverlayGuest())
     self.internal_pipeline.add_action(DeployDeviceEnvironment())
コード例 #3
0
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self,
                                       job=self.job,
                                       parameters=parameters)
     path = self.mkdtemp()
     if 'uefi' in parameters:
         uefi_path = self.mkdtemp()
         download = DownloaderAction('uefi', uefi_path)
         download.max_retries = 3
         self.internal_pipeline.add_action(download)
         # uefi option of QEMU needs a directory, not the filename
         self.set_namespace_data(action=self.name,
                                 label='image',
                                 key='uefi_dir',
                                 value=uefi_path,
                                 parameters=parameters)
         # alternatively use the -bios option and standard image args
     for image in parameters['images'].keys():
         if image != 'yaml_line':
             download = DownloaderAction(image, path)
             download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
             self.internal_pipeline.add_action(download)
             if parameters['images'][image].get('format', '') == 'qcow2':
                 self.internal_pipeline.add_action(
                     QCowConversionAction(image))
     self.internal_pipeline.add_action(ExtractNfsAction())
     self.internal_pipeline.add_action(OverlayAction())
     self.internal_pipeline.add_action(ApplyOverlayTftp())
     self.internal_pipeline.add_action(DeployDeviceEnvironment())
コード例 #4
0
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self,
                                       job=self.job,
                                       parameters=parameters)
     self.internal_pipeline.add_action(LxcCreateAction())
     self.internal_pipeline.add_action(OverlayAction())
     self.internal_pipeline.add_action(ApplyLxcOverlay())
コード例 #5
0
    def populate(self, parameters):
        self.internal_pipeline = Pipeline(parent=self,
                                          job=self.job,
                                          parameters=parameters)
        self.internal_pipeline.add_action(OverlayAction())
        if hasattr(self.job.device, 'power_state'):
            if self.job.device.power_state in ['on', 'off']:
                self.internal_pipeline.add_action(ConnectDevice())
                self.internal_pipeline.add_action(ResetDevice())

        image_keys = list(parameters['images'].keys())
        # Nexell extension
        if 'nexell_ext' in image_keys:
            self.logger.debug("SUKER: parameters in deploy/fastboot.py : " +
                              str(parameters))
            self.internal_pipeline.add_action(
                EnterNexellFastbootAction(parameters, 'deploy_script',
                                          'deploy_command1', 'dir_name'))
            self.internal_pipeline.add_action(
                ApplyNexellDeployAction(parameters, 'deploy_script',
                                        'deploy_command2', 'dir_name'))
        else:
            self.internal_pipeline.add_action(EnterFastbootAction())
            self.internal_pipeline.add_action(LxcAddDeviceAction())

        if 'image' in image_keys:
            download = DownloaderAction('image', self.fastboot_dir)
            download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
            self.internal_pipeline.add_action(download)
            self.internal_pipeline.add_action(FastbootUpdateAction())
        if 'ptable' in image_keys:
            download = DownloaderAction('ptable', self.fastboot_dir)
            download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
            self.internal_pipeline.add_action(download)
            self.internal_pipeline.add_action(ApplyPtableAction())
        if 'boot' in image_keys:
            download = DownloaderAction('boot', self.fastboot_dir)
            download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
            self.internal_pipeline.add_action(download)
            self.internal_pipeline.add_action(ApplyBootAction())
        if 'cache' in image_keys:
            download = DownloaderAction('cache', self.fastboot_dir)
            download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
            self.internal_pipeline.add_action(download)
            self.internal_pipeline.add_action(ApplyCacheAction())
        if 'userdata' in image_keys:
            download = DownloaderAction('userdata', self.fastboot_dir)
            download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
            self.internal_pipeline.add_action(download)
            self.internal_pipeline.add_action(ApplyUserdataAction())
        if 'system' in image_keys:
            download = DownloaderAction('system', self.fastboot_dir)
            download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
            self.internal_pipeline.add_action(download)
            self.internal_pipeline.add_action(ApplySystemAction())
        if 'vendor' in image_keys:
            download = DownloaderAction('vendor', self.fastboot_dir)
            download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
            self.internal_pipeline.add_action(download)
            self.internal_pipeline.add_action(ApplyVendorAction())
コード例 #6
0
    def populate(self, parameters):
        self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
        if self.test_needs_overlay(parameters):
            self.internal_pipeline.add_action(CustomisationAction())
            self.internal_pipeline.add_action(OverlayAction())
        # Check if the device has a power command such as HiKey, Dragonboard,
        # etc. against device that doesn't like Nexus, etc.
        if self.job.device.get('fastboot_via_uboot', False):
            self.internal_pipeline.add_action(ConnectDevice())
            self.internal_pipeline.add_action(UBootEnterFastbootAction())
        elif self.job.device.power_command:
            self.force_prompt = True
            self.internal_pipeline.add_action(ConnectDevice())
            self.internal_pipeline.add_action(ResetDevice())
        else:
            self.internal_pipeline.add_action(EnterFastbootAction())
        self.internal_pipeline.add_action(WaitUSBDeviceAction(
            device_actions=['add']))

        fastboot_dir = self.mkdtemp()
        image_keys = list(parameters['images'].keys())
        image_keys.sort()
        for image in image_keys:
            if image != 'yaml_line':
                self.internal_pipeline.add_action(DownloaderAction(image, fastboot_dir))
                if parameters['images'][image].get('apply-overlay', False):
                    if self.test_needs_overlay(parameters):
                        self.internal_pipeline.add_action(
                            ApplyOverlaySparseImage(image))
                if self.test_needs_overlay(parameters) and \
                   self.test_needs_deployment(parameters):
                    self.internal_pipeline.add_action(
                        DeployDeviceEnvironment())
        self.internal_pipeline.add_action(LxcAddDeviceAction())
        self.internal_pipeline.add_action(FastbootFlashAction())
コード例 #7
0
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self,
                                       job=self.job,
                                       parameters=parameters)
     path = self.mkdtemp()
     if 'uefi' in parameters:
         uefi_path = self.mkdtemp()
         self.internal_pipeline.add_action(
             DownloaderAction('uefi', uefi_path))
         # uefi option of QEMU needs a directory, not the filename
         self.set_namespace_data(action=self.name,
                                 label='image',
                                 key='uefi_dir',
                                 value=uefi_path,
                                 parameters=parameters)
         # alternatively use the -bios option and standard image args
     for image in parameters['images'].keys():
         if image != 'yaml_line':
             self.internal_pipeline.add_action(DownloaderAction(
                 image, path))
             if parameters['images'][image].get('format', '') == 'qcow2':
                 self.internal_pipeline.add_action(
                     QCowConversionAction(image))
     if self.test_needs_overlay(parameters):
         self.internal_pipeline.add_action(CustomisationAction())
         self.internal_pipeline.add_action(
             OverlayAction())  # idempotent, includes testdef
         self.internal_pipeline.add_action(ApplyOverlayGuest())
     if self.test_needs_deployment(parameters):
         self.internal_pipeline.add_action(DeployDeviceEnvironment())
コード例 #8
0
    def populate(self, parameters):
        self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
        self.internal_pipeline.add_action(OverlayAction())
        if hasattr(self.job.device, 'power_state'):
            if self.job.device.power_state in ['on', 'off']:
                self.internal_pipeline.add_action(ConnectDevice())
                self.internal_pipeline.add_action(PowerOn())
        self.internal_pipeline.add_action(EnterFastbootAction())
        self.internal_pipeline.add_action(LxcAddDeviceAction())

        image_keys = list(parameters['images'].keys())
        fastboot_dir = self.mkdtemp()
        # Add the required actions
        checks = [('image', FastbootUpdateAction),
                  ('ptable', ApplyPtableAction),
                  ('boot', ApplyBootAction),
                  ('cache', ApplyCacheAction),
                  ('userdata', ApplyUserdataAction),
                  ('system', ApplySystemAction),
                  ('vendor', ApplyVendorAction)]
        for (key, cls) in checks:
            if key in image_keys:
                download = DownloaderAction(key, fastboot_dir)
                download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
                self.internal_pipeline.add_action(download)
                self.internal_pipeline.add_action(cls())
コード例 #9
0
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self,
                                       job=self.job,
                                       parameters=parameters)
     tar_flags = parameters['deployment_data'][
         'tar_flags'] if 'tar_flags' in parameters['deployment_data'].keys(
         ) else ''
     self.set_namespace_data(action=self.name,
                             label=self.name,
                             key='tar_flags',
                             value=tar_flags,
                             parameters=parameters)
     self.internal_pipeline.add_action(OverlayAction())
     for item in self.items:
         if item in parameters:
             self.internal_pipeline.add_action(
                 DownloaderAction(item, path=self.mkdtemp()), parameters)
             self.set_namespace_data(action=self.name,
                                     label='scp',
                                     key=item,
                                     value=True,
                                     parameters=parameters)
     # we might not have anything to download, just the overlay to push
     self.internal_pipeline.add_action(PrepareOverlayScp())
     # prepare the device environment settings in common data for enabling in the boot step
     self.internal_pipeline.add_action(DeployDeviceEnvironment())
コード例 #10
0
ファイル: nbd.py プロジェクト: kernelci/lava-dispatcher
    def populate(self, parameters):
        self.tftp_dir = self.mkdtemp(override=tftpd_dir())
        self.internal_pipeline = Pipeline(parent=self,
                                          job=self.job,
                                          parameters=parameters)
        self.set_namespace_data(action=self.name,
                                label='tftp',
                                key='tftp_dir',
                                value=self.tftp_dir,
                                parameters=parameters)

        for key in ['initrd', 'kernel', 'dtb', 'nbdroot']:
            if key in parameters:
                download = DownloaderAction(key, path=self.tftp_dir)
                download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
                self.internal_pipeline.add_action(download)
                if key == 'initrd':
                    self.set_namespace_data(action="tftp-deploy",
                                            label='tftp',
                                            key='ramdisk',
                                            value=True,
                                            parameters=parameters)
                    self.set_namespace_data(action=self.name,
                                            label='nbd',
                                            key='initrd',
                                            value=True,
                                            parameters=parameters)

        # prepare overlay
        self.internal_pipeline.add_action(OverlayAction())
        # setup values for protocol and later steps
        self.set_namespace_data(action=self.name,
                                label='nbd',
                                key='initrd',
                                value=True,
                                parameters=parameters)
        # store in parameters for protocol 'xnbd' to tear-down xnbd-server
        # and store in namespace for boot action
        # ip
        parameters['lava-xnbd'] = {}
        self.nbd_ip = dispatcher_ip(self.job.parameters['dispatcher'])
        parameters['lava-xnbd']['ip'] = self.nbd_ip
        self.set_namespace_data(action=self.name,
                                label='nbd',
                                key='nbd_server_ip',
                                value=self.nbd_ip,
                                parameters=parameters)
        # port
        self.nbd_port = get_free_port(self.job.parameters['dispatcher'])
        parameters['lava-xnbd']['port'] = self.nbd_port
        self.set_namespace_data(action=self.name,
                                label='nbd',
                                key='nbd_server_port',
                                value=self.nbd_port,
                                parameters=parameters)
        # handle XnbdAction next - bring-up xnbd-server
        self.internal_pipeline.add_action(XnbdAction())
コード例 #11
0
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self, job=self.job,
                                       parameters=parameters)
     self.internal_pipeline.add_action(LxcCreateAction())
     if 'packages' in parameters:
         self.internal_pipeline.add_action(LxcStartAction())
         self.internal_pipeline.add_action(LxcAptUpdateAction())
         self.internal_pipeline.add_action(LxcAptInstallAction())
         self.internal_pipeline.add_action(LxcStopAction())
     # needed if export device environment is also to be used
     self.internal_pipeline.add_action(DeployDeviceEnvironment())
     self.internal_pipeline.add_action(OverlayAction())
     self.internal_pipeline.add_action(ApplyLxcOverlay())
コード例 #12
0
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self, job=self.job,
                                       parameters=parameters)
     self.internal_pipeline.add_action(LxcCreateAction())
     if 'packages' in parameters:
         self.internal_pipeline.add_action(LxcStartAction())
         self.internal_pipeline.add_action(LxcAptUpdateAction())
         self.internal_pipeline.add_action(LxcAptInstallAction())
         self.internal_pipeline.add_action(LxcStopAction())
     if self.test_needs_deployment(parameters):
         self.internal_pipeline.add_action(DeployDeviceEnvironment())
     if self.test_needs_overlay(parameters):
         self.internal_pipeline.add_action(OverlayAction())
         self.internal_pipeline.add_action(ApplyLxcOverlay())
コード例 #13
0
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self,
                                       job=self.job,
                                       parameters=parameters)
     self.internal_pipeline.add_action(
         ExtractNfsRootfs())  # idempotent, checks for nfsrootfs parameter
     self.internal_pipeline.add_action(
         OverlayAction())  # idempotent, includes testdef
     self.internal_pipeline.add_action(
         ExtractRamdisk())  # idempotent, checks for a ramdisk parameter
     self.internal_pipeline.add_action(
         ExtractModules())  # idempotent, checks for a modules parameter
     self.internal_pipeline.add_action(ApplyOverlayTftp())
     self.internal_pipeline.add_action(
         CompressRamdisk())  # idempotent, checks for a ramdisk parameter
コード例 #14
0
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
     self.internal_pipeline.add_action(OverlayAction())
     for item in self.items:
         if item in parameters:
             download = DownloaderAction(item, path=self.scp_dir)
             download.max_retries = 3
             self.internal_pipeline.add_action(download, parameters)
             self.set_common_data('scp', item, True)
     # we might not have anything to download, just the overlay to push
     self.internal_pipeline.add_action(PrepareOverlayScp())
     # prepare the device environment settings in common data for enabling in the boot step
     self.internal_pipeline.add_action(DeployDeviceEnvironment())
     scp = Scp('overlay')
     self.internal_pipeline.add_action(scp)
コード例 #15
0
ファイル: ssh.py プロジェクト: cdaudt/lava-dispatcher
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
     tar_flags = parameters['deployment_data']['tar_flags'] if 'tar_flags' in parameters['deployment_data'].keys() else ''
     self.set_common_data(self.name, 'tar_flags', tar_flags)
     self.internal_pipeline.add_action(OverlayAction())
     for item in self.items:
         if item in parameters:
             download = DownloaderAction(item, path=self.mkdtemp())
             download.max_retries = 3
             self.internal_pipeline.add_action(download, parameters)
             self.set_common_data('scp', item, True)
     # we might not have anything to download, just the overlay to push
     self.internal_pipeline.add_action(PrepareOverlayScp())
     # prepare the device environment settings in common data for enabling in the boot step
     self.internal_pipeline.add_action(DeployDeviceEnvironment())
コード例 #16
0
ファイル: image.py プロジェクト: cataglyphis/LAVA
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self,
                                       job=self.job,
                                       parameters=parameters)
     path = mkdtemp()
     download = DownloaderAction('image', path)
     download.max_retries = 3  # overridden by failure_retry in the parameters, if set.
     self.internal_pipeline.add_action(download)
     if parameters.get('format', '') == 'qcow2':
         self.internal_pipeline.add_action(QCowConversionAction('image'))
     self.internal_pipeline.add_action(MountAction())
     self.internal_pipeline.add_action(CustomisationAction())
     self.internal_pipeline.add_action(
         OverlayAction())  # idempotent, includes testdef
     self.internal_pipeline.add_action(
         ApplyOverlayImage())  # specific to image deployments
     self.internal_pipeline.add_action(DeployDeviceEnvironment())
     self.internal_pipeline.add_action(UnmountAction())
コード例 #17
0
 def populate(self, parameters):
     self.internal_pipeline = Pipeline(parent=self,
                                       job=self.job,
                                       parameters=parameters)
     self.internal_pipeline.add_action(
         ExtractNfsRootfs())  # idempotent, checks for nfsrootfs parameter
     self.internal_pipeline.add_action(
         OverlayAction())  # idempotent, includes testdef
     self.internal_pipeline.add_action(
         ExtractRamdisk())  # idempotent, checks for a ramdisk parameter
     self.internal_pipeline.add_action(
         ExtractModules())  # idempotent, checks for a modules parameter
     self.internal_pipeline.add_action(ApplyOverlayTftp())
     if 'kernel' in parameters and 'type' in parameters['kernel']:
         self.internal_pipeline.add_action(PrepareKernelAction())
     self.internal_pipeline.add_action(ConfigurePreseedFile(
     ))  # idempotent, checks for a preseed parameter
     self.internal_pipeline.add_action(
         CompressRamdisk())  # idempotent, checks for a ramdisk parameter
コード例 #18
0
 def populate(self, parameters):
     self.preseed_path = self.mkdtemp()
     self.internal_pipeline = Pipeline(parent=self,
                                       job=self.job,
                                       parameters=parameters)
     self.internal_pipeline.add_action(IsoEmptyImage())
     # the preseed file needs to go into the dispatcher apache tmp directory.
     self.internal_pipeline.add_action(
         DownloaderAction('preseed', self.preseed_path))
     self.internal_pipeline.add_action(
         DownloaderAction('iso', self.mkdtemp()))
     self.internal_pipeline.add_action(IsoPullInstaller())
     self.internal_pipeline.add_action(QemuCommandLine())
     # prepare overlay at this stage - make it available after installation.
     self.internal_pipeline.add_action(CustomisationAction())
     self.internal_pipeline.add_action(
         OverlayAction())  # idempotent, includes testdef
     self.internal_pipeline.add_action(ApplyOverlayGuest())
     self.internal_pipeline.add_action(DeployDeviceEnvironment())
コード例 #19
0
 def populate(self, parameters):
     """
     The dispatcher does the first download as the first deployment is not guaranteed to
     have DNS resolution fully working, so we can use the IP address of the dispatcher
     to get it (with the advantage that the dispatcher decompresses it so that the ramdisk
     can pipe the raw image directly from wget to dd.
     This also allows the use of local file:// locations which are visible to the dispatcher
     but not the device.
     """
     self.image_path = self.mkdtemp()
     self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters)
     self.internal_pipeline.add_action(CustomisationAction())
     if self.test_needs_overlay(parameters):
         self.internal_pipeline.add_action(OverlayAction())  # idempotent, includes testdef
     if 'image' in parameters:
         self.internal_pipeline.add_action(DownloaderAction('image', path=self.image_path))
         if self.test_needs_overlay(parameters):
             self.internal_pipeline.add_action(ApplyOverlayImage())
         self.internal_pipeline.add_action(DDAction())
     # FIXME: could support tarballs too
     if self.test_needs_deployment(parameters):
         self.internal_pipeline.add_action(DeployDeviceEnvironment())
コード例 #20
0
    def __init__(self, parent):
        super(DeployImage, self).__init__(parent)
        self.action = DeployImageAction()
        self.action.job = self.job
        parent.add_action(self.action)

        internal_pipeline = Pipeline(parent=self.action, job=self.job)
        internal_pipeline.add_action(DownloaderAction())
        internal_pipeline.add_action(ChecksumAction())
        internal_pipeline.add_action(MountAction())
        internal_pipeline.add_action(CustomisationAction())
        for action_params in self.job.parameters['actions']:
            if 'test' in action_params:
                # FIXME: does it matter if testdef_action runs before overlay?
                testdef_action = TestDefinitionAction()
                testdef_action.parameters = action_params
                internal_pipeline.add_action(testdef_action)
                if 'target_group' in self.job.parameters:
                    internal_pipeline.add_action(MultinodeOverlayAction())
                if 'lmp_module' in self.job.parameters:
                    internal_pipeline.add_action(LMPOverlayAction())
                internal_pipeline.add_action(OverlayAction())
        internal_pipeline.add_action(UnmountAction())