Receives ovf image parameters and deploy it on the designated vcenter
        :param VMwarevCenterResourceModel vcenter_data_model:
        :type image_params: vCenterShell.vm.ovf_image_params.OvfImageParams
        :param logger:
350682
def deploy_image(self, vcenter_data_model, image_params, logger):
        
        ovf_tool_exe_path = vcenter_data_model.ovf_tool_path

        self._validate_url_exists(ovf_tool_exe_path, 'OVF Tool', logger)

        args = self._get_args(ovf_tool_exe_path, image_params, logger)
        logger.debug('opening ovf tool process with the params: {0}'.format(','.join(args)))
        process = subprocess.Popen(args, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)

        logger.debug('communicating with ovf tool')
        result = process.communicate()
        process.stdin.close()

        if result:
            res = '\n\r'.join(result)
        else:
            if image_params.user_arguments.find('--quiet') == -1:
                raise Exception('no result has return from the ovftool')
            res = COMPLETED_SUCCESSFULLY

        logger.info('communication with ovf tool results: {0}'.format(res))
        if res.find(COMPLETED_SUCCESSFULLY) > -1:
            return True

        image_params.connectivity.password = '******'
        args_for_error = ' '.join(self._get_args(ovf_tool_exe_path, image_params, logger))
        logger.error('error deploying image with the args: {0}, error: {1}'.format(args_for_error, res))
        raise Exception('error deploying image with the args: {0}, error: {1}'.format(args_for_error, res))
1235790
function (param, options, callback) {
              embedProcessor.log(param.worker + ' started with parameters = ', param);
              param.status = true;
              param.duration = false;
              param.duration_formatted = false;
              param.thumbnail_url = false;
              param.favicon_url = '';
              param.service_name = '';
              param.provider_url = '';
              param.html = false;
              param.views = false;
              if (embedProcessor._sources[param.source] && embedProcessor._sources[param.source].prepareEmbedCode) {
                param = embedProcessor._sources[param.source].prepareEmbedCode(param);
              }
              param = embedProcessor._paramEmbedCodeNormalizer(param);
              embedProcessor.log(param.worker + ' receive parameters = ', param);
              callback(param);
            }
1184694
protected function setImageinfoParams()
    {
        $this->logger->debug('Base:setImageinfoParams');
        $this->setParam('prop', 'imageinfo');
        $this->setParam('iiprop', 'url|size|mime|thumbmime|user|userid|sha1|timestamp|extmetadata');
        $this->setParam('iiextmetadatafilter', 'LicenseShortName|UsageTerms|AttributionRequired|'
                        .'Restrictions|Artist|ImageDescription|DateTimeOriginal');
        $this->setParam('iiurlwidth', $this->thumbnailWidth);
    }
107814
public static List<Object> processParameters(OperationResourceInfo ori,
                                                 MultivaluedMap<String, String> values,
                                                 Message message)
        throws IOException, WebApplicationException {

        Class<?>[] parameterTypes = ori.getInParameterTypes();
        List<Parameter> paramsInfo = ori.getParameters();
        boolean preferModelParams = paramsInfo.size() > parameterTypes.length
                                    && !PropertyUtils.isTrue(message.getContextualProperty("org.apache.cxf.preferMethodParameters"));

        int parameterTypesLengh = preferModelParams ? paramsInfo.size() : parameterTypes.length;

        Type[] genericParameterTypes = ori.getInGenericParameterTypes();
        Annotation[][] anns = ori.getInParameterAnnotations();
        List<Object> params = new ArrayList<Object>(parameterTypesLengh);

        for (int i = 0; i < parameterTypesLengh; i++) {
            Class<?> param = null;
            Type genericParam = null;
            Annotation[] paramAnns = null;
            if (!preferModelParams) {
                param = parameterTypes[i];
                genericParam = InjectionUtils.processGenericTypeIfNeeded(
                                                                         ori.getClassResourceInfo().getServiceClass(), param, genericParameterTypes[i]);
                param = InjectionUtils.updateParamClassToTypeIfNeeded(param, genericParam);
                paramAnns = anns == null ? EMPTY_ANNOTATIONS : anns[i];
            } else {
                param = paramsInfo.get(i).getJavaType();
                genericParam = param;
                paramAnns = EMPTY_ANNOTATIONS;
            }

            Object paramValue = processParameter(param,
                                                 genericParam,
                                                 paramAnns,
                                                 paramsInfo.get(i),
                                                 values,
                                                 message,
                                                 ori);
            params.add(paramValue);
        }

        return params;
    }
