Bug 700811

Summary: image push fails when trying to ssh into image after it just shutdown
Product: [Retired] CloudForms Cloud Engine Reporter: Dave Johnson <dajohnso>
Component: imagefactoryAssignee: Ian McLeod <imcleod>
Status: CLOSED CURRENTRELEASE QA Contact: Dave Johnson <dajohnso>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 0.3.1CC: cpelland, dajohnso, deltacloud-maint, ssachdev, whayutin
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-02 11:07:46 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:

Description Dave Johnson 2011-04-29 13:27:39 UTC
Description of problem:

Try to build/push a f13 jeos image and I found it hitting the following exception.  I ran it a few times and it is just as the log snippet shows, it shuts the image down and then tries to SSH into it, fail. :)


2011-04-29 09:22:49,099 DEBUG boto pid(5049) Message: <?xml version="1.0" encoding="UTF-8"?>
<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/">
    <requestId>7e4d4832-e4fe-4c34-a9e3-54bcdf8b6fa7</requestId>
    <instancesSet>
        <item>
            <instanceId>i-80507eef</instanceId>
            <currentState>
                <code>32</code>
                <name>shutting-down</name>
            </currentState>
            <previousState>
                <code>16</code>
                <name>running</name>
            </previousState>
        </item>
    </instancesSet>
</TerminateInstancesResponse>
2011-04-29 09:22:49,100 DEBUG imagefactory.builders.BaseBuilder.FedoraBuilder pid(5049) Message: Exception during push_image
2011-04-29 09:22:49,100 DEBUG imagefactory.builders.BaseBuilder.FedoraBuilder pid(5049) Message: Unexpected error: (<class 'oz.OzException.OzException'>)
2011-04-29 09:22:49,100 DEBUG imagefactory.builders.BaseBuilder.FedoraBuilder pid(5049) Message:              value: ('ssh -i /etc/oz/id_rsa-icicle-gen -o ServerAliveInterval=30 -o StrictHostKeyChecking=no -o ConnectTimeout=5 -o UserKnownHostsFile=/dev/null root.amazonaws.com [ -f /etc/init.d/firstboot ] && /sbin/chkconfig firstboot off' failed(1): Warning: Permanently added 'ec2-50-16-54-106.compute-1.amazonaws.com,50.16.54.106' (RSA) to the list of known hosts.
)
2011-04-29 09:22:49,101 DEBUG imagefactory.builders.BaseBuilder.FedoraBuilder pid(5049) Message:          traceback: ['  File "/usr/lib/python2.6/site-packages/imagefactory/builders/FedoraBuilder.py", line 409, in push_image\n    self.push_image_snapshot(image_id, provider, credentials)\n', '  File "/usr/lib/python2.6/site-packages/imagefactory/builders/FedoraBuilder.py", line 585, in push_image_snapshot\n    self.guest.guest_execute_command(guestaddr, "[ -f /etc/init.d/firstboot ] && /sbin/chkconfig firstboot off")\n', '  File "/usr/lib/python2.6/site-packages/oz/RedHat.py", line 311, in guest_execute_command\n    "root@" + guestaddr, command])\n', '  File "/usr/lib/python2.6/site-packages/oz/Guest.py", line 72, in subprocess_check_output\n    raise OzException.OzException("\'%s\' failed(%d): %s" % (cmd, retcode, stderr))\n']
2011-04-29 09:22:49,101 DEBUG imagefactory.qmfagent.BuildAdaptor.BuildAdaptor pid(5049) Message: Raising event with agent handler (<ImageFactoryAgent(Thread-1, initial)>), changed status from PUSHING to FAILED




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


How reproducible:


Steps to Reproduce:
1.  build/push template
2.  watch /var/log/imagefactory.log
3.

Comment 1 Shveta 2011-05-02 09:32:05 UTC
In order to push templates to EC2, you need to
modify /usr/lib/python2.6/site-packages/imagefactory/builders/FedoraBuilder.py

Line 585...
This:
----------------------
self.guest.guest_execute_command(guestaddr,
"[ -f /etc/init.d/firstboot ] && /sbin/chkconfig firstboot off")

To:
----------------------
self.guest.guest_execute_command(guestaddr,
"[ -f /etc/init.d/firstboot ] && /sbin/chkconfig firstboot off
|| /bin/true")

=======================================

After making the above change , i got an instance running and could ssh into it.
However , the name of ssh key that is downloaded and the one which amazon account shows are different.
Can't we download the key with the same name ?

Comment 2 wes hayutin 2011-05-02 11:07:46 UTC

*** This bug has been marked as a duplicate of bug 698689 ***

Comment 3 wes hayutin 2011-12-08 14:16:42 UTC
perm close