Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2006
    Posts
    63

    Unanswered: Why I have to create 2 scripts

    Hi all,

    Running follow command on terminal;

    $ 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

    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
    Code:
    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
    Code:
    ......
    ......
    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:
    Code:
    nova-setup.sh
    start-openstack.sh
    script02:
    Code:
    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

  2. #2
    Join Date
    Feb 2006
    Posts
    173
    Provided Answers: 1
    It seems like you have run into a timing problem, where the 'glance' server is not up and ready by the time you run the 'glance' command.
    You could do some testing and put a sleep command before your first 'glance' command so your script would pause for 15 seconds or how many seconds it would take you to type the command manually, also check out the info at this link: Welcome to Glance?s documentation! &mdash; Glance v2012.2-dev documentation

  3. #3
    Join Date
    Jun 2006
    Posts
    63
    Quote Originally Posted by spacebar View Post
    It seems like you have run into a timing problem, where the 'glance' server is not up and ready by the time you run the 'glance' command.
    You could do some testing and put a sleep command before your first 'glance' command so your script would pause for 15 seconds or how many seconds it would take you to type the command manually, also check out the info at this link: Welcome to Glance?s documentation! &mdash; Glance v2012.2-dev documentation
    Hi,

    Your advice works here.

    $ cat /mnt/script.sh
    Code:
    nova-setup.sh
    
    start-openstack.sh
    
    sleep 10
    
    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
    After having added "sleep 10" after "start-openstack.sh" complaint stops.

    Thanks

    B.R.
    satimis

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •