Bug 1283499

Summary: Impossible to POST key value using REST API
Product: [oVirt] ovirt-engine Reporter: Nikolai Sednev <nsednev>
Component: VMConsoleAssignee: Francesco Romani <fromani>
Status: CLOSED CURRENTRELEASE QA Contact: Nikolai Sednev <nsednev>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.6.0.2CC: bugs, iheim, michal.skrivanek
Target Milestone: ovirt-4.0.0-alphaKeywords: Triaged
Target Release: 4.0.0Flags: rule-engine: ovirt-4.0.0+
rule-engine: planning_ack+
rule-engine: devel_ack+
rule-engine: testing_ack+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: ovirt 4.0.0 alpha1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-05 07:48:43 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:
Bug Depends On: 1320964, 1325657, 1325677    
Bug Blocks: 1254445    
Attachments:
Description Flags
engine's sosreport none

Description Nikolai Sednev 2015-11-19 07:43:56 UTC
Description of problem:

I was trying to POST the key using REST API, but received the error:
<fault>
<reason>Operation Failed</reason>
<detail>
[Cannot add User Profile. User profile already created.]
</detail>
</fault>

So it's currently not possible to create a key using REST.

Version-Release number of selected component (if applicable):
Host:
ovirt-vmconsole-host-1.0.1-0.0.master.20151105234454.git3e5d52e.el7.noarch
libvirt-client-1.2.17-13.el7.x86_64
ovirt-vmconsole-1.0.1-0.0.master.20151105234454.git3e5d52e.el7.noarch
vdsm-4.17.10.1-0.el7.centos.noarch
ovirt-release36-002-2.noarch
sanlock-3.2.4-1.el7.x86_64
mom-0.5.1-2.el7.noarch
ovirt-release36-snapshot-002-2.noarch
qemu-kvm-rhev-2.3.0-31.el7_2.1.x86_64
Linux version 3.10.0-327.el7.x86_64 (mockbuild.eng.bos.redhat.com) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Oct 29 17:29:29 EDT 2015

Engine:
rhevm-3.6.0.3-0.1.el6.noarch
qemu-guest-agent-0.12.1.2-2.479.el6_7.2.x86_64
rhevm-guest-agent-common-1.0.11-2.el6ev.noarch
rhev-guest-tools-iso-3.6-2.el6ev.noarch
rhevm-vmconsole-proxy-helper-3.6.0.3-0.1.el6.noarch
ovirt-vmconsole-proxy-1.0.0-1.el6ev.noarch
jboss-as-console-2.5.10-4.Final_redhat_2.1.ep6.el6.noarch
rhevm-setup-plugin-vmconsole-proxy-helper-3.6.0.3-0.1.el6.noarch
ovirt-vmconsole-1.0.0-1.el6ev.noarch
Linux version 2.6.32-573.8.1.el6.x86_64 (mockbuild.eng.bos.redhat.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ) #1 SMP Fri Sep 25 19:24:22 EDT 2015

How reproducible:
100%

Steps to Reproduce:
1.Using REST API, create the key with POST.
2.
3.

Actual results:
<fault>
<reason>Operation Failed</reason>
<detail>
[Cannot add User Profile. User profile already created.]
</detail>
</fault>

Expected results:
Key should be created successfully for the user.

Additional info:

Comment 1 Nikolai Sednev 2015-11-19 07:48:09 UTC
Created attachment 1096520 [details]
engine's sosreport

Comment 2 Alon Bar-Lev 2015-11-19 07:50:12 UTC
Again, wrong product, please learn about the setup you are testing and the role of each component.

Comment 3 Francesco Romani 2015-11-19 15:20:12 UTC
workaround exists, albeit ugly: PUT key using bogus UUID, which will be ignored. E.g.: use blank UUID.

Comment 4 Francesco Romani 2016-02-15 10:28:31 UTC
This is scheduled for 4.0, patch merged in master -> MODIFIED

Comment 5 Francesco Romani 2016-02-15 11:55:35 UTC
This BZ was an implementation bug, I don't think this deserves doc_text.

Comment 6 Nikolai Sednev 2016-04-10 15:45:05 UTC
Can't proceed until 1325677 is resolved.