1032290
def create_resource_model_instance(resource_instance):
        
        resource_model = ResourceModelParser.get_resource_model(resource_instance)
        resource_class_name = ResourceModelParser.get_resource_model_class_name(
            resource_model)
        # print 'Family name is ' + resource_class_name
        instance = ResourceModelParser.get_class('cloudshell.cp.vcenter.models.' + resource_class_name)
        return instance
956378
function (oViewClass) {
						var mViewParameters = {
							id: id ? getId(oView, node, id) : undefined,
							xmlNode: node,
							containingView: oView._oContainingView,
							processingMode: oView._sProcessingMode // add processing mode, so it can be propagated to subviews inside the HTML block
						};
						// running with owner component
						if (oView.fnScopedRunWithOwner) {
							return oView.fnScopedRunWithOwner(function () {
								return new oViewClass(mViewParameters);
							});
						}
						// no owner component
						// (or fully sync path, which handles the owner propagation on a higher level)
						return new oViewClass(mViewParameters);
					}
2423
@Override
    public MachineImage capture(@Nonnull ImageCreateOptions options, @Nullable AsynchronousTask<MachineImage> task) throws CloudException, InternalException {
        Compute gce = provider.getGoogleCompute();
        ServerSupport server = new ServerSupport(provider);
        Image imageContent = new Image();

        try {
            VirtualMachine vm = server.getVirtualMachine(options.getVirtualMachineId());

            String[] disks = vm.getProviderVolumeIds(provider);
            server.terminateVm(options.getVirtualMachineId());

            Disk disk = gce.disks().get(provider.getContext().getAccountNumber(), vm.getProviderDataCenterId(), disks[0]).execute(); 
            imageContent.setName(getCapabilities().getImageNamingConstraints().convertToValidName(options.getName(), Locale.US));
            imageContent.setKind("compute#disk");
            imageContent.setSourceDisk(disk.getSelfLink());

            String derivedFrom = disk.getSourceImage().replaceAll(".*/", "");
            if (Platform.guess(derivedFrom) == Platform.UNKNOWN) {
                Boolean done = false;
                try {
                    while (!done) {
                        Image imagePrior = gce.images().get(provider.getContext().getAccountNumber(), derivedFrom).execute();
                        if (imagePrior.getDescription().startsWith("Derived from ")) {
                            derivedFrom = imagePrior.getDescription().replaceAll("Derived from ", "");
                            if (Platform.guess(derivedFrom) != Platform.UNKNOWN) {
                                done = true;
                                imageContent.setDescription(imagePrior.getDescription());
                            }
                        }
                    }
                } catch (Exception e) {
                    imageContent.setDescription(derivedFrom);  // best guess.
                }

            } else {
                imageContent.setDescription("Derived from " + derivedFrom);
            }
            Operation job = gce.images().insert(provider.getContext().getAccountNumber(), imageContent).execute();
            GoogleMethod method = new GoogleMethod(provider);
            method.getOperationComplete(provider.getContext(), job, GoogleOperationType.GLOBAL_OPERATION, "", "");

            String zone = disk.getZone();
            zone = zone.substring(zone.lastIndexOf("/") + 1);
            // now delete source disk...
            job = gce.disks().delete(provider.getContext().getAccountNumber(), zone, disk.getName()).execute();
            method.getOperationComplete(provider.getContext(), job, GoogleOperationType.ZONE_OPERATION, "", zone);
        } catch (Exception ex) {
            logger.error(ex.getMessage()); // CloudException: An error occurred: Invalid value for field 'image.hasRawDisk': 'false'.
            if (ex.getClass() == GoogleJsonResponseException.class) {
                GoogleJsonResponseException gjre = (GoogleJsonResponseException)ex;
                throw new GoogleException(CloudErrorType.GENERAL, gjre.getStatusCode(), gjre.getContent(), gjre.getDetails().getMessage());
            } else
                throw new CloudException("An error occurred while deleting the image: " + ex.getMessage());
        }

        return getImage(provider.getContext().getAccountNumber() + "_" + options.getName());
    }
