Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1797927

Summary: [REST-API] Attaching/adding a disk with SATA interface to a VM fails with Exception Caused by: java.lang.IllegalArgumentException: Unknown disk interface "SATA"
Product: [oVirt] ovirt-engine Reporter: Avihai <aefrat>
Component: BLL.VirtAssignee: Liran Rotenberg <lrotenbe>
Status: CLOSED CURRENTRELEASE QA Contact: Polina <pagranat>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.4.0CC: bpelled, bugs, eshenitz, lrotenbe, rbarry, tnisan
Target Milestone: ovirt-4.4.0Flags: pm-rhel: ovirt-4.4+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhv-4.4.0-29 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-20 20:01:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Virt RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
engine log none

Description Avihai 2020-02-04 08:59:37 UTC
Created attachment 1657505 [details]
engine log

Description of problem:
Only via REST-API Attaching/adding a disk with SATA interface to a VM fails with Exception Caused by: java.lang.IllegalArgumentException: Unknown disk interface "SATA".

Via webadmin this functionality works.

Engine log exception:

2020-02-04 10:46:49,536+02 ERROR [org.ovirt.engine.api.restapi.resource.validation.MappingExceptionMapper] (default task-51) [] Mapping exception while processing "POST" request for path "/vms/9ca97b09-37b9-4e08-94dd-3c581b5de64e/diskattachments"
2020-02-04 10:46:49,536+02 ERROR [org.ovirt.engine.api.restapi.resource.validation.MappingExceptionMapper] (default task-51) [] Exception: org.ovirt.engine.api.restapi.utils.MappingException: java.lang.reflect.InvocationTargetException
        at org.ovirt.engine.api.restapi-types//org.ovirt.engine.api.restapi.types.MappingLocator$MethodInvokerMapper.map(MappingLocator.java:154)
        at org.ovirt.engine.api.restapi-jaxrs//org.ovirt.engine.api.restapi.resource.AbstractBackendResource.map(AbstractBackendResource.java:76)
        at org.ovirt.engine.api.restapi-jaxrs//org.ovirt.engine.api.restapi.resource.AbstractBackendResource.map(AbstractBackendResource.java:72)
        at org.ovirt.engine.api.restapi-jaxrs//org.ovirt.engine.api.restapi.resource.BackendDiskAttachmentsResource.getAddParameters(BackendDiskAttachmentsResource.java:154)
        at org.ovirt.engine.api.restapi-jaxrs//org.ovirt.engine.api.restapi.resource.BackendDiskAttachmentsResource.createDisk(BackendDiskAttachmentsResource.java:67)
        at org.ovirt.engine.api.restapi-jaxrs//org.ovirt.engine.api.restapi.resource.BackendDiskAttachmentsResource.add(BackendDiskAttachmentsResource.java:58)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:509)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:399)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$0(ResourceMethodInvoker.java:363)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:365)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:337)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:137)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:106)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:132)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:106)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:132)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:100)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:443)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:233)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:139)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:142)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:219)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:227)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
        at org.jboss.resteasy.resteasy-jaxrs.1.SP7-redhat-00001//org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
        at javax.servlet.api.0.Final-redhat-1//javax.servlet.http.HttpServlet.service(HttpServlet.java:791)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:81)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
        at io.undertow.core.28.SP1-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
        at io.undertow.core.28.SP1-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.core.28.SP1-redhat-00001//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:251)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:186)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.spec.RequestDispatcherImpl.forwardImpl(RequestDispatcherImpl.java:227)
.............................................................................
.............................................................................
.............................................................................
        at org.wildfly.extension.undertow.6.GA-redhat-00001//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.j
ava:1504)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:249)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:78)
        at io.undertow.servlet.28.SP1-redhat-00001//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:99)
        at io.undertow.core.28.SP1-redhat-00001//io.undertow.server.Connectors.executeRootHandler(Connectors.java:376)
        at io.undertow.core.28.SP1-redhat-00001//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
        at org.jboss.threads.2.Final-redhat-1//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.2.Final-redhat-1//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
        at org.jboss.threads.2.Final-redhat-1//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
        at org.jboss.threads.2.Final-redhat-1//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.ovirt.engine.api.restapi-types//org.ovirt.engine.api.restapi.types.MappingLocator$MethodInvokerMapper.map(MappingLocator.java:147)
        ... 121 more
Caused by: java.lang.IllegalArgumentException: Unknown disk interface "SATA"
        at org.ovirt.engine.api.restapi-types//org.ovirt.engine.api.restapi.types.DiskMapper.mapInterface(DiskMapper.java:418)
        at org.ovirt.engine.api.restapi-types//org.ovirt.engine.api.restapi.types.DiskAttachmentMapper.map(DiskAttachmentMapper.java:32)
        ... 126 more


