Class DisksServiceImpl

    • Method Detail

      • add

        public DisksService.AddRequest add()
        Description copied from 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. Note that block storage domains (i.e., storage domains with the <> of iSCSI or FCP) don't support the combination of the raw `format` with `sparse=true`, so `sparse=false` must be stated explicitly. 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 ---- *Adding a floating disks in order to upload disk snapshots:* Since version 4.2 of the engine it is possible to upload disks with snapshots. This request should be used to create the base image of the images chain (The consecutive disk snapshots (images), should be created using `disk-attachments` element when creating a snapshot). The disk has to be created with the same disk identifier and image identifier of the uploaded image. I.e. the identifiers should be saved as part of the backup process. The image identifier can be also fetched using the `qemu-img info` command. For example, if the disk image is stored into a file named `b7a4c6c5-443b-47c5-967f-6abc79675e8b/myimage.img`: [source,shell] ---- $ qemu-img info b7a4c6c5-443b-47c5-967f-6abc79675e8b/myimage.img image: b548366b-fb51-4b41-97be-733c887fe305 file format: qcow2 virtual size: 1.0G (1073741824 bytes) disk size: 196K cluster_size: 65536 backing file: ad58716a-1fe9-481f-815e-664de1df04eb backing file format: raw ---- To create a disk with with the disk identifier and image identifier obtained with the `qemu-img info` command shown above, send a request like this: [source] ---- POST /ovirt-engine/api/disks ---- With a request body as follows: [source,xml] ---- b548366b-fb51-4b41-97be-733c887fe305 mydisk 1048576 cow ----
        Specified by:
        add in interface DisksService
      • list

        public DisksService.ListRequest list()
        Description copied from interface: DisksService
        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 ... ... ---- The order of the returned list of disks is guaranteed only if the `sortby` clause is included in the `search` parameter.
        Specified by:
        list in interface DisksService
      • service

        public Service service​(String path)
        Description copied from interface: DisksService
        Service locator method, returns individual service on which the URI is dispatched.
        Specified by:
        service in interface DisksService