684491
def transport_param(image):
    
    transports = {SkopeoTransport.CONTAINERS_STORAGE: "containers-storage:",
                  SkopeoTransport.DIRECTORY: "dir:",
                  SkopeoTransport.DOCKER: "docker://",
                  SkopeoTransport.DOCKER_ARCHIVE: "docker-archive",
                  SkopeoTransport.DOCKER_DAEMON: "docker-daemon:",
                  SkopeoTransport.OCI: "oci:",
                  SkopeoTransport.OSTREE: "ostree:"}

    transport = image.transport
    tag = image.tag
    repository = image.name
    path = image.path

    if not transport:
        transport = SkopeoTransport.DOCKER
    command = transports[transport]

    path_required = [SkopeoTransport.DIRECTORY, SkopeoTransport.DOCKER_ARCHIVE, SkopeoTransport.OCI]
    if transport in path_required and path is None:
        raise ValueError(transports[transport] + " path is required to be specified")

    if transport == SkopeoTransport.DIRECTORY:
        return command + path
    if transport == SkopeoTransport.DOCKER_ARCHIVE:
        command += path
        if repository is None:
            return command
        command += ":"
    if transport in [SkopeoTransport.CONTAINERS_STORAGE, SkopeoTransport.DOCKER,
                     SkopeoTransport.DOCKER_ARCHIVE, transport.DOCKER_DAEMON]:
        return command + repository + ":" + tag
    if transport == SkopeoTransport.OCI:
        return command + path + ":" + tag
    if transport == SkopeoTransport.OSTREE:
        return command + repository + ("@" + path if path else "")

    raise ConuException("This transport is not supported")
50640
def guest_deploy(self, userid, image_name, transportfiles=None,
                     remotehost=None, vdev=None):
        
        # (TODO: add the support of multiple disks deploy)
        msg = ('Start to deploy image %(img)s to guest %(vm)s'
                % {'img': image_name, 'vm': userid})
        LOG.info(msg)
        image_file = '/'.join([self._get_image_path_by_name(image_name),
                               CONF.zvm.user_root_vdev])
        # Unpack image file to root disk
        vdev = vdev or CONF.zvm.user_root_vdev
        cmd = ['sudo', '/opt/zthin/bin/unpackdiskimage', userid, vdev,
               image_file]
        with zvmutils.expect_and_reraise_internal_error(modID='guest'):
            (rc, output) = zvmutils.execute(cmd)
        if rc != 0:
            err_msg = ("unpackdiskimage failed with return code: %d." % rc)
            err_output = ""
            output_lines = output.split('\n')
            for line in output_lines:
                if line.__contains__("ERROR:"):
                    err_output += ("\\n" + line.strip())
            LOG.error(err_msg + err_output)
            raise exception.SDKGuestOperationError(rs=3, userid=userid,
                                                   unpack_rc=rc,
                                                   err=err_output)

        # Purge guest reader to clean dirty data
        rd = ("changevm %s purgerdr" % userid)
        action = "purge reader of '%s'" % userid
        with zvmutils.log_and_reraise_smt_request_failed(action):
            self._request(rd)

        # Punch transport files if specified
        if transportfiles:
            # Copy transport file to local
            msg = ('Start to send customized file to vm %s' % userid)
            LOG.info(msg)

            try:
                tmp_trans_dir = tempfile.mkdtemp()
                local_trans = '/'.join([tmp_trans_dir,
                                        os.path.basename(transportfiles)])
                if remotehost:
                    cmd = ["/usr/bin/scp", "-B",
                           "-P", CONF.zvm.remotehost_sshd_port,
                           "-o StrictHostKeyChecking=no",
                           ("%s:%s" % (remotehost, transportfiles)),
                           local_trans]
                else:
                    cmd = ["/usr/bin/cp", transportfiles, local_trans]
                with zvmutils.expect_and_reraise_internal_error(modID='guest'):
                    (rc, output) = zvmutils.execute(cmd)
                if rc != 0:
                    err_msg = ('copy config drive with command %(cmd)s '
                               'failed with output: %(res)s' %
                               {'cmd': str(cmd), 'res': output})
                    LOG.error(err_msg)
                    raise exception.SDKGuestOperationError(rs=4, userid=userid,
                                                           err_info=err_msg)

                # Punch config drive to guest userid
                rd = ("changevm %(uid)s punchfile %(file)s --class X" %
                      {'uid': userid, 'file': local_trans})
                action = "punch config drive to userid '%s'" % userid
                with zvmutils.log_and_reraise_smt_request_failed(action):
                    self._request(rd)
            finally:
                # remove the local temp config drive folder
                self._pathutils.clean_temp_folder(tmp_trans_dir)
        # Authorize iucv client
        self.guest_authorize_iucv_client(userid)
        # Update os version in guest metadata
        # TODO: may should append to old metadata, not replace
        image_info = self._ImageDbOperator.image_query_record(image_name)
        metadata = 'os_version=%s' % image_info[0]['imageosdistro']
        self._GuestDbOperator.update_guest_by_userid(userid, meta=metadata)

        msg = ('Deploy image %(img)s to guest %(vm)s disk %(vdev)s'
               ' successfully' % {'img': image_name, 'vm': userid,
                                  'vdev': vdev})
        LOG.info(msg)
