Bug 1618517 - unable to add disk to vm via rest-api vm reconfiguration on vmware [request backport from existing commit]
Summary: unable to add disk to vm via rest-api vm reconfiguration on vmware [request b...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: 5.8.2
Hardware: x86_64
OS: Linux
high
low
Target Milestone: GA
: 5.10.0
Assignee: Gregg Tanzillo
QA Contact: Parthvi Vala
URL:
Whiteboard:
Depends On:
Blocks: 1623573 1623574
TreeView+ depends on / blocked
 
Reported: 2018-08-16 20:13 UTC by Reartes Guillermo
Modified: 2019-02-12 16:49 UTC (History)
5 users (show)

Fixed In Version: 5.10.0.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1623573 1623574 (view as bug list)
Environment:
Last Closed: 2019-02-12 16:49:52 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:


Attachments (Terms of Use)

Description Reartes Guillermo 2018-08-16 20:13:22 UTC
Description of problem:

I cannot reconfigure vm via rest-api to vmware, i am getting:

"Error: add_disk_config_spec: Disk size is required to add a new disk."

Searching for the error i found this commit:

COMMIT: https://github.com/ManageIQ/manageiq-api/pull/312

This commit says it is related to the issue.
Please check if a backport is needed.

Version-Release number of selected component (if applicable):
* CFME 5.8.2.3
* vCenter 6.5


How reproducible:
always

Steps to Reproduce:
1. execute a rest-api to reconfigure vm
2. it will fail on vmware

Actual results:
the request ends in error:
"Error: add_disk_config_spec: Disk size is required to add a new disk."


Expected results:
The request should end ok.

Additional info 1:

Example JSON:

json_data_disk = {
            "action"  =>"create",
            "options" => {
                        "src_ids" => [
                                        "#{current_vm_id}"
                                    ],
                        "request_type" => "vm_reconfigure",
                        "disk_add" => [
                                        {
                                        :disk_size_in_mb   => 20480,
                                        #:disk_size         => 20480,
                                        :sync              => true,
                                        #:disk_name         => "new_disk4",
                                        :datastore         => "XXX_LUN_NAME",
                                        :persistent        => true,
                                        :thin_provisioned  => false,
                                        :dependent         => true,
                                        :bootable          => false
                                        }
                                        ]
                        },
            "auto_approve" => false
        }


Additional info 2:

Fails on CFME 5.8.2.3. (vCenter 6.5)

Additional info 3:

On RHV 4.1 (my lab) (CFME 5.8.4.5) it does work and adds the disk. It still does not honor the selected datastore, but that is another separate issue.


Additional info 4:

I could not test this with CF 4.6.x on VMWare.

It a backport is needed for 4.5, maybe it is needed for 4.6 too.

Thanks in advance.

Comment 4 Parthvi Vala 2018-11-13 10:16:16 UTC
FIXED. Verified on 5.10.0.23.20181106165157_92dd189 with vmware (vCenter 6.7).

POST /api/requests
{
    "action": "create",
    "options": {
        "src_ids": ["92"],
        "request_type": "vm_reconfigure",
        "disk_add": [
            {
                "disk_size_in_mb": 20480,
                "sync": true,
                "datastore": "NFS_Datastore_1",
                "persistent": true,
                "thin_provisioned": false,
                "dependent": true,
                "bootable": false
            }
        ]
    },
    "auto_approve": false
}


GET /api/requests/:id

{
	"href": "https://<ip_address>/api/requests/:id",
	"id": "3",
	"description": "VM Reconfigure for: pvala_vm_001 - Add Disks: 1",
	"approval_state": "approved",
	"type": "VmReconfigureRequest",
	"created_on": "2018-11-13T10:00:35Z",
	"updated_on": "2018-11-13T10:05:17Z",
	"fulfilled_on": "2018-11-13T10:05:17Z",
	"requester_id": "1",
	"requester_name": "Administrator",
	"request_type": "vm_reconfigure",
	"request_state": "finished",
	"message": "VM Reconfigure complete",
	"status": "Ok",
	"options": {
		"src_ids": [
			"92"
		],
		"request_type": "vm_reconfigure",
		"disk_add": [
			{
				"disk_size_in_mb": 20480,
				"sync": true,
				"disk_name": "New Disk",
				"datastore": "NFS_Datastore_1",
				"persistent": true,
				"thin_provisioned": false,
				"dependent": true,
				"bootable": false
			}
		],
		"executed_on_servers": [
			1,
			1
		],
		"delivered_on": "2018-11-13T10:00:48.109Z"
	},
	"userid": "admin",
	"source_id": null,
	"source_type": null,
	"destination_id": null,
	"destination_type": null,
	"tenant_id": "1",
	"service_order_id": null,
	"process": true,
	"cancelation_status": null,
	"actions": [
        ...
	]
}


Note You need to log in before you can comment on or make changes to this bug.