services.DisksService Maven / Gradle / Ivy
/*
Copyright (c) 2015-2016 Red Hat, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package services;
import annotations.Area;
import org.ovirt.api.metamodel.annotations.In;
import org.ovirt.api.metamodel.annotations.InputDetail;
import org.ovirt.api.metamodel.annotations.Out;
import org.ovirt.api.metamodel.annotations.Service;
import types.Disk;
import static org.ovirt.api.metamodel.language.ApiLanguage.COLLECTION;
import static org.ovirt.api.metamodel.language.ApiLanguage.mandatory;
import static org.ovirt.api.metamodel.language.ApiLanguage.optional;
/**
* Manages the collection of disks available in the system.
*
* @author Juan Hernandez
* @date 4 Nov 2016
* @status added
*/
@Service
@Area("Storage")
public interface DisksService {
/**
* Adds a new floating disk.
*
* There are three types of disks that can be added - disk image, direct LUN and
* https://wiki.openstack.org/wiki/Cinder[Cinder] disk.
*
* *Adding a new image disk:*
*
* When creating a new floating image <>, the API requires the `storage_domain`, `provisioned_size`
* and `format` attributes.
*
* To create a new floating image disk with specified `provisioned_size`, `format` and `name` on a storage domain
* with an id `123`, send a request as follows:
*
* [source]
* ----
* POST /ovirt-engine/api/disks
* ----
*
* With a request body as follows:
*
* [source,xml]
* ----
*
*
*
*
* mydisk
* 1048576
* cow
*
* ----
*
*
* *Adding a new direct LUN disk:*
*
* When adding a new floating direct LUN via the API, there are two flavors that can be used:
*
* . With a `host` element - in this case, the host is used for sanity checks (e.g., that the LUN is visible) and
* to retrieve basic information about the LUN (e.g., size and serial).
* . Without a `host` element - in this case, the operation is a database-only operation, and the storage is never
* accessed.
*
* To create a new floating direct LUN disk with a `host` element with an id `123`, specified `alias`, `type` and
* `logical_unit` with an id `456` (that has the attributes `address`, `port` and `target`),
* send a request as follows:
*
* [source]
* ----
* POST /ovirt-engine/api/disks
* ----
*
* With a request body as follows:
*
* [source,xml]
* ----
*
* mylun
*
*
* iscsi
*
*
* 10.35.10.20
* 3260
* iqn.2017-01.com.myhost:444
*
*
*
*
* ----
*
* To create a new floating direct LUN disk without using a host, remove the `host` element.
*
*
* *Adding a new Cinder disk:*
*
* To create a new floating Cinder disk, send a request as follows:
*
* [source]
* ----
* POST /ovirt-engine/api/disks
* ----
*
* With a request body as follows:
*
* [source,xml]
* ----
*
*
* myceph
*
*
*
* cinderDomain
*
*
* 1073741824
* virtio
* raw
*
* ----
*
* @author Idan Shaby
* @author Shani Leviim
* @date 11 Jan 2017
* @status added
*/
interface Add {
@InputDetail
default void inputDetail() {
mandatory(disk().format());
mandatory(disk()._interface());
optional(disk().alias());
optional(disk().bootable());
optional(disk().description());
optional(disk().propagateErrors());
optional(disk().quota().id());
optional(disk().shareable());
optional(disk().sparse());
optional(disk().wipeAfterDelete());
}
/**
* Add a new disk to the storage domain with the specified size allocating space from the storage domain.
*
* @author Ori Liel
* @date 18 Jan 2017
* @status added
*/
interface OnStorageDomain extends Add {
@InputDetail
default void inputDetail() {
mandatory(disk().provisionedSize());
optional(disk().diskProfile().id());
optional(disk().name());
optional(disk().openstackVolumeType().name());
// optional(disk().size());
}
}
/**
* Add a new lun disk to the storage domain.
*
* @author Ori Liel
* @date 18 Jan 2017
* @status added
*/
interface Lun extends Add {
@InputDetail
default void inputDetail() {
mandatory(disk().lunStorage().type());
mandatory(disk().lunStorage().logicalUnits()[COLLECTION].address());
mandatory(disk().lunStorage().logicalUnits()[COLLECTION].id());
mandatory(disk().lunStorage().logicalUnits()[COLLECTION].port());
mandatory(disk().lunStorage().logicalUnits()[COLLECTION].target());
optional(disk().sgio());
}
}
/**
* The disk.
*
* @author Aleksei Slaikovskii
* @date 12 Dec 2016
* @status added
*/
@In @Out Disk disk();
}
/**
* Get list of disks.
*
* [source]
* ----
* GET /ovirt-engine/api/disks
* ----
*
* You will get a XML response which will look like this one:
*
* [source,xml]
* ----
*
*
* ...
* MyDisk
* MyDisk description
*
*
* 5345845248
* MyDisk alias
* ...
* ok
* image
* false
*
*
* ...
*
* ...
*
* ----
*
* @author Aleksei Slaikovskii
* @date 12 Dec 2016
* @status added
*/
interface List {
/**
* List of retrieved disks.
*
* @author Aleksei Slaikovskii
* @date 12 Dec 2016
* @status added
*/
@Out Disk[] disks();
/**
* Sets the maximum number of disks to return. If not specified all the disks are returned.
*/
@In Integer max();
/**
* A query string used to restrict the returned disks.
*/
@In String search();
/**
* Indicates if the search performed using the `search` parameter should be performed taking case into
* account. The default value is `true`, which means that case is taken into account. If you want to search
* ignoring case set it to `false`.
*/
@In Boolean caseSensitive();
}
/**
* Reference to a service managing a specific disk.
*
* @author Aleksei Slaikovskii
* @date 12 Dec 2016
* @status added
*/
@Service DiskService disk(String id);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy