mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	scripts: fix external provision to use correct power state & hyperv powersync (#11504)
* scripts: fix external provision to use correct power state The valid states are poweron and poweroff. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> * strip string while processing powerstate for HyperV Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> * ignore warning that spills over to exten output string Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> --------- Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
		
							parent
							
								
									e5e902a320
								
							
						
					
					
						commit
						5da7d2d01e
					
				| @ -16,6 +16,9 @@ | ||||
| # specific language governing permissions and limitations | ||||
| # under the License. | ||||
| 
 | ||||
| import warnings | ||||
| warnings.filterwarnings('ignore') | ||||
| 
 | ||||
| import json | ||||
| import sys | ||||
| import winrm | ||||
| @ -200,12 +203,11 @@ class HyperVManager: | ||||
|     def status(self): | ||||
|         command = f'(Get-VM -Name "{self.data["vmname"]}").State' | ||||
|         state = self.run_ps(command) | ||||
|         if state.lower() == "running": | ||||
|             power_state = "poweron" | ||||
|         elif state.lower() == "off": | ||||
|             power_state = "poweroff" | ||||
|         else: | ||||
|         power_state = "unknown" | ||||
|         if state.strip().lower() == "running": | ||||
|             power_state = "poweron" | ||||
|         elif state.strip().lower() == "off": | ||||
|             power_state = "poweroff" | ||||
|         succeed({"status": "success", "power_state": power_state}) | ||||
| 
 | ||||
|     def delete(self): | ||||
|  | ||||
| @ -96,7 +96,7 @@ reboot() { | ||||
| 
 | ||||
| status() { | ||||
|     parse_json "$1" || exit 1 | ||||
|     echo '{"status": "success", "power_state": "running"}' | ||||
|     echo '{"status": "success", "power_state": "poweron"}' | ||||
| } | ||||
| 
 | ||||
| action=$1 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user