837202
def _build_image_url(self, monitor, mode) -> str:
        """"""
        query = urlencode({
            'mode': mode,
            'buffer': monitor['StreamReplayBuffer'],
            'monitor': monitor['Id'],
        })
        url = '{zms_url}?{query}'.format(
            zms_url=self._client.get_zms_url(), query=query)
        _LOGGER.debug('Monitor %s %s URL (without auth): %s',
                      monitor['Id'], mode, url)
        return self._client.get_url_with_auth(url)
910218
def avail_images(conn=None, call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_images function must be called with '
            '-f or --function, or with the --list-images option'
        )

    if not conn:
        conn = get_conn()

    ret = {}
    for item in conn.list_os_images():
        ret[item.name] = object_to_dict(item)
    for item in conn.list_vm_images():
        ret[item.name] = object_to_dict(item)
    return ret
1340865
def detach_model(vmssvm_model, lun):
    ''''''
    data_disks = vmssvm_model['properties']['storageProfile']['dataDisks']
    data_disks[:] = [disk for disk in data_disks if disk.get('lun') != lun]
    vmssvm_model['properties']['storageProfile']['dataDisks'] = data_disks
    return vmssvm_model
1261027
def get_image(conn, vm_):
    '''
    
    '''
    images = conn.list_images()
    vm_image = config.get_cloud_config_value('image', vm_, __opts__)

    if not six.PY3:
        vm_image = vm_image.encode('ascii', 'salt-cloud-force-ascii')

    for img in images:
        if isinstance(img.id, six.string_types) and not six.PY3:
            img_id = img.id.encode('ascii', 'salt-cloud-force-ascii')
        else:
            img_id = str(img.id)  # future lint: disable=blacklisted-function

        if isinstance(img.name, six.string_types) and not six.PY3:
            img_name = img.name.encode('ascii', 'salt-cloud-force-ascii')
        else:
            img_name = str(img.name)  # future lint: disable=blacklisted-function

        if vm_image and vm_image in (img_id, img_name):
            return img

    raise SaltCloudNotFound(
        'The specified image, \'{0}\', could not be found.'.format(vm_image)
    )
1154756
def fix_virtualbox_ovf(filepath, vmdk_filename="box-disk1.vmdk")
      @logger.info "Generating ovf file for virtual machine"
      @vmdk_filename = vmdk_filename
      vmware_ovf_erb = File.join(File.dirname(__FILE__), "..", "..", "assets", "box.ovf.erb")
      compile_erb(vmware_ovf_erb, filepath)
    end
