
----- Original Message -----
From: "Yuriy Demchenko" <demchenko.ya@gmail.com> To: "Alissa Bonas" <abonas@redhat.com> Cc: "Ofer Schreiber" <oschreib@redhat.com>, users@ovirt.org, "Michael Pasternak" <mpastern@redhat.com>, "Allon Mureinik" <amureini@redhat.com> Sent: Monday, September 23, 2013 10:57:12 AM Subject: Re: [Users] cant add storage connection via api
On 09/23/2013 11:43 AM, Alissa Bonas wrote:
----- Original Message -----
From: "Michael Pasternak" <mpastern@redhat.com> To: "Yuriy Demchenko" <demchenko.ya@gmail.com>, "Alissa Bonas" <abonas@redhat.com>, "Alon Bar-Lev" <alonbl@redhat.com> Cc: "Ofer Schreiber" <oschreib@redhat.com>, users@ovirt.org Sent: Monday, September 23, 2013 10:22:49 AM Subject: Re: [Users] cant add storage connection via api
Hi,
url [1] (https://ovirt.spb.stone.local/api?rsdl) not working for me - gets http 500 error with "java.lang.NullPointerException"
java.lang.NullPointerException org.ovirt.engine.api.restapi.resource.BackendApiResource.addSystemVersion(BackendApiResource.java:358) org.ovirt.engine.api.restapi.resource.BackendApiResource.get(BackendApiResource.java:316) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:155) org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:525) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:502) org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:119) org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) api page (without "?rsdl") opens just fine.
On 09/23/2013 10:05 AM, Yuriy Demchenko wrote: this is known issue caused by branding infra, i believe it was fixed in the following release (Alon correct me if i'm wrong)
Feature "manage storage connections" was mentioned in oVirt-3.3 release notes (http://www.ovirt.org/OVirt_3.3_release_notes), under "storage" section. alissa? Storage connections management should be part of 3.3. Yuriy, when did you install the 3.3 and which exact build did you take?
That was upgrade from 3.2.2 to 3.3, did that on Tuesday 17, from 3.3 release repo (http://resources.ovirt.org/releases/3.3/rpm/EL/6/)
ovirt-engine-3.3.0-4.el6 noarch 9/17/13 3:05:40 PM MUT ovirt-engine-backend-3.3.0-4.el6 noarch 9/17/13 3:05:34 PM MUT ovirt-engine-cli-3.2.0.12-1.el6 noarch 6/17/13 11:24:48 AM MUT ovirt-engine-dbscripts-3.3.0-4.el6 noarch 9/17/13 3:05:39 PM MUT ovirt-engine-lib-3.3.0-4.el6 noarch 9/17/13 2:57:00 PM MUT ovirt-engine-restapi-3.3.0-4.el6 noarch 9/17/13 3:05:30 PM MUT ovirt-engine-sdk-3.2.0.11-1.el6 noarch 6/17/13 11:24:33 AM MUT ovirt-engine-setup-3.3.0-4.el6 noarch 9/17/13 2:57:03 PM MUT ovirt-engine-tools-3.3.0-4.el6 noarch 9/17/13 3:05:35 PM MUT ovirt-engine-userportal-3.3.0-4.el6 noarch 9/17/13 3:05:29 PM MUT ovirt-engine-webadmin-portal-3.3.0-4.el6 noarch 9/17/13 3:06:01 PM MUT ovirt-engine-websocket-proxy-3.3.0-4.el6 noarch 9/17/13 3:21:14 PM MUT ovirt-host-deploy-1.1.1-1.el6 noarch 9/17/13 3:05:15 PM MUT ovirt-host-deploy-java-1.1.1-1.el6 noarch 9/17/13 3:05:16 PM MUT ovirt-image-uploader-3.3.0-1.el6 noarch 9/17/13 3:05:14 PM MUT ovirt-iso-uploader-3.3.0-1.el6 noarch 9/17/13 3:05:17 PM MUT ovirt-log-collector-3.3.0-1.el6 noarch 9/17/13 3:05:18 PM MUT
Also, can you access the following url (just a regular GET request) ? https://ovirt.spb.stone.local/api/storageconnections Yes I can. And I get list of all current connections there.
OK, thank you. Please let me know 2 more things: 1. Is the connections subresource for a storage domain available? It is accessed in the link below with a GET request (please replace domainId placeholder with an id of one of your storage domains, doesn't matter which) https://ovirt.spb.stone.local/api/storagedomains/<domainId>/storageconnections 2. In the main storage connections resource which you accessed via the below url - is a single connection's element named storage_connection or storage? https://ovirt.spb.stone.local/api/storageconnections
Yuriy Demchenko
Hi Yuriy,
please see the correct way of adding new storageconnection at [1], under <link href="/api/storageconnections" rel="add"> section,
also please let us know if you find any inconsistency between the wiki and rsdl,
regarding the UnmarshalException, i'm not sure this feature got in to the version you're using,
Ofer, in what release mentioned feature is available?
thanks.
[1] https://ovirt.spb.stone.local/api?rsdl
On 09/18/2013 03:21 PM, Yuriy Demchenko wrote:
Hi,
I've recently upgraded my test lab to ovirt-3.3 (el6) and trying to add additional target for iscsi domain. As described here - http://www.ovirt.org/Features/Manage_Storage_Connections , I'm trying first to add new connection via restapi, but operation fails with error "HTTP Status 400 - javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"storage_connection")" I'm not very familiar with restapi and maybe doing something wrong, so please help me to figure it out.
here's what i put and reply from server: > curl -k -v -u "admin@internal:pass" -H "Content-type: application/xml" > -d '<storage_connection> > <type>iscsi</type> > <address>192.168.221.5</address> > <port>3260</port> > <target>iqn.2013-09.local.stone.spb:target3.disk</target> > </storage_connection>' > 'https://ovirt.spb.stone.local/api/storageconnections' > * About to connect() to ovirt.spb.stone.local port 443 (#0) > * Trying 192.168.220.13... > * connected > * Connected to ovirt.spb.stone.local (192.168.220.13) port 443 (#0) > * Initializing NSS with certpath: sql:/etc/pki/nssdb > * warning: ignoring value of ssl.verifyhost > * skipping SSL peer certificate verification > * SSL connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA > * Server certificate: > * subject: CN=ovirt.spb.stone.local,O=spb.stone.local,C=US > * start date: Aug 28 09:28:45 2013 GMT > * expire date: Aug 03 09:28:47 2018 GMT > * common name: ovirt.spb.stone.local > * issuer: CN=CA-ovirt.spb.stone.local.95565,O=spb.stone.local,C=US > * Server auth using Basic with user 'admin@internal' >> POST /api/storageconnections HTTP/1.1 >> Authorization: Basic YWRtaW5AaW50ZXJuYWw6bXAyMjFjMg== >> User-Agent: curl/7.24.0 (x86_64-redhat-linux-gnu) libcurl/7.24.0 >> NSS/3.14.3.0 zlib/1.2.5 libidn/1.24 libssh2/1.4.1 >> Host: ovirt.spb.stone.local >> Accept: */* >> Content-type: application/xml >> Content-Length: 170 >> > * upload completely sent off: 170 out of 170 bytes > < HTTP/1.1 400 Bad Request > < Date: Wed, 18 Sep 2013 12:05:51 GMT > < Content-Type: text/html;charset=utf-8 > < Vary: Accept-Encoding > < Connection: close > < Transfer-Encoding: chunked > < > <html><head><title>JBoss Web/7.0.13.Final - Error > report</title><style><!--H1 > {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} > H2 > {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} > H3 > {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} > BODY > {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} > B > {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} > P > {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A > {color > : black;}A.name {color : black;}HR {color : #525D76;}--></style> > </head><body><h1>HTTP Status 400 - javax.xml.bind.UnmarshalException: > unexpected element > (uri:"", local:"storage_connection"). Expected > elements are > <{}action>,<{}agent>,<{}agents>,<{}api>,<{}application>,<{}applications>,<{}authentication_methods>,<{}body>,<{}bonding>,<{}boot_devices>,<{}boot_protocols>,<{}brick>,<{}brick_details>,<{}brick_memoryinfo>,<{}brick_states>,<{}bricks>,<{}capabilities>,<{}cdrom>,<{}cdroms>,<{}certificate>,<{}cluster>,<{}clusters>,<{}console>,<{}content_types>,<{}cpu>,<{}cpu_modes>,<{}cpu_tune>,<{}cpus>,<{}creation>,<{}creation_states>,<{}custom_properties>,<{}data_center>,<{}data_center_states>,<{}data_centers>,<{}detailedLink>,<{}detailedLinks>,<{}disk>,<{}disk_formats>,<{}disk_interfaces>,<{}disk_states>,<{}disks>,<{}display>,<{}display_types>,<{}domain>,<{}domains>,<{}error_handling>,<{}event>,<{}events>! ;,! &l t;{}fault>,<{}feature>,<{}features>,<{}fence_types>,<{}file>,<{}files>,<{}floppies>,<{}floppy>,<{}general_metadata>,<{}gluster_client>,<{}gluster_clients>,<{}gluster_hook>,<{}gluster_volume>,<{}gluster_volume_states>,<{}gluster_volume_types>,<{}gluster_volumes>,<{}glusterhooks>,<{}group>,<{}groups>,<{}hardware_information>,<{}header>,<{}headers>,<{}hook>,<{}hook_states>,<{}hooks>,<{}host>,<{}host_nic>,<{}host_nic_states>,<{}host_nics>,<{}host_non_operational_details>,<{}host_states>,<{}host_storage>,<{}hosts>,<{}ip>,<{}ip_versions>,<{}ips>,<{}job>,<{}jobs>,<{}keyValuePair>,<{}ksm>,<{}link>,<{}linkCapabilities>,<{}logical_unit>,<{}mac>,<{}memory_pool>,<{}memory_pools>,<{}network>,<{}network_stat! es! &g t;,<{}networks>,<{}nfs_versions>,<{}nic>,<{}nic_interfaces>,<{}nics>,<{}options>,<{}os_types>,<{}parameter>,<{}parameters_set>,<{}payload>,<{}payload_file>,<{}payloads>,<{}permission>,<{}permissions>,<{}permit>,<{}permits>,<{}pm_proxies>,<{}pm_proxy>,<{}pm_proxy_types>,<{}port_mirroring>,<{}power_management>,<{}power_management_states>,<{}power_managers>,<{}preview_vms>,<{}product_info>,<{}quota>,<{}quotas>,<{}reported_device>,<{}reported_device_types>,<{}reported_devices>,<{}request>,<{}response>,<{}role>,<{}roles>,<{}rsdl>,<{}scheduling_policies>,<{}schema>,<{}server_hook>,<{}server_hooks>,<{}sgio_options>,<{}slaves>,<{}snapshot>,<{}snapshots>,<{}special_objects>,<{}ssh>,<{}stages>,<{}statistic&! gt! ;, <{}statistics>,<{}status>,<{}step>,<{}step_types>,<{}steps>,<{}storage>,<{}storage_connections>,<{}storage_domain>,<{}storage_domain_states>,<{}storage_domain_types>,<{}storage_domains>,<{}storage_formats>,<{}storage_manager>,<{}storage_types>,<{}summary>,<{}system_version>,<{}tag>,<{}tags>,<{}template>,<{}template_states>,<{}templates>,<{}transparent_hugepages>,<{}transport_types>,<{}url>,<{}usages>,<{}usb>,<{}user>,<{}users>,<{}value>,<{}values>,<{}vcpu_pin>,<{}version>,<{}vlan>,<{}vm>,<{}vm_affinities>,<{}vm_device_types>,<{}vm_pause_details>,<{}vm_states>,<{}vm_types>,<{}vmpool>,<{}vmpools>,<{}vms>,<{}volume_group>,<{}watchdog>,<{}watchdog_actions>,<{}watchdog_models>,<{}watchdogs></h1><HR
> size="1" noshade="noshade"><p><b>type</b> Status > report</p><p><b>message</b> <u>javax.xml.bind.UnmarshalException: > unexpected element (uri:"", > local:"storage_connection"). Expected elements are > <{}action>,<{}agent>,<{}agents>,<{}api>,<{}application>,<{}applications>,<{}authentication_methods>,<{}body>,<{}bonding>,<{}boot_devices>,<{}boot_protocols>,<{}brick>,<{}brick_details>,<{}brick_memoryinfo>,<{}brick_states>,<{}bricks>,<{}capabilities>,<{}cdrom>,<{}cdroms>,<{}certificate>,<{}cluster>,<{}clusters>,<{}console>,<{}content_types>,<{}cpu>,<{}cpu_modes>,<{}cpu_tune>,<{}cpus>,<{}creation>,<{}creation_states>,<{}custom_properties>,<{}data_center>,<{}data_center_states>,<{}data_centers>,<{}detailedLink>,<{}detailedLinks>,<{}disk>,<{}disk_formats>,<{}disk_interfaces>,<{}disk_states>,<{}disks>,<{}display>,<{}display_types>,<{}domain>,<{}domains>,<{}error_handling>,<{}event>,<{}events>! ;,! &l t;{}fault>,<{}feature>,<{}features>,<{}fence_types>,<{}file>,<{}files>,<{}floppies>,<{}floppy>,<{}general_metadata>,<{}gluster_client>,<{}gluster_clients>,<{}gluster_hook>,<{}gluster_volume>,<{}gluster_volume_states>,<{}gluster_volume_types>,<{}gluster_volumes>,<{}glusterhooks>,<{}group>,<{}groups>,<{}hardware_information>,<{}header>,<{}headers>,<{}hook>,<{}hook_states>,<{}hooks>,<{}host>,<{}host_nic>,<{}host_nic_states>,<{}host_nics>,<{}host_non_operational_details>,<{}host_states>,<{}host_storage>,<{}hosts>,<{}ip>,<{}ip_versions>,<{}ips>,<{}job>,<{}jobs>,<{}keyValuePair>,<{}ksm>,<{}link>,<{}linkCapabilities>,<{}logical_unit>,<{}mac>,<{}memory_pool>,<{}memory_pools>,<{}network>,<{}network_stat! es! &g t;,<{}networks>,<{}nfs_versions>,<{}nic>,<{}nic_interfaces>,<{}nics>,<{}options>,<{}os_types>,<{}parameter>,<{}parameters_set>,<{}payload>,<{}payload_file>,<{}payloads>,<{}permission>,<{}permissions>,<{}permit>,<{}permits>,<{}pm_proxies>,<{}pm_proxy>,<{}pm_proxy_types>,<{}port_mirroring>,<{}power_management>,<{}power_management_states>,<{}power_managers>,<{}preview_vms>,<{}product_info>,<{}quota>,<{}quotas>,<{}reported_device>,<{}reported_device_types>,<{}reported_devices>,<{}request>,<{}response>,<{}role>,<{}roles>,<{}rsdl>,<{}scheduling_policies>,<{}schema>,<{}server_hook>,<{}server_hooks>,<{}sgio_options>,<{}slaves>,<{}snapshot>,<{}snapshots>,<{}special_objects>,<{}ssh>,<{}stages>,<{}statistic&! gt! ;, <{}statistics>,<{}status>,<{}step>,<{}step_types>,<{}steps>,<{}storage>,<{}storage_connections>,<{}storage_domain>,<{}storage_domain_states>,<{}storage_domain_types>,<{}storage_domains>,<{}storage_formats>,<{}storage_manager>,<{}storage_types>,<{}summary>,<{}system_version>,<{}tag>,<{}tags>,<{}template>,<{}template_states>,<{}templates>,<{}transparent_hugepages>,<{}transport_types>,<{}url>,<{}usages>,<{}usb>,<{}user>,<{}users>,<{}value>,<{}values>,<{}vcpu_pin>,<{}version>,<{}vlan>,<{}vm>,<{}vm_affinities>,<{}vm_device_types>,<{}vm_pause_details>,<{}vm_states>,<{}vm_types>,<{}vmpool>,<{}vmpools>,<{}vms>,<{}volume_group>,<{}watchdog>,<{}watchdog_actions>,<{}watchdog_models>,<{}watchdogs></u></p><!
On 09/22/2013 11:00 AM, Michael Pasternak wrote: p>!
<b
> description</b> > <u>The request sent by the client was syntactically incorrect > (javax.xml.bind.UnmarshalException: unexpected element > (uri:"", > local:"storage_connection"). Expected elements are > <{}action>,<{}agent>,<{}agents>,<{}api>,<{}application>,<{}applications>,<{}authentication_methods>,<{}body>,<{}bonding>,<{}boot_devices>,<{}boot_protocols>,<{}brick>,<{}brick_details>,<{}brick_memoryinfo>,<{}brick_states>,<{}bricks>,<{}capabilities>,<{}cdrom>,<{}cdroms>,<{}certificate>,<{}cluster>,<{}clusters>,<{}console>,<{}content_types>,<{}cpu>,<{}cpu_modes>,<{}cpu_tune>,<{}cpus>,<{}creation>,<{}creation_states>,<{}custom_properties>,<{}data_center>,<{}data_center_states>,<{}data_centers>,<{}detailedLink>,<{}detailedLinks>,<{}disk>,<{}disk_formats>,<{}disk_interfaces>,<{}disk_states>,<{}disks>,<{}display>,<{}display_types>,<{}domain>,<{}domains>,<{}error_handling>,<{}event>,<{}events>! ;,! &l t;{}fault>,<{}feature>,<{}features>,<{}fence_types>,<{}file>,<{}files>,<{}floppies>,<{}floppy>,<{}general_metadata>,<{}gluster_client>,<{}gluster_clients>,<{}gluster_hook>,<{}gluster_volume>,<{}gluster_volume_states>,<{}gluster_volume_types>,<{}gluster_volumes>,<{}glusterhooks>,<{}group>,<{}groups>,<{}hardware_information>,<{}header>,<{}headers>,<{}hook>,<{}hook_states>,<{}hooks>,<{}host>,<{}host_nic>,<{}host_nic_states>,<{}host_nics>,<{}host_non_operational_details>,<{}host_states>,<{}host_storage>,<{}hosts>,<{}ip>,<{}ip_versions>,<{}ips>,<{}job>,<{}jobs>,<{}keyValuePair>,<{}ksm>,<{}link>,<{}linkCapabilities>,<{}logical_unit>,<{}mac>,<{}memory_pool>,<{}memory_pools>,<{}network>,<{}network_stat! es! &g t;,<{}networks>,<{}nfs_versions>,<{}nic>,<{}nic_interfaces>,<{}nics>,<{}options>,<{}os_types>,<{}parameter>,<{}parameters_set>,<{}payload>,<{}payload_file>,<{}payloads>,<{}permission>,<{}permissions>,<{}permit>,<{}permits>,<{}pm_proxies>,<{}pm_proxy>,<{}pm_proxy_types>,<{}port_mirroring>,<{}power_management>,<{}power_management_states>,<{}power_managers>,<{}preview_vms>,<{}product_info>,<{}quota>,<{}quotas>,<{}reported_device>,<{}reported_device_types>,<{}reported_devices>,<{}request>,<{}response>,<{}role>,<{}roles>,<{}rsdl>,<{}scheduling_policies>,<{}schema>,<{}server_hook>,<{}server_hooks>,<{}sgio_options>,<{}slaves>,<{}snapshot>,<{}snapshots>,<{}special_objects>,<{}ssh>,<{}stages>,<{}statistic&! gt! ;, <{}statistics>,<{}status>,<{}step>,<{}step_types>,<{}steps>,<{}storage>,<{}storage_connections>,<{}sto* > Closing connection #0 > rage_domain>,<{}storage_domain_states>,<{}storage_domain_types>,<{}storage_domains>,<{}storage_formats>,<{}storage_manager>,<{}storage_types>,<{}summary>,<{}system_version>,<{}tag>,<{}tags>,<{}template>,<{}template_states>,<{}templates>,<{}transparent_hugepages>,<{}transport_types>,<{}url>,<{}usages>,<{}usb>,<{}user>,<{}users>,<{}value>,<{}values>,<{}vcpu_pin>,<{}version>,<{}vlan>,<{}vm>,<{}vm_affinities>,<{}vm_device_types>,<{}vm_pause_details>,<{}vm_states>,<{}vm_types>,<{}vmpool>,<{}vmpools>,<{}vms>,<{}volume_group>,<{}watchdog>,<{}watchdog_actions>,<{}watchdog_models>,<{}watchdogs>).</u></p><HR > > size="1" noshade="noshade"><h3>JBoss > Web/7.0.13.Final</h3></body></html>
--
Michael Pasternak RedHat, ENG-Virtualization R&D