Error "The operation could not be performed because the device spec is invalid. Invalid operation for device '0'" when importing a VM to VMware Cloud Director from vCenter.
search cancel

Error "The operation could not be performed because the device spec is invalid. Invalid operation for device '0'" when importing a VM to VMware Cloud Director from vCenter.

book

Article ID: 367732

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • Importing a Virtual Machine to VMware Cloud Director fails with an error: "The operation could not be performed because the device spec is invalid. Invalid operation for device '0' "
  • We see "Reconfigure virtual machine" task with error status in vCenter.  Here in "Invalid operation for device '#'", # denotes to the Hard disk. For example, device '0' refers Hard Disk 1 and device '1' refers Hard disk 2.
  • The below log entries are seen in /opt/vmware/cloud-director/logs/vcloud-container-debug.log:

2024-05-15 16:59:08,110 | DEBUG    | task-service-activity-pool-31 | CJob| updateFailedJob(com.vmware.ssdc.library.exceptions.VimInvalidDeviceSpecException) with locale=en_US | requestId=#############,request=POST https://<host-name>/api/admin/extension/vimServer/####/importVmAsVApp,requestTime=1715792304610,remoteAddress=##.##.##.##:52739,userAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ...,accept=application/*+json;version 39.0.0-alpha vcd=####-####-####-####,task=####-###-####-####-####activity=(com.vmware.vcloud.backendbase.management.system.TaskActivity,urn:uuid:####-####-####-####)com.vmware.ssdc.library.exceptions.VimInvalidDeviceSpecException: The operation could not be performed because the device spec is invalid. Invalid operation for device '0'.
vCenter Server task (moref: task-2043) failed in vCenter Server 'vcsa01' (####-####-####-####).
        at com.vmware.ssdc.library.vim.LmVim.Convert(LmVim.java:433)
        at com.vmware.ssdc.library.vim.LmVim.Convert(LmVim.java:500)
        at com.vmware.vcloud.val.taskmanagement.TaskWaiterInvRecord.CheckForError(TaskWaiterInvRecord.java:176)
        at com.vmware.vcloud.val.internal.impl.VcVimHandle.waitForTask(VcVimHandle.java:144)
        at com.vmware.vcloud.val.internal.impl.ReconfigureVmActivity$ReconfigureVmInVcPhase.reconfigureVm(ReconfigureVmActivity.java:340)
        at com.vmware.vcloud.val.internal.impl.ReconfigureVmActivity$ReconfigureVmInVcPhase.invoke(ReconfigureVmActivity.java:256)
        at com.vmware.vcloud.activity.executors.ActivityRunner.runPhase(ActivityRunner.java:175)
        at com.vmware.vcloud.activity.executors.ActivityRunner.run(ActivityRunner.java:112)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: (vim.fault.InvalidDeviceOperation) {
   faultCause = null,
   faultMessage = null,
   property = virtualDeviceSpec.device,
   deviceIndex = 0,
   badOp = edit,
   badFileOp = null
}

Environment

VMware Cloud Director 10.5.x

Cause

This error will occur if the VM which is being imported has a hard disk size containing a decimal value when converted to gigabytes. Example: 125.64 gb.

Note: If the hard disk are displayed in terabytes in vCenter Server UI then they may not equate to a whole number when converted gigabytes. Example: 1.1 tb will convert to 1126.4 gb. 

Resolution

This is a known issue which is resolved in Cloud Director 10.6 which is available here for download.

Workaround:

1.Increase the hard disk size to the nearest whole gigabyte as required within vCenter Server. Example: Increase 1126.4 gb to 1127 gb in the vCenter Server UI and save the change.

2.From the Provider portal's left navigation panel, select Resources, and from the page top navigation bar, select Infrastructure Resources.

3.From the secondary left panel, select vCenter Server Instance and click Refresh

4. Proceed to Import the VM  into VMware Cloud Director.