예제 #1
0
    def _start_image_for_build(self, user_info, node_instance):

        self._prepare_machine_for_build_image(user_info)

        manifest_downloader = ManifestDownloader(self.slConfigHolder)

        image_id = node_instance.get_image_id()
        node_instance.set_image_attributes({
            'imageVersion':
            manifest_downloader.getImageVersion(imageId=image_id)
        })

        self._update_stratuslab_config_holder_for_build_image(
            user_info, node_instance)

        self.creator = Creator(image_id, self.slConfigHolder)
        self.creator.setListener(self._get_listener())

        createImageTemplateDict = self.creator._getCreateImageTemplateDict()

        def our_create_template_dict():
            createImageTemplateDict.update({})
            return createImageTemplateDict

        self.creator._getCreateImageTemplateDict = our_create_template_dict

        self.creator.createStep1()

        vm = self.creator.runner
        return vm
    def startImage(self, user_info, image_info):
        
        self._prepareMachineForBuildImage()
        
        self.slConfigHolder.set('marketplaceEndpoint',
                                user_info.get_cloud('marketplace.endpoint'))
        
        manifestDownloader = ManifestDownloader(self.slConfigHolder)

        imageId = self.getImageId(image_info)
        image_info['imageVersion'] = manifestDownloader.getImageVersion(imageId=imageId)
        
        self._updateStratuslabConfigHolderForBuildImage(user_info, image_info)
        
        self.creator = Creator(imageId, self.slConfigHolder)
        self.creator.setListener(self.listener)

        createImageTemplateDict = self.creator._getCreateImageTemplateDict()
        msgData = StratuslabClientCloud._getCreateImageTemplateMessaging(image_info,
                                                      self._getCloudInstanceName())

        def ourCreateTemplateDict():
            createImageTemplateDict.update(msgData)
            return createImageTemplateDict

        self.creator._getCreateImageTemplateDict = ourCreateTemplateDict
        
        self.creator.createStep1()
        
        self.addVm(NodeDecorator.MACHINE_NAME, self.creator.runner)
        
        return self.getVmsDetails()