Source:
public Response add(StorageDomain storageDomain) { validateParameters(storageDomain, "host.id|name", "type", "storage"); Storage storageConnectionFromUser = storageDomain.getStorage(); validateEnums(StorageDomain.class, storageDomain); Guid hostId = getHostId(storageDomain); StorageServerConnections cnx = null; if (StringUtils.isEmpty(storageConnectionFromUser.getId()) ) { validateParameters(storageDomain, "storage.type"); cnx = mapToCnx(storageDomain); if(cnx.getstorage_type().isFileDomain()) { validateParameters(storageConnectionFromUser, "path"); } } else { cnx = getStorageServerConnection(storageConnectionFromUser.getId()); storageDomain.getStorage().setType(cnx.getstorage_type().toString()); } StorageDomainStatic entity = mapToStatic(storageDomain); Response resp = null; switch (entity.getStorageType()) { case ISCSI: case FCP: resp = addSAN(storageDomain, entity.getStorageType(), entity, hostId); break; case NFS: if (StringUtils.isEmpty(storageConnectionFromUser.getId()) ) { validateParameters(storageDomain.getStorage(), "address"); } resp = addDomain(VdcActionType.AddNFSStorageDomain, storageDomain, entity, hostId, cnx); break; case LOCALFS: resp = addDomain(VdcActionType.AddLocalStorageDomain, storageDomain, entity, hostId, cnx); break; case POSIXFS: if (StringUtils.isEmpty(storageConnectionFromUser.getId())) { validateParameters(storageDomain.getStorage(), "vfsType"); } resp = addDomain(VdcActionType.AddPosixFsStorageDomain, storageDomain, entity, hostId, cnx); break; case GLUSTERFS: if (StringUtils.isEmpty(storageConnectionFromUser.getId())) { validateParameters(storageDomain.getStorage(), "vfsType"); } resp = addDomain(VdcActionType.AddGlusterFsStorageDomain, storageDomain, entity, hostId, cnx); break; default: break; } if (resp != null) { addLinks(((StorageDomain) resp.getEntity()), getLinksToExclude(storageDomain)); } return resp; }

Target:
public Response add(StorageDomain storageDomain) { validateParameters(storageDomain, "host.id|name", "type", "storage"); Storage storageConnectionFromUser = storageDomain.getStorage(); validateEnums(StorageDomain.class, storageDomain); Guid hostId = getHostId(storageDomain); StorageServerConnections cnx = null; if (!storageConnectionFromUser.isSetId()) { validateParameters(storageDomain, "storage.type"); cnx = mapToCnx(storageDomain); if(cnx.getstorage_type().isFileDomain()) { validateParameters(storageConnectionFromUser, "path"); } } else { cnx = getStorageServerConnection(storageConnectionFromUser.getId()); storageDomain.getStorage().setType(mapType(cnx.getstorage_type())); } StorageDomainStatic entity = mapToStatic(storageDomain); Response resp = null; switch (entity.getStorageType()) { case ISCSI: case FCP: resp = addSAN(storageDomain, entity.getStorageType(), entity, hostId); break; case NFS: if (!storageConnectionFromUser.isSetId()) { validateParameters(storageDomain.getStorage(), "address"); } resp = addDomain(VdcActionType.AddNFSStorageDomain, storageDomain, entity, hostId, cnx); break; case LOCALFS: resp = addDomain(VdcActionType.AddLocalStorageDomain, storageDomain, entity, hostId, cnx); break; case POSIXFS: if (!storageConnectionFromUser.isSetId()) { validateParameters(storageDomain.getStorage(), "vfsType"); } resp = addDomain(VdcActionType.AddPosixFsStorageDomain, storageDomain, entity, hostId, cnx); break; case GLUSTERFS: if (!storageConnectionFromUser.isSetId()) { validateParameters(storageDomain.getStorage(), "vfsType"); } resp = addDomain(VdcActionType.AddGlusterFsStorageDomain, storageDomain, entity, hostId, cnx); break; default: break; } if (resp != null) { addLinks(((StorageDomain) resp.getEntity()), getLinksToExclude(storageDomain)); } return resp; }