Bug 765855 - bad error message reporting when rhevm is missing a plugin, need doc for admin
Summary: bad error message reporting when rhevm is missing a plugin, need doc for admin
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: CloudForms Cloud Engine
Classification: Retired
Component: deltacloud-core
Version: 1.0.0
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: rc
Assignee: Michal Fojtik
QA Contact: Ronelle Landy
URL:
Whiteboard:
Depends On:
Blocks: 769851 783560
TreeView+ depends on / blocked
 
Reported: 2011-12-09 15:06 UTC by dgao
Modified: 2012-05-15 20:32 UTC (History)
9 users (show)

Fixed In Version: r1233874
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 769851 783560 (view as bug list)
Environment:
Last Closed: 2012-05-15 20:32:24 UTC


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2012:0587 0 normal SHIPPED_LIVE new packages: deltacloud-core 2012-05-15 22:31:31 UTC

Description dgao 2011-12-09 15:06:33 UTC
RHEVM is not equipped w/ a plugin that handles userdata, when audrey bits of the deployable xml is processed, RHEVM tossed a cryptic error message to deltacloud and subsequently, conductor. 

Suggested fix is that RHEVM gives deltacloud a more meaningful error message and deltacloud would catch that message.

Error at this moment: 

==> mock.log

thin server (localhost:3002) [deltacloud-mock][3566]: 127.0.0.1 - - [08/Dec/2011 15:52:58] "GET /api/instances/ HTTP/1.1" 404 18 0.0016
thin server (localhost:3002) [deltacloud-mock][3566]: [NO HANDLED] RHEVM::RHEVMBackendException: Cannot add VM if some of the specified custom properties are not configured by the system. These key
s are: $MissingKeys


==> rhevm.log

2011-12-08 15:53:02,961 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.GetImageInfoVDSCommand] (http-0.0.0.0-8443-5) FINISH, GetImageInfoVDSCommand, return: org.ovirt.engine.core.common.businesse
ntities.DiskImage@edb6ef6e, log id: 6cb18e9f
2011-12-08 15:53:02,963 WARN  [org.ovirt.engine.core.bll.AddVmCommand] (http-0.0.0.0-8443-5) CanDoAction of action AddVm failed. Reasons:VAR__ACTION__ADD,VAR__TYPE__VM,ACTION_TYPE_FAILED_INVALID_CUSTOM_VM_PROPERTIES_INVALID_KEYS,$MissingKeys floppyinject
2011-12-08 15:53:02,963 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (http-0.0.0.0-8443-5) Operation Failed: [Cannot add VM if some of the specified custom properties are not configured by the system. These keys are: $MissingKeys]

Comment 1 Michal Fojtik 2011-12-12 10:47:28 UTC
I think this error is very related to this one on upstream JIRA:

https://issues.apache.org/jira/browse/DTACLOUD-108

I will send a patch to make the error message more nice. However my though is that this is more RHEV-M bug than Deltacloud. Deltacloud is just 'proxyfying' the error message from RHEV-M. Our solution will be to catch this particular error and translate it, but the should be RHEV-M job :-)

Comment 3 Michal Fojtik 2012-01-20 11:32:24 UTC
This should be fixed. A special method "capability?" was added to rhevm_client.rb. This method is called before VM is created and user_data injection is requested. Method return 'true' if RHEV-M has floppyinject custom_hook installed.

Revisions: r1233874

diff --git a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
index ca09e92..26b15b7 100644
--- a/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
+++ b/server/lib/deltacloud/drivers/rhevm/rhevm_client.rb
@@ -119,6 +119,16 @@ module RHEVM
       (result_xml/'/cluster/version').first[:major].strip == major
     end
 
