try { volumeFound = (this.novaClient.volumes().show(volumeIdToAttach).execute() != null); } catch(Throwable t) { volumeFound = false; Volumes volumes = this.novaClient.volumes().list(false).execute(); for(Volume volume : volumes) { if(volume.getName().equals(volumeName)) { volumeForCreate.setSize( Integer.valueOf( size )); volumeIdToAttach = this.novaClient.volumes().create(volumeForCreate).execute().getId();
public Nova(String endpoint, OpenStackClientConnector connector) { super(endpoint, connector); EXTENSIONS = new ExtensionsResource(this); SERVERS = new ServersResource(this); IMAGES = new ImagesResource(this); FLAVORS = new FlavorsResource(this); KEY_PAIRS = new KeyPairsExtension(this); FLOATING_IPS = new FloatingIpsExtension(this); SECURITY_GROUPS = new SecurityGroupsExtension(this); SNAPSHOTS = new SnapshotsExtension(this); VOLUMES = new VolumesExtension(this); AGGREGATES = new AggregatesExtension(this); QUOTA_SETS = new QuotaSetsResource(this); HOSTS = new HostsExtension(this); SERVICES = new ServicesResource(this); HYPERVISORS = new HypervisorsResource(this); }
/** * Retrieves the list of volumes defined for this service. * * @return The list of volumes for this tenant, if any. The list may be empty if there are no volumes defined. * @see com.att.cdp.zones.VolumeService#getVolumes() */ @Override public List<Volume> getVolumes() throws ZoneException { connect(); Context context = getContext(); trackRequest(); RequestState.put(RequestState.SERVICE, "Compute"); RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint()); ArrayList<Volume> list = new ArrayList<>(); try { com.woorea.openstack.nova.model.Volumes volumes = nova.getClient().volumes().list(true).execute(); for (com.woorea.openstack.nova.model.Volume volume : volumes) { list.add(new OpenStackVolume(context, volume)); } } catch (OpenStackBaseException ex) { ExceptionMapper.mapException(ex); } return list; }
new OpenStackVolume(context, nova.getClient().volumes().create(newVolume).execute()); return volume; } catch (OpenStackBaseException ex) {
com.woorea.openstack.nova.model.Volume volume = nova.getClient().volumes().show(id).execute(); if (volume == null) { throw new ResourceNotFoundException(EELFResourceManager.format(OSMsg.PAL_OS_RESOURCE_NOT_FOUND, "Volume", id,
/** * This method can be called to destroy a volume. * * @param id * The id of the volume to be destroyed. * @throws ZoneException * - If the volume cannot be destroyed. * @see com.att.cdp.zones.VolumeService#destroyVolume(java.lang.String) */ @SuppressWarnings("nls") @Override public void destroyVolume(String id) throws ZoneException { checkArg(id, "id"); connect(); Context context = getContext(); trackRequest(); RequestState.put(RequestState.VOLUME, id); RequestState.put(RequestState.SERVICE, "Compute"); RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint()); try { nova.getClient().volumes().delete(id).execute(); } catch (OpenStackBaseException ex) { ExceptionMapper.mapException(ex); } }
public Nova(String endpoint, OpenStackClientConnector connector) { super(endpoint, connector); EXTENSIONS = new ExtensionsResource(this); SERVERS = new ServersResource(this); IMAGES = new ImagesResource(this); FLAVORS = new FlavorsResource(this); KEY_PAIRS = new KeyPairsExtension(this); FLOATING_IPS = new FloatingIpsExtension(this); SECURITY_GROUPS = new SecurityGroupsExtension(this); SNAPSHOTS = new SnapshotsExtension(this); VOLUMES = new VolumesExtension(this); AGGREGATES = new AggregatesExtension(this); QUOTA_SETS = new QuotaSetsResource(this); HOSTS = new HostsExtension(this); SERVICES = new ServicesResource(this); HYPERVISORS = new HypervisorsResource(this); NETWORKS = new NetworksExtension(this); }
com.woorea.openstack.nova.model.Volumes volumes = nova.getClient().volumes().list(true).execute(); for (com.woorea.openstack.nova.model.Volume volume : volumes) { if (name != null) {