DaanHoogland commented on a change in pull request #5938:
URL: https://github.com/apache/cloudstack/pull/5938#discussion_r825720927



##########
File path: systemvm/debian/opt/cloud/bin/setup/bootstrap.sh
##########
@@ -83,8 +84,17 @@ config_guest() {
           if [ ! -f /usr/bin/xenstore-read ]; then
             log_it "ERROR: xentools not installed, cannot found xenstore-read" 
&& exit 5
           fi
-          /usr/bin/xenstore-read vm-data/cloudstack/init > $CMDLINE
-          sed -i "s/%/ /g" $CMDLINE
+          /usr/bin/xenstore-read vm-data/cloudstack/init |tr -d "\n$" > 
$CMDLINE_PASSED
+          if [ -s $CMDLINE_PASSED ]; then
+            log_it "Received a new non-empty cmdline file from 
qemu-guest-agent"
+            rm -rf $CMDLINE && mv $CMDLINE_PASSED $CMDLINE
+            # Remove old configuration files in /etc/cloudstack if VR is 
booted from cloudstack
+            rm -rf /etc/cloudstack/*.json
+            log_it "Booting from cloudstack, remove old configuration files in 
/etc/cloudstack/"

Review comment:
       ```suggestion
               log_it "Booting from cloudstack, removed old configuration files 
in /etc/cloudstack/"
   ```

##########
File path: systemvm/debian/opt/cloud/bin/setup/bootstrap.sh
##########
@@ -83,8 +84,17 @@ config_guest() {
           if [ ! -f /usr/bin/xenstore-read ]; then
             log_it "ERROR: xentools not installed, cannot found xenstore-read" 
&& exit 5
           fi
-          /usr/bin/xenstore-read vm-data/cloudstack/init > $CMDLINE
-          sed -i "s/%/ /g" $CMDLINE
+          /usr/bin/xenstore-read vm-data/cloudstack/init |tr -d "\n$" > 
$CMDLINE_PASSED
+          if [ -s $CMDLINE_PASSED ]; then
+            log_it "Received a new non-empty cmdline file from 
qemu-guest-agent"
+            rm -rf $CMDLINE && mv $CMDLINE_PASSED $CMDLINE
+            # Remove old configuration files in /etc/cloudstack if VR is 
booted from cloudstack
+            rm -rf /etc/cloudstack/*.json
+            log_it "Booting from cloudstack, remove old configuration files in 
/etc/cloudstack/"
+            break
+          else
+            sed -i "s/%/ /g" $CMDLINE
+          fi

Review comment:
       larger part of this block exists three times. maybe unify?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to