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())); } } }
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 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; }
entity.setId(GuidUtils.asGuid(model.getId())); if (model.isSetName()) { entity.setName(model.getName());
to.setMemory(from.getMemory()); if (from.isSetName()) { to.setName(from.getName());