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

Bug 847798

Summary: prevent editting provider name
Product: [Retired] CloudForms Cloud Engine Reporter: Dave Johnson <dajohnso>
Component: aeolus-conductorAssignee: Jozef Zigmund <jzigmund>
Status: CLOSED ERRATA QA Contact: Rehana <aeolus-qa-list>
Severity: medium Docs Contact:
Priority: high    
Version: 1.0.0CC: akarol, asettle, athomas, aweiteka, cpelland, deltacloud-maint, dmacpher, jzigmund, morazi, mtaylor, redakkan, slinaber, ssachdev, sseago, sshveta, tzumainn
Target Milestone: beta5Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Due to name mismatches with Imagefactory configuration files, changing names for private cloud providers in Cloud Engine resulted in an internal server error when pushing images. This patch disables editing of the provider name, which provides a successful match with configuration files for private cloud providers.
Story Points: ---
Clone Of: 804926
: 865833 (view as bug list) Environment:
Last Closed: 2012-12-04 15:16:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 804926    
Bug Blocks: 865833    
Attachments:
Description Flags
Edit Provider name not allowed if not in config file
none
edit provider none

Description Dave Johnson 2012-08-13 15:27:01 UTC
+++ This bug was initially created as a clone of Bug #804926 +++

Created attachment 571313 [details]
provider

Description of problem:

I got this error "Failed. Response code = 500. Response message = Internal Server Error" when i tried to do a "push all" operation from conductor after changing the provider name from "rhevm-default" to "rhevm-default_rehana"

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.Login to aeolus
2.Created three provider accounts(rhevm,vsphere,ec2)
3.Changed the default provider name of rhevm from "rhevm-default" to "rhevm-default_rehana"(pfa:provider.png)
3.Build image for two providers i.e for rhevm and vsphere from CLI
4.Clicked on "Push all" button from conductor
  
Actual results:

1. On click of "Push all" button ,in conductor it displayed the below error "Failed. Response code = 500. Response message = Internal Server Error"
(pfa: UI.png, rails.log)

2. On click of 'push' button it displayed the appropriate error message
"Unable to Upload Provider Image"


Expected results:

So i feel either changing default provider name should be disabled(if its not allowed to change the provider name) or the error should be changed to user understandable form. 

Additional info:

rpm -qa | grep aeolus
aeolus-configure-2.5.0-18.el6.noarch
rubygem-aeolus-image-0.3.0-12.el6.noarch
rubygem-aeolus-cli-0.3.0-14.el6.noarch
aeolus-conductor-0.8.0-43.el6.noarch
aeolus-conductor-doc-0.8.0-43.el6.noarch
aeolus-conductor-daemons-0.8.0-43.el6.noarch
aeolus-all-0.8.0-43.el6.noarch

--- Additional comment from redakkan on 2012-03-20 04:18:36 EDT ---

Created attachment 571314 [details]
UI

--- Additional comment from redakkan on 2012-03-20 04:19:32 EDT ---

Created attachment 571315 [details]
rail log

--- Additional comment from redakkan on 2012-03-20 07:13:53 EDT ---

imagefactory log:

2012-03-20 07:12:54,557 ERROR imgfac.rest.imagefactory thread(worker 6) Message: 'template' must be a UUID, URL, XML string or XML document path...
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/imgfac/rest/imagefactory.py", line 191, in push_image
    job = BuildDispatcher().push_image_to_providers(image_id, build_id, (provider, ), credentials)[0]
  File "/usr/lib/python2.6/site-packages/imgfac/BuildDispatcher.py", line 83, in push_image_to_providers
    job = job_cls(template, target, image_id, build_id, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/imgfac/BuildJob.py", line 49, in __init__
    self.template = template if isinstance(template, Template) else Template(template)
  File "/usr/lib/python2.6/site-packages/imgfac/Template.py", line 79, in __init__
    raise ValueError("'template' must be a UUID, URL, XML string or XML document path...")
ValueError: 'template' must be a UUID, URL, XML string or XML document path...
2012-03-20 07:12:54,573 ERROR imgfac.rest.imagefactory thread(worker 6) Message: HTTP Response 500
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/imgfac/rest/imagefactory.py", line 212, in create_provider_image
    return push_image(image_id, build_id, target_image_id)
  File "/usr/lib/python2.6/site-packages/imgfac/rest/imagefactory.py", line 60, in decorated_function
    return f(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/imgfac/rest/imagefactory.py", line 202, in push_image
    raise HTTPResponse(status=500, output=e)
HTTPResponse: HTTP Response 500

--- Additional comment from dajohnso on 2012-08-09 11:48:19 EDT ---

*** Bug 845594 has been marked as a duplicate of this bug. ***

--- Additional comment from morazi on 2012-08-09 12:06:00 EDT ---

It looks like we should address this by not allowing the provider name to change.

Comment 1 Jozef Zigmund 2012-08-15 11:31:08 UTC
This bug isn't caused by Conductor. It's a bug in imagefactory. It's not clear from log above. In fact whole error is starting with WARNING like here:

2012-08-14 22:30:57,199 WARNING imgfac.BuildDispatcher.BuildDispatcher thread(worker 6) Message: No matching provider found for rhevm, using "condorcloud" by default.
2012-08-14 22:30:57,200 DEBUG imgfac.ImageWarehouse.ImageWarehouse thread(worker 6) Message: Querying (http://localhost:9090/target_images/_query) with expression ($build == "efcd1996-1ac1-4f87-9d69-dfe1f45efa99" && $target == "condorcloud")

after then it continues:


2012-08-14 22:30:57,202 DEBUG imgfac.ImageWarehouse.ImageWarehouse thread(worker 6) Message: Image Warehouse returned status (404) with message: 
2012-08-14 22:30:57,202 DEBUG imgfac.ImageWarehouse.ImageWarehouse thread(worker 6) Message: Getting metadata (['template']) from http://localhost:9090/target_images/None
2012-08-14 22:30:57,205 DEBUG imgfac.ImageWarehouse.ImageWarehouse thread(worker 6) Message: Image Warehouse returned status (404) with message: 
2012-08-14 22:30:57,205 DEBUG imgfac.ImageWarehouse.ImageWarehouse thread(worker 6) Message: Created Image Warehouse instance http://localhost:9090 - buckets(target_images, templates, icicles, provider_images)
2012-08-14 22:30:57,205 ERROR imgfac.rest.imagefactory thread(worker 6) Message: 'template' must be a UUID, URL, XML string or XML document path...
Traceback (most recent call last):

and so on...

The credentials to the RHEVM provider are comming from /etc/imagefactory/rhevm.json where are defined "rhevm-default", that has been created with aeolus-configure.

I'd like to notice that also for ec2 provider must provider name starts with "ec2-", for "rackspace" only this string.

Comment 2 Angus Thomas 2012-08-15 12:28:01 UTC
Jozef's comments above are valid. However, the intention is to disable changing provider names in Conductor as a temporary solution, to avoid people triggering the bug.

Work on the "proper" solution will be tracked in #804926

Comment 3 Jozef Zigmund 2012-08-20 14:50:04 UTC
We have 2 ways how to do 'short-term' fix.

1) Disable to update of provider name

We will add before_update callback to prevent updating the provider name.

Pros:
- easy fix

Cons:
- for upstream, it can be anoying to find out that provider name must be different (after setting up all things (provider accounts, hardware profiles, realms, permissions) for pushing image). The user would must to remove provider and create it again with all things that he set up before.

2) Validation before creating or updating the provider name

We will add before_save callback, where we can check if the provider has right name and user could push image to it. If callback fails, then conductor will show flash message that provider name cannot be updated, because of incompatible name.

Pros:
- we will avoid the cons of 1) solution

