Problem on running a script

Hi all,

Running follow command on terminal;

$ glance -T cloudlive -I ubuntu -K ubuntu123 -N \
http://127.0.0.1:5000/v2.0/OpenX add name="cirros" is_public=true \
container_format=ovf disk_format=raw < \
/srv/cirros-0.3.0-x86_64-disk.img

It works without problem.

Putting it on a script file together with other commands, it doesn't work properly

performed following steps on terminal:-

$ sudo mount /dev/sda /mnt
$ nano /mnt/script.sh
nova-setup.sh

start-openstack.sh

glance -T cloudlive -I ubuntu -K ubuntu123 -N http://127.0.0.1:5000/v2.0/ add name="cirros" is_public=true container_format=ovf disk_format=raw < /srv/cirros-0.3.0-x86_64-disk.img    # one line

wget http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img

glance -T cloudlive -I ubuntu -K ubuntu123 -N http://127.0.0.1:5000/v2.0/ add name="precise-server-amd64" is_public="true" disk_format=raw container_format=ovf < precise-server-cloudimg-amd64-disk1.img   # one line

exit 0
$ sudo chmod +x /mnt/script.sh
$ /mnt/script.sh
......
......
Failed to connect to the Glance API server 0.0.0.0:9292. Is the server running?
--2012-06-22 15:17:09-- http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img
    Resolving uec-images.ubuntu.com (uec-images.ubuntu.com)... 91.189.88.140
    Connecting to uec-images.ubuntu.com (uec-images.ubuntu.com)|91.189.88.140|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 230621184 (220M) [application/octet-stream]
    Saving to: `precise-server-cloudimg-amd64-disk1.img'

Finally I have to create 2 scripts

script01:

nova-setup.sh
start-openstack.sh

script02:

glance -T cloudlive -I ubuntu -K ubuntu123 -N http://127.0.0.1:5000/v2.0/ add name="cirros" is_public=true container_format=ovf disk_format=raw < /srv/cirros-0.3.0-x86_64-disk.img    # one line

wget http://uec-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img

glance -T cloudlive -I ubuntu -K ubuntu123 -N http://127.0.0.1:5000/v2.0/ add name="precise-server-amd64" is_public="true" disk_format=raw container_format=ovf < precise-server-cloudimg-amd64-disk1.img   # one line

Run them one by one. Them it works without complaint.

Pls help me to understand why they can't be in one script? Is there any solution? TIA

B.R.
satimis

In the first first commands, you are using:

http://127.0.0.1:5000/v2.0/OpenX

Whereas later on you are using:

http://127.0.0.1:5000/v2.0/

Could that make a difference?

Hi,

It makes no difference. Just tried;

$ glance -T cloudlive -I ubuntu -K ubuntu123 -N \
> OpenX add name="cirros" is_public=true \
> container_format=ovf disk_format=raw < \
> /srv/cirros-0.3.0-x86_64-disk.img

Uploading image 'cirros'
=================================================[100%] 23.1M/s, ETA  0h  0m  0s
Added new image with ID: 22ad7d44-eb84-46ab-be0b-243269fd0c45

Adding /OpenX on the script it still complained.

B.R.
satimis

Try creating an extra script that contains:

./script01
./script02

and run that. Does that have the same problem?

If so, see if putting a sleep 10 between start-openstack.sh and the glance statement makes a difference.
If it does, then you can lower 10 seconds to a lower number..

Yes, problem has been solved by adding

sleep 10

after;

start-openstack.sh

Thanks

satimis

Thanks for the feedback, satimis...