797659
def _get_base(**kwargs):
    '''
    
    '''
    profile = get_container_profile(copy.deepcopy(kwargs.get('profile')))
    kw_overrides = copy.deepcopy(kwargs)

    def select(key, default=None):
        kw_overrides_match = kw_overrides.pop(key, _marker)
        profile_match = profile.pop(key, default)
        # let kwarg overrides be the preferred choice
        if kw_overrides_match is _marker:
            return profile_match
        return kw_overrides_match

    template = select('template')
    image = select('image')
    vgname = select('vgname')
    path = kwargs.get('path', None)
    # remove the above three variables from kwargs, if they exist, to avoid
    # duplicates if create() is invoked below.
    for param in ('path', 'image', 'vgname', 'template'):
        kwargs.pop(param, None)

    if image:
        proto = _urlparse(image).scheme
        img_tar = __salt__['cp.cache_file'](image)
        img_name = os.path.basename(img_tar)
        hash_ = salt.utils.hashutils.get_hash(
                img_tar,
                __salt__['config.get']('hash_type'))
        name = '__base_{0}_{1}_{2}'.format(proto, img_name, hash_)
        if not exists(name, path=path):
            create(name, template=template, image=image,
                   path=path, vgname=vgname, **kwargs)
            if vgname:
                rootfs = os.path.join('/dev', vgname, name)
                edit_conf(info(name, path=path)['config'],
                          out_format='commented', **{'lxc.rootfs': rootfs})
        return name
    elif template:
        name = '__base_{0}'.format(template)
        if not exists(name, path=path):
            create(name, template=template, image=image, path=path,
                   vgname=vgname, **kwargs)
            if vgname:
                rootfs = os.path.join('/dev', vgname, name)
                edit_conf(info(name, path=path)['config'],
                          out_format='commented', **{'lxc.rootfs': rootfs})
        return name
    return ''
588706
def get_imageid(vm_):
    '''
    
    '''
    image = config.get_cloud_config_value(
        'image', vm_, __opts__, search_global=False
    )
    if image.startswith('ami-'):
        return image
    # a poor man's cache
    if not hasattr(get_imageid, 'images'):
        get_imageid.images = {}
    elif image in get_imageid.images:
        return get_imageid.images[image]
    params = {'Action': 'DescribeImages',
              'Filter.0.Name': 'name',
              'Filter.0.Value.0': image}
    # Query AWS, sort by 'creationDate' and get the last imageId
    _t = lambda x: datetime.datetime.strptime(x['creationDate'], '%Y-%m-%dT%H:%M:%S.%fZ')
    image_id = sorted(aws.query(params, location=get_location(),
                                 provider=get_provider(), opts=__opts__, sigver='4'),
                      lambda i, j: salt.utils.compat.cmp(_t(i), _t(j))
                      )[-1]['imageId']
    get_imageid.images[image] = image_id
    return image_id
208841
public static void installImageUrlHandler(ImageSource urlHandlerImageSource) {
		Assert.notNull(urlHandlerImageSource);

		Handler.urlHandlerImageSource = urlHandlerImageSource;

		try {
			// System properties should be set at JVM startup
			// Testcases in IDEA/Eclipse are at JVM startup, but not in Maven's
			// surefire...
			// TODO this entire implementation should be changed with a
			// java.net.URLStreamHandlerFactory instead.
			String packagePrefixList = System.getProperty("java.protocol.handler.pkgs");
			String newPackagePrefixList = null;
			String orgSpringFrameworkRichclientString = "org.springframework.richclient";
			if (packagePrefixList == null || packagePrefixList.equals("")) {
				newPackagePrefixList = orgSpringFrameworkRichclientString;
			}
			else if (("|" + packagePrefixList + "|").indexOf("|" + orgSpringFrameworkRichclientString + "|") < 0) {
				newPackagePrefixList = packagePrefixList + "|" + orgSpringFrameworkRichclientString;
			}
			if (newPackagePrefixList != null) {
				System.setProperty("java.protocol.handler.pkgs", newPackagePrefixList);
			}
		}
		catch (SecurityException e) {
			logger.warn("Unable to install image URL handler", e);
			Handler.urlHandlerImageSource = null;
		}
	}