Bug 1095682
| Summary: | [RFE] Allow to specify storage domain with "id" or "name" when adding a disk to a VM | ||
|---|---|---|---|
| Product: | [oVirt] ovirt-engine | Reporter: | Sven Kieske <s.kieske> |
| Component: | RestAPI | Assignee: | Tal Nisan <tnisan> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Avihai <aefrat> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | --- | CC: | bugs, dfediuck, sbonazzo, s.kieske, srevivo, tnisan |
| Target Milestone: | ovirt-4.3.0 | Keywords: | FutureFeature, Improvement, Reopened |
| Target Release: | --- | Flags: | rule-engine:
ovirt-4.3?
rule-engine: planning_ack? rule-engine: devel_ack+ rule-engine: testing_ack+ |
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Enhancement | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2019-02-13 07:43:28 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | Storage | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Note that this inconsistency isn't specific to the JSON representation, the same applies to XML. This is an automated message. This Bugzilla report has been opened on a version which is not maintained anymore. Please check if this bug is still relevant in oVirt 3.5.4. If it's not relevant anymore, please close it (you may use EOL or CURRENT RELEASE resolution) If it's an RFE please update the version to 4.0 if still relevant. This is an automated message. This Bugzilla report has been opened on a version which is not maintained anymore. Please check if this bug is still relevant in oVirt 3.5.4 and reopen if still an issue. This is an RFE, thus it was never implemented, and still applies to latest master branch. You should not automatically close RFEs, but retarget them to the last release. Thanks Sven Closing old bugs for capacity. If needed please reopen and explain why. Patches are welcomed. ok, let me try to explain: afaik this blocks using the same storage domain name for different storage domains (which is an actual use case I had/have), e.g. export domains for vm backups are conveniently called "vmbackup", yet you can just have one with this name, when you want to use the API, because you need to distinguish the domains by name. yet each domain has a unique ID, but it doesn't get used, so I honestly do not understand the design decision leading to this. I hope I could make the use case more clear? if you have any questions left, feel free to ask. if you have no question, but feel this can't/will not be implemented, feel free to close it again. kind regards Sven Hi, The storage domain name/ID is taken from the Disk model in BackendDiskAttachmentsResource::getStorageDomainId. I didn't check when it was changed, but today you cannot send a single storage domain object when using the API, but rather only a list of storage domains. It takes the first domain from that list (and ignores all the rest), and extracts the domain's ID out of it. If the domain's ID is passed, it uses it, and if the domain's name is passed - it uses a query to retrieve the ID from the DB. Here's an example for each option: POST ovirt-engine/api/vms/<vm_id>/diskattachments First option - use the domain's ID: <disk_attachment> <bootable>false</bootable> <pass_discard>false</pass_discard> <interface>virtio_scsi</interface> <active>true</active> <disk> <provisioned_size>1073741824</provisioned_size> <format>raw</format> <storage_domains> <storage_domain id="<domain_id>"/> </storage_domains> </disk> </disk_attachment> Second option - use the domain's name: <disk_attachment> <bootable>false</bootable> <pass_discard>false</pass_discard> <interface>virtio_scsi</interface> <active>true</active> <disk> <provisioned_size>1073741824</provisioned_size> <format>raw</format> <storage_domains> <storage_domain> <name><domain_name></name> </storage_domain> </storage_domains> </disk> </disk_attachment> So this RFE actually already exists - you can specify the domain by its name or ID. This request has been proposed for two releases. This is invalid flag usage. The ovirt-future release flag has been cleared. If you wish to change the release flag, you must clear one release flag and then set the other release flag to ?. Verified on 4.3.0.2-0.1.el7. Used Idan's RESTAPI requests from comment#9 to verify. This bugzilla is included in oVirt 4.3.0 release, published on February 4th 2019. Since the problem described in this bug report should be resolved in oVirt 4.3.0 release, it has been closed with a resolution of CURRENT RELEASE. If the solution does not work for you, please open a new bug report. |
Description of problem: When adding a disk to a VM both a single domain storage and a list of storage domains are accepted. The JSON representation is the following: "storage_domain": { "id": "6fbee79d-5b71-48c1-b86c-ee9755a46013" } Note that "name" isn't accepted here, you have to use the "id". The JSON representation for multiple domains is the following (note that only the first one is used): "storage_domains": { "storage_domain": [ { "name": "am_data" } ] } Note that "id" isn't accepted here, you have to use "name". Version-Release number of selected component (if applicable): current master How reproducible: always Steps to Reproduce: 1. 2. 3. Actual results: inconsistent use of "id" and "name" Expected results: allow the use of "id" and "name" Additional info: no matter what the result is, it should be consistent I created this RFE as requested on the users ML at: http://lists.ovirt.org/pipermail/users/2014-May/024076.html