ctl and cmp upgrade add-ons

Change-Id: Id7b8178ad5527f426c4dece160302f32038a9ece
diff --git a/openstack-compute-upgrade.groovy b/openstack-compute-upgrade.groovy
index 33e0825..fe7f471 100644
--- a/openstack-compute-upgrade.groovy
+++ b/openstack-compute-upgrade.groovy
@@ -110,7 +110,7 @@
         }
 
         command = "cmd.run"
-        args = "apt-get -y -q --allow-downgrades -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" dist-upgrade"
+        args = "'DEBIAN_FRONTEND=noninteractive'; apt-get -y -q --allow-downgrades -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" dist-upgrade"
 
         stage('Apply package upgrades on sample') {
             out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveSubset, 'type': 'compound'], command, null, args, commandKwargs)
@@ -132,37 +132,33 @@
                 out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveSubset, 'type': 'compound'], command, null, args, commandKwargs)
                 salt.printSaltCommandResult(out)
             }
-            stage("Run salt states on sample nodes and reboot them") {
+            stage("Run salt states on sample nodes") {
                 salt.enforceState(saltMaster, targetLiveSubset, ['nova', 'neutron'])
-                try {
-                    salt.runSaltProcessStep(saltMaster, targetLiveSubset, 'system.reboot', null, null, true, 5)
-                } catch (Exception er) {
-                    common.infoMsg("The following nodes did not return anything because they were rebooted: ${targetLiveSubset}")
-                }
+                //salt.enforceHighstate(saltMaster, targetLiveAll)
             }
         } else {
             stage("Run salt states on sample nodes") {
-                salt.enforceState(saltMaster, targetLiveSubset, ['nova'])
-                salt.enforceState(saltMaster, targetLiveSubset, 'linux.system.repo')
+                salt.enforceState(saltMaster, targetLiveSubset, ['nova', 'linux.system.repo'])
+                //salt.enforceHighstate(saltMaster, targetLiveAll)
             }
         }
 
-        stage('Confirm upgrade on all nodes') {
+        stage('Confirm upgrade on all targeted nodes') {
             timeout(time: 2, unit: 'HOURS') {
                input message: "Verify that the upgraded sample nodes are working correctly. If so, do you want to approve live upgrade on ${targetLiveAll} nodes?"
             }
         }
 
         if(opencontrail != null) { 
-            stage('Remove OC component from repos on sample nodes') {
+            stage('Remove OC component from repos on all targeted nodes') {
                 salt.cmdRun(saltMaster, targetLiveAll, "find /etc/apt/sources.list* -type f -print0 | xargs -0 sed -i -r -e 's/ oc([0-9]*) / /g'")
                 salt.runSaltProcessStep(saltMaster, targetLiveAll, 'pkg.refresh_db', [], null, true)
             }
         }
 
-        args = "apt-get -y -q --allow-downgrades -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" dist-upgrade"
+        args = "'DEBIAN_FRONTEND=noninteractive'; apt-get -y -q --allow-downgrades -o Dpkg::Options::=\"--force-confdef\" -o Dpkg::Options::=\"--force-confold\" dist-upgrade"
 
-        stage('Apply package upgrades on all nodes') {
+        stage('Apply package upgrades on all targeted nodes') {
             out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveAll, 'type': 'compound'], command, null, args, commandKwargs)
             salt.printSaltCommandResult(out)
         }
@@ -170,22 +166,18 @@
         if(openvswitch != null) {
             args = "sudo /usr/share/openvswitch/scripts/ovs-ctl start"
 
-            stage('Start ovs on sample nodes') {
+            stage('Start ovs on all targeted nodes') {
                 out = salt.runSaltCommand(saltMaster, 'local', ['expression': targetLiveAll, 'type': 'compound'], command, null, args, commandKwargs)
                 salt.printSaltCommandResult(out)
             }
-            stage("Run salt states on sample nodes and reboot them") {
+            stage("Run salt states on all targeted nodes") {
                 salt.enforceState(saltMaster, targetLiveAll, ['nova', 'neutron'])
-                try {
-                    salt.runSaltProcessStep(saltMaster, targetLiveAll, 'system.reboot', null, null, true, 5)
-                } catch (Exception er) {
-                    common.infoMsg("The following nodes did not return anything because they were rebooted: ${targetLiveAll}")
-                }
+                //salt.enforceHighstate(saltMaster, targetLiveAll)
             }
         } else {
-            stage("Run salt states on sample nodes") {
-                salt.enforceState(saltMaster, targetLiveAll, ['nova'])
-                salt.enforceState(saltMaster, targetLiveAll, 'linux.system.repo')
+            stage("Run salt states on all targeted nodes") {
+                salt.enforceState(saltMaster, targetLiveAll, ['nova', 'linux.system.repo'])
+                //salt.enforceHighstate(saltMaster, targetLiveAll)
             }
         }
 
@@ -196,4 +188,3 @@
     }
 }
 
-
diff --git a/openstack-control-upgrade.groovy b/openstack-control-upgrade.groovy
index bff17f1..a16a60e 100644
--- a/openstack-control-upgrade.groovy
+++ b/openstack-control-upgrade.groovy
@@ -437,6 +437,9 @@
 
                     // salt 'cmp*' cmd.run 'service nova-compute restart'
                     salt.runSaltProcessStep(saltMaster, 'cmp*', 'service.restart', ['nova-compute'], null, true)
+                    salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['nova-conductor'], null, true)
+                    salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['nova-scheduler'], null, true)
+
 
                     // salt 'prx*' state.sls linux,openssh,salt.minion,ntp,rsyslog
                     // salt 'ctl*' state.sls keepalived
@@ -557,6 +560,9 @@
 
                 sleep(70)
 
+                salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['nova-conductor'], null, true)
+                salt.runSaltProcessStep(saltMaster, 'ctl*', 'service.restart', ['nova-scheduler'], null, true)
+
                 salt.cmdRun(saltMaster, 'ctl01*', '. /root/keystonerc; nova service-list; glance image-list; nova flavor-list; nova hypervisor-list; nova list; neutron net-list; cinder list; heat service-list')
             }
         }