+    def capability?(name)
+      headers = {
+        :content_type => 'application/xml',
+        :accept => 'application/xml'
+      }
+      headers.merge!(auth_header)
+      result_xml = Nokogiri::XML(RHEVM::client(@api_entrypoint)["/capabilities"].get(headers))
+      !(result_xml/"/capabilities/version/custom_properties/custom_property[@name='#{name}']").empty?
+    end
+
     def create_vm(template_id, opts={})
       opts ||= {}
       templ = template(template_id)
@@ -135,6 +145,7 @@ module RHEVM
           }
           if opts[:user_data] and not opts[:user_data].empty?
             if api_version?('3') and cluster_version?((opts[:realm_id] || clusters.first.id), '3')
+              raise "Required VDSM hook 'floppyinject' not supported by RHEV-M" unless capability?(:floppyinject)
               custom_properties {
                 custom_property({
                   :name => "floppyinject",

Comment 4 Ronelle Landy 2012-01-20 19:43:08 UTC
If RHEVM does not have 'floppyinject' capability, the following error is returned (API output copied below): 

curl -X POST -F "image_id=14ba9684-41c5-4917-858c-13303bf710bd" -F "user_data=1|https://xxx|xxx_key|xxxxxxxx" --user 'username:password' "http://server:3001/api/instances?format=xml"
     
    <error status='500' url='/api/instances?format=xml'>
      <kind>backend_error</kind>
      <backend driver='rhevm'>
        <code>500</code>
      </backend>
      <message><![CDATA[Unhandled exception or status code (Required VDSM hook 'floppyinject' not supported by RHEV-M)]]></message>
    </error> 

When the 'floppyinject' capability is added to that same RHEVM server:

 curl -X POST -F "image_id=14ba9684-41c5-4917-858c-13303bf710bd" -F "user_data=1|https://xxxx|xxxx_key|xxxxxxxxx" --user 'username:password' "http://server:3001/api/instances?format=xml"
<?xml version='1.0' encoding='utf-8' ?>
<instance href='http://server:3001/api/instances/e3ed6fab-52c8-4a3e-95f3-05c381d84b49' id='e3ed6fab-52c8-4a3e-95f3-05c381d84b49'>
  <name>xxx</name>
  <owner_id>xxx</owner_id>
  <image href='http://server:3001/api/images/14ba9684-41c5-4917-858c-13303bf710bd' id='14ba9684-41c5-4917-858c-13303bf710bd'></image>
  <realm href='http://server:3001/api/realms/ba2b3a52-4303-11e1-b6c2-5cf3fc1c861c' id='ba2b3a52-4303-11e1-b6c2-5cf3fc1c861c'></realm>
  <state>PENDING</state>
  <hardware_profile href='http://server:3001/api/hardware_profiles/DESKTOP' id='DESKTOP'>
    <property kind='fixed' name='storage' unit='GB' value='1'></property>
    <property kind='fixed' name='cpu' unit='count' value='1'></property>
    <property kind='fixed' name='memory' unit='MB' value='512'></property>
  </hardware_profile>
  <actions>
    <link href='http://server:3001/api/images;instance_id=e3ed6fab-52c8-4a3e-95f3-05c381d84b49' method='post' rel='create_image' />
  </actions>
  <launch_time>2012-01-20T14:17:17.038-05:00</launch_time>
  <public_addresses><address port='xxxx' type='vnc'>127.0.0.1</address></public_addresses>
  <private_addresses></private_addresses>
</instance>

Comment 5 wes hayutin 2012-01-20 20:00:42 UTC
Can someone provide the steps to configure rhevm to have the floppy inject capability and we'll make this a doc bug

Comment 6 wes hayutin 2012-01-20 20:18:43 UTC
moving back to dc, there is a messaging fix put in.. GREAT!  Cloning the bug to make sure we have the appropriate doc for the rhevm setup

Comment 7 Ronelle Landy 2012-01-20 20:26:47 UTC
Marking this bug as verified as per test comments (in Comment 4) above.

Comment 9 errata-xmlrpc 2012-05-15 20:32:24 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2012-0587.html


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