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; }
public static void validateRefreshLun(Action action) { if (action == null) { throw new ValidationException("Action is mandatory but was not provided."); } if ( (action.getHost()==null || action.getHost().getId()==null) && (action.getHost()==null || action.getHost().getName()==null) ) { throw new ValidationException("Parameters 'host.id' or 'host.name' are mandatory but both were not provided."); } }
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; }
public static Method getExportSignature(Action action) throws NoSuchMethodException, SecurityException { if (action == null) { throw new ValidationException("Action is mandatory but was not provided."); } /** * to_path_on_host */ if (action!=null && (action.getHost()!=null && action.getHost().getId()!=null || action.getHost()!=null && action.getHost().getName()!=null) && action.getDirectory()!=null ) { return TemplateResource.class.getMethod("exportToPathOnHost", Action.class); } /** * to_export_domain */ if (action!=null && (action.getStorageDomain()!=null && action.getStorageDomain().getId()!=null || action.getStorageDomain()!=null && action.getStorageDomain().getName()!=null) ) { return TemplateResource.class.getMethod("exportToExportDomain", Action.class); } throw new ValidationException("No matching signature found, make sure that mandatory attributes are provided."); }
public static Method getExportSignature(Action action) throws NoSuchMethodException, SecurityException { if (action == null) { throw new ValidationException("Action is mandatory but was not provided."); } /** * to_path_on_host */ if (action!=null && (action.getHost()!=null && action.getHost().getId()!=null || action.getHost()!=null && action.getHost().getName()!=null) && action.getDirectory()!=null ) { return VmResource.class.getMethod("exportToPathOnHost", Action.class); } /** * to_export_domain */ if (action!=null && (action.getStorageDomain()!=null && action.getStorageDomain().getId()!=null || action.getStorageDomain()!=null && action.getStorageDomain().getName()!=null) ) { return VmResource.class.getMethod("exportToExportDomain", Action.class); } throw new ValidationException("No matching signature found, make sure that mandatory attributes are provided."); }
public static Method getAddSignature(Host host) throws NoSuchMethodException, SecurityException { if (host == null) { throw new ValidationException("Parameter 'host' is mandatory but was not provided."); } if (host.getAddress()==null) { throw new ValidationException("Parameter 'host.address' is mandatory but was not provided."); } if (host.getName()==null) { throw new ValidationException("Parameter 'host.name' is mandatory but was not provided."); } if ( (host.getCluster()==null || host.getCluster().getId()==null) && (host.getCluster()==null || host.getCluster().getName()==null) ) { throw new ValidationException("Parameters 'host.cluster.id' or 'host.cluster.name' are mandatory but both were not provided."); } /** * using_root_password */ if (host!=null && host.getRootPassword()!=null ) { return HostsResource.class.getMethod("addUsingRootPassword", Host.class); } throw new ValidationException("No matching signature found, make sure that mandatory attributes are provided."); }
static void verifyModelSpecific(Host model, int index) { assertEquals(GUIDS[index].toString(), model.getId()); assertEquals(NAMES[index], model.getName()); assertEquals(ADDRESSES[index], model.getAddress()); assertEquals(HOST_STATUS[index], model.getStatus()); } }
if ( (storageDomain.getHost()==null || storageDomain.getHost().getId()==null) && (storageDomain.getHost()==null || storageDomain.getHost().getName()==null) ) { throw new ValidationException("Parameters 'storage_domain.host.id' or 'storage_domain.host.name' are mandatory but both were not provided.");
@Override protected void verify(Host model, Host transform) { assertNotNull(transform); assertEquals(model.getName(), transform.getName()); assertEquals(model.getComment(), transform.getComment()); assertEquals(model.getId(), transform.getId()); assertNotNull(transform.getCluster()); assertEquals(model.getCluster().getId(), transform.getCluster().getId()); assertEquals(model.getAddress(), transform.getAddress()); assertEquals(model.getPort(), transform.getPort()); assertEquals(model.getSpm().getPriority(), transform.getSpm().getPriority()); assertEquals(model.getDisplay().getAddress(), transform.getDisplay().getAddress()); }
entity.setName(model.getName());
to.setName(from.getName());