Comment 7 Nikolai Sednev 2016-04-12 15:42:33 UTC
Works for me on these components:
Engine:
ovirt-engine-4.0.0-0.0.master.20160404161620.git4ffd5a4.el7.centos.noarch
ovirt-host-deploy-1.5.0-0.0.master.20160329063025.gitdf57fe1.el7.centos.noarch
ovirt-host-deploy-java-1.5.0-0.0.master.20160329063025.gitdf57fe1.el7.centos.noarch
javassist-3.16.1-10.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.7.0-openjdk-devel-1.7.0.99-2.6.5.0.el7_2.x86_64
java-1.8.0-openjdk-1.8.0.77-0.b03.el7_2.x86_64
java-1.7.0-openjdk-headless-1.7.0.99-2.6.5.0.el7_2.x86_64
java-1.8.0-openjdk-headless-1.8.0.77-0.b03.el7_2.x86_64
javamail-1.4.6-8.el7.noarch
java-1.7.0-openjdk-1.7.0.99-2.6.5.0.el7_2.x86_64
ovirt-engine-vmconsole-proxy-helper-4.0.0-0.0.master.20160404161620.git4ffd5a4.el7.centos.noarch
ovirt-vmconsole-1.0.1-0.0.master.20160309100203.gitdfa3c40.el7.noarch
ovirt-engine-setup-plugin-vmconsole-proxy-helper-4.0.0-0.0.master.20160404161620.git4ffd5a4.el7.centos.noarch
ovirt-vmconsole-proxy-1.0.1-0.0.master.20160309100203.gitdfa3c40.el7.noarch
Linux 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
CentOS Linux release 7.2.1511 (Core) 

Created the new key using RESTClient, over RESTAPI:

Header Name 	Header Value
Content-Type	application/xml
Accept	        application/xml

Body:

<ssh_public_key>
<content>ssh-dsa ABAAB3NzaC1yc2EAAAADAQABAAABAQCr/rS9Jxc/A3U0a2A4ImH+iPwGDV5ZHu6DoY3GOvGN6wElGvyXF0mxWisb6J/dNtx4kHb9k+oXqBNC4bKRoK5wPEIuD+RxY90OTuumgnCmaIOSCqewGOHth2Xwd3FQux7rYnMnnz1Yh7Cs5wbTtb/VQPVohML1CCMidyTv8Er+LojgsVfvIpWLA9AheePAp14Rn7lw8W5VjdFytZ+B76wDZpfkDEFdu8H2AJ1vwPKRsKd82I1qTG9k91XO0Go4OUc1fAiHMxjL2U7siIPPzNtE4wMCOTlyVnPRSZVNfMEefPlIUH27X/gxfFA1I1RGu1cWcYwhI8FF0a0C+YbYMymd nsednev.csb</content>
</ssh_public_key>

Got Response:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ssh_public_keys>
    <ssh_public_key id="21e7adb8-faa0-49a7-8753-bda17b399f7f">
        <content>ssh-dsa ABAAB3NzaC1yc2EAAAADAQABAAABAQCr/rS9Jxc/A3U0a2A4ImH+iPwGDV5ZHu6DoY3GOvGN6wElGvyXF0mxWisb6J/dNtx4kHb9k+oXqBNC4bKRoK5wPEIuD+RxY90OTuumgnCmaIOSCqewGOHth2Xwd3FQux7rYnMnnz1Yh7Cs5wbTtb/VQPVohML1CCMidyTv8Er+LojgsVfvIpWLA9AheePAp14Rn7lw8W5VjdFytZ+B76wDZpfkDEFdu8H2AJ1vwPKRsKd82I1qTG9k91XO0Go4OUc1fAiHMxjL2U7siIPPzNtE4wMCOTlyVnPRSZVNfMEefPlIUH27X/gxfFA1I1RGu1cWcYwhI8FF0a0C+YbYMymd nsednev.csb</content>
        <user href="/ovirt-engine/api/users/0000001a-001a-001a-001a-00000000006e" id="0000001a-001a-001a-001a-00000000006e"/>
    </ssh_public_key>
</ssh_public_keys>

Comment 8 Sandro Bonazzola 2016-07-05 07:48:43 UTC
oVirt 4.0.0 has been released, closing current release.