Github user karuturi commented on the pull request:

    https://github.com/apache/cloudstack/pull/959#issuecomment-149880745
  
    Agree.
    
    -----Original Message-----
    From: "Wilder Rodrigues" <notificati...@github.com>
    Sent: ‎21-‎10-‎15 13:22
    To: "apache/cloudstack" <cloudst...@noreply.github.com>
    Cc: "Rajani Karuturi" <rajanikarut...@gmail.com>
    Subject: Re: [cloudstack] CLOUDSTACK-8933 SSVm and CPVM do not survive 
areboot from API (#959)
    
    @karuturi @remibergsma 
    In the previous PR it was mentioned that looping 30 times would probably be 
enough to get the configuration done and also get rid of the infinite loop. I 
looked at the code and did not find any sleep or any sort of wait, so looping 
30 times will go quite fast:
    The block inside the for loop would be this one:
               while read line; do
                 if [[ $line == cmdline:* ]]; then
                   cmd=${line//cmdline:/}
                   echo $cmd > /var/cache/cloud/cmdline
                 elif [[ $line == pubkey:* ]]; then
                   pubkey=${line//pubkey:/}
                   echo $pubkey > /var/cache/cloud/authorized_keys
                   echo $pubkey > /root/.ssh/authorized_keys
                 fi
               done < /dev/vport0p1
               # In case of reboot we do not send the boot args again.
               # So, no need to wait for them, as the boot args are already set 
at startup
               if [ -s /var/cache/cloud/cmdline  ]
               then
                   log_it "Found a non empty cmdline file. Will now exit the 
loop and proceed with configuration."
                   break;
               fi
    If my assumption is right, about the 30 times loop, I would suggest to do 
it in a different way. For example:
    local factor=2
    local progress=1
    for i in {1..5}
    do
        #block mentioned above
        sleep ${progress}
        progress=$[ progress * factor]
    done
    In a worst case scenario we would wait 16 seconds before then leave the for 
loop.
    What do you think?
    Cheers,
    Wilder
    —
    Reply to this email directly or view it on GitHub.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to