Cons:
- a bit longer fix as in 1) solution .. actually we will implement the same way how imagefactory validates provider name

I'll vote for 2nd solution.. what do you think about?

Comment 4 Scott Seago 2012-08-28 03:17:41 UTC
Another vote for the second solution. The problem isn't _editing_ of the provider name, the problem is _setting_ the name to something that doesn't match what imagefactory expects. A user could just as well hit the problem on creation, setting the wrong name - and if we did the first solution, our "fix" would not let the user update the name to the correct value.

Comment 5 Jozef Zigmund 2012-09-06 14:39:06 UTC
Bugfix was post to the mailing list

https://lists.fedorahosted.org/pipermail/aeolus-devel/2012-September/012475.html

Comment 6 Tzu-Mainn Chen 2012-09-06 15:33:47 UTC
ACK'd and pushed to master:

commit e518009e9be2e5176a0344a33885f177dec0b393
Author: Jozef Zigmund <jzigmund>
Date:   Thu Sep 6 11:07:35 2012 -0400

    BZ 847798 - fix provider names in tests
    
    Signed-off-by: Tzu-Mainn Chen <tzumainn>

commit 299f4f3748825f829e2f45c27f5bcd3d24587459
Author: Jozef Zigmund <jzigmund>
Date:   Thu Sep 6 11:07:33 2012 -0400

    This is short-term fix. It prevents setting of provider name,
    that causes failing image push in imagefactory.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=847798
    
    Signed-off-by: Tzu-Mainn Chen <tzumainn>

Comment 7 Steve Linabery 2012-09-07 21:55:50 UTC
in build aeolus-conductor-0.13.3-1.el6cf

Comment 9 Rehana 2012-09-26 10:22:06 UTC
Retested, Observed that user is still allowed to edit the cloud provider's name and push all operation shows the same error .

moving in to assigned

rpm -qa | grep aeolus
aeolus-conductor-doc-0.13.14-1.el6cf.noarch
rubygem-aeolus-image-0.3.0-12.el6.noarch
aeolus-all-0.13.14-1.el6cf.noarch
aeolus-conductor-0.13.14-1.el6cf.noarch
rubygem-aeolus-cli-0.7.2-1.el6cf.noarch
aeolus-configure-2.8.7-1.el6cf.noarch
aeolus-conductor-daemons-0.13.14-1.el6cf.noarch

Comment 10 Mike Orazi 2012-10-10 14:25:35 UTC
Per Dave I'd like to get this retested and see if those only applies to specific providers.

Comment 11 Shveta 2012-10-11 00:33:19 UTC
Created attachment 625261 [details]
Edit Provider name not allowed if not in config file

I am not able to edit and change the provider name to something 
which imagefactory doesnt expects.

rpm -qa|grep aeolus
aeolus-conductor-0.13.18-1.el6cf.noarch
aeolus-conductor-daemons-0.13.18-1.el6cf.noarch
aeolus-configure-2.8.9-1.el6cf.noarch
aeolus-all-0.13.18-1.el6cf.noarch
rubygem-aeolus-image-0.3.0-12.el6.noarch
aeolus-conductor-doc-0.13.18-1.el6cf.noarch
rubygem-aeolus-cli-0.7.4-1.el6cf.noarch

Comment 12 Shveta 2012-10-11 00:34:38 UTC
Created attachment 625262 [details]
edit provider

Comment 14 errata-xmlrpc 2012-12-04 15:16:05 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-1516.html