Version-Release number of selected component (if applicable):
rhv-4.4.0-17
ovirt engine 4.4.0-0.17.master.el7
vdsm-4.40.1-1.el8ev.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create a VM from template
2. Via REST-API Add/Attach a disk with interface type "sata" 

REST request:

URL:
https://storage-ge-04.scl.lab.tlv.redhat.com/ovirt-engine/api/vms/9ca97b09-37b9-4e08-94dd-3c581b5de64e/diskattachments

Header:
Content-Type = Application/xml

Method: 
Post

Body:
<disk_attachment>
  <bootable>false</bootable>
  <pass_discard>false</pass_discard>
  <interface>sata</interface>
  <active>true</active>
  <disk>
    <provisioned_size>1073741824</provisioned_size>
    <format>cow</format>
    <storage_domains>
      <storage_domain>
        <name>iscsi_0</name>
      </storage_domain>
    </storage_domains>
  </disk>
</disk_attachment>

Actual results:
The operation fails with an exception in the engine.

Rest response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <reason>Operation Failed</reason>
</fault>

Expected results:
Should work.

Additional info:

Comment 1 Sandro Bonazzola 2020-03-30 13:37:08 UTC
this bug is in modified and targeting 4.4.2. Can we re-target to 4.4.0 and move to QE?

Comment 3 Polina 2020-04-20 21:03:38 UTC
verified on  http://bob-dr.lab.eng.brq.redhat.com/builds/4.4/rhv-4.4.0-31.

test1(with iscsi storage domain):

POST https://{{host}}/ovirt-engine/api/vms/f2bad84d-722a-49c4-8c0f-082526d21372/diskattachments
<disk_attachment>
  <bootable>false</bootable>
  <pass_discard>false</pass_discard>
  <interface>sata</interface>
  <active>true</active>
  <disk>
    <provisioned_size>1073741824</provisioned_size>
    <format>cow</format>
    <storage_domains>
      <storage_domain>
        <name>iscsi_0</name>
      </storage_domain>
    </storage_domains>
  </disk>
</disk_attachment>

Response 201
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<disk_attachment href="/ovirt-engine/api/vms/f2bad84d-722a-49c4-8c0f-082526d21372/diskattachments/2daa0c4b-865a-44a0-81ef-afd427f3e6a8" id="2daa0c4b-865a-44a0-81ef-afd427f3e6a8">
    <active>true</active>
    <bootable>false</bootable>
    <interface>sata</interface>
    <pass_discard>false</pass_discard>
    <read_only>false</read_only>
    <uses_scsi_reservation>false</uses_scsi_reservation>
    <disk href="/ovirt-engine/api/disks/2daa0c4b-865a-44a0-81ef-afd427f3e6a8" id="2daa0c4b-865a-44a0-81ef-afd427f3e6a8"/>
    <vm href="/ovirt-engine/api/vms/f2bad84d-722a-49c4-8c0f-082526d21372" id="f2bad84d-722a-49c4-8c0f-082526d21372"/>
</disk_attachment>

test2 (with nfs storage domain):

POST https://{{host}}/ovirt-engine/api/vms/171081fd-415e-4636-8fe1-37b19bf2b749/diskattachments
<disk_attachment>
  <bootable>false</bootable>
  <pass_discard>false</pass_discard>
  <interface>sata</interface>
  <active>true</active>
  <disk>
    <provisioned_size>1073741824</provisioned_size>
    <format>cow</format>
    <storage_domains>
      <storage_domain>
        <name>nfs_0</name>
      </storage_domain>
    </storage_domains>
  </disk>
</disk_attachment>

Responce 201:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<disk_attachment href="/ovirt-engine/api/vms/171081fd-415e-4636-8fe1-37b19bf2b749/diskattachments/3c9a28ac-9dcf-42ae-a784-de40c77a1747" id="3c9a28ac-9dcf-42ae-a784-de40c77a1747">
    <active>true</active>
    <bootable>false</bootable>
    <interface>sata</interface>
    <pass_discard>false</pass_discard>
    <read_only>false</read_only>
    <uses_scsi_reservation>false</uses_scsi_reservation>
    <disk href="/ovirt-engine/api/disks/3c9a28ac-9dcf-42ae-a784-de40c77a1747" id="3c9a28ac-9dcf-42ae-a784-de40c77a1747"/>
    <vm href="/ovirt-engine/api/vms/171081fd-415e-4636-8fe1-37b19bf2b749" id="171081fd-415e-4636-8fe1-37b19bf2b749"/>
</disk_attachment>

Comment 4 Sandro Bonazzola 2020-05-20 20:01:24 UTC
This bugzilla is included in oVirt 4.4.0 release, published on May 20th 2020.

Since the problem described in this bug report should be
resolved in oVirt 4.4.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.