private void updateIdForSingleHost(Host host, Set<Guid> guidsSet) { if (host.isSetName() && !host.isSetId()){ // find the corresponding host id Guid hostGuid = getHostId(host); if (hostGuid != null) { guidsSet.add(hostGuid); // add hostId element to host host.setId(hostGuid.toString()); } } else if (host.isSetId()){ guidsSet.add(Guid.createGuidFromString(host.getId())); } } }
protected Guid getHostId(Host host) { return host.isSetId() ? asGuid(host.getId()) : getEntity(VDS.class, QueryType.GetVdsByName, new NameQueryParameters(host.getName()), host.getName()).getId(); }
private Guid getHostId(Host host) { // presence of host ID or name already validated return host.isSetId() ? new Guid(host.getId()) : host.isSetName() ? getEntity(VdsStatic.class, QueryType.GetVdsStaticByName, new NameQueryParameters(host.getName()), "Hosts: name=" + host.getName()).getId() : null; } }
private Response performCreate(ImageTransfer imageTransfer, TransferDiskImageParameters params) { updateTransferType(imageTransfer, params); if (imageTransfer.isSetHost() && imageTransfer.getHost().isSetId()) { params.setVdsId(Guid.createGuidFromString(imageTransfer.getHost().getId())); } if (imageTransfer.isSetInactivityTimeout()) { params.setClientInactivityTimeout(imageTransfer.getInactivityTimeout()); } return performCreate(ActionType.TransferDiskImage, params, new QueryIdResolver<Guid>(QueryType.GetImageTransferById, IdQueryParameters.class)); }
private Guid getHostId(StorageDomain storageDomain) { // presence of host ID or name already validated return storageDomain.getHost().isSetId() ? new Guid(storageDomain.getHost().getId()) : storageDomain.getHost().isSetName() ? getEntity(VdsStatic.class, QueryType.GetVdsStaticByName, new NameQueryParameters(storageDomain.getHost().getName()), "Hosts: name=" + storageDomain.getHost().getName()).getId() : null; }
private Guid getProxyHostId(ExternalVmImport vmImport) { if (vmImport.isSetHost()) { if (vmImport.getHost().isSetId()) { return asGuid(vmImport.getHost().getId()); } else if (vmImport.getHost().isSetName()) { String hostName = vmImport.getHost().getName(); VDS vds = getEntity(VDS.class, QueryType.GetVdsByName, new NameQueryParameters(vmImport.getHost().getName()), hostName, true); return vds.getId(); } } return null; }
@Mapping(from = ImageTransfer.class, to = org.ovirt.engine.core.common.businessentities.storage.ImageTransfer.class) public static org.ovirt.engine.core.common.businessentities.storage.ImageTransfer map(ImageTransfer model, org.ovirt.engine.core.common.businessentities.storage.ImageTransfer template) { org.ovirt.engine.core.common.businessentities.storage.ImageTransfer entity = template != null ? template : new org.ovirt.engine.core.common.businessentities.storage.ImageTransfer(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId())); } if (model.isSetHost() && model.getHost().isSetId()) { entity.setVdsId(GuidUtils.asGuid(model.getHost().getId())); } if (model.isSetImage() && model.getImage().isSetId()) { entity.setDiskId(GuidUtils.asGuid(model.getImage().getId())); } return entity; }
@Mapping(from = StorageConnectionExtension.class, to = org.ovirt.engine.core.common.businessentities.storage.StorageServerConnectionExtension.class) public static StorageServerConnectionExtension map(StorageConnectionExtension restConnectionModel, StorageServerConnectionExtension template) { StorageServerConnectionExtension engineConnectionExt = template != null ? template : new StorageServerConnectionExtension(); if (restConnectionModel.isSetId()) { engineConnectionExt.setId(new Guid(restConnectionModel.getId())); } if (restConnectionModel.isSetHost() && restConnectionModel.getHost().isSetId()) { engineConnectionExt.setHostId(new Guid(restConnectionModel.getHost().getId())); } if (restConnectionModel.isSetTarget()) { engineConnectionExt.setIqn(restConnectionModel.getTarget()); } if (restConnectionModel.isSetUsername()) { engineConnectionExt.setUserName(restConnectionModel.getUsername()); } if (restConnectionModel.isSetPassword()) { engineConnectionExt.setPassword(restConnectionModel.getPassword()); } return engineConnectionExt; }
@Mapping(from = Permission.class, to = VdcObjectType.class) public static VdcObjectType map(Permission p, VdcObjectType template) { return p.isSetDataCenter() && p.getDataCenter().isSetId() ? VdcObjectType.StoragePool : p.isSetCluster() && p.getCluster().isSetId() ? VdcObjectType.Cluster : p.isSetHost() && p.getHost().isSetId() ? VdcObjectType.VDS : p.isSetStorageDomain() && p.getStorageDomain().isSetId() ? VdcObjectType.Storage : p.isSetVm() && p.getVm().isSetId() ? VdcObjectType.VM : p.isSetVmPool() && p.getVmPool().isSetId() ? VdcObjectType.VmPool : p.isSetTemplate() && p.getTemplate().isSetId() ? VdcObjectType.VmTemplate : template; }
if (event.isSetHost() && event.getHost().isSetId()) { Guid guid = GuidUtils.asGuid(event.getHost().getId()); if (!Guid.isNullOrEmpty(guid)) {
@Mapping(from = Host.class, to = VdsStatic.class) public static VdsStatic map(Host model, VdsStatic template) { VdsStatic entity = template != null ? template : new VdsStatic(); if (model.isSetId()) { entity.setId(GuidUtils.asGuid(model.getId()));
@Mapping(from = Permission.class, to = Guid.class) public static Guid map(Permission p, Guid template) { return p.isSetDataCenter() && p.getDataCenter().isSetId() ? GuidUtils.asGuid(p.getDataCenter().getId()) : p.isSetCluster() && p.getCluster().isSetId() ? GuidUtils.asGuid(p.getCluster().getId()) : p.isSetHost() && p.getHost().isSetId() ? GuidUtils.asGuid(p.getHost().getId()) : p.isSetStorageDomain() && p.getStorageDomain().isSetId() ? GuidUtils.asGuid(p.getStorageDomain().getId()) : p.isSetVm() && p.getVm().isSetId() ? GuidUtils.asGuid(p.getVm().getId()) : p.isSetVmPool() && p.getVmPool().isSetId() ? GuidUtils.asGuid(p.getVmPool().getId()) : p.isSetTemplate() && p.getTemplate().isSetId() ? GuidUtils.asGuid(p.getTemplate().getId()) : template; }
entity.setId(GuidUtils.asGuid(model.getId())); if (model.isSetHost() && model.getHost().isSetId()) { entity.setHostId(new Guid(model.getHost().getId()));
for (Host currHost : model.getPlacementPolicy().getHosts().getHosts()) { Guid hostGuid; if (currHost.isSetId()) { hostGuid = Guid.createGuidFromString(currHost.getId()); } else {
to.setHostedEngine(adaptOut(from.getHostedEngine())); if (from.isSetId()) { to.setId(from.getId());