mirror of
				https://github.com/vdsm/virtual-dsm.git
				synced 2025-11-04 17:04:52 +08:00 
			
		
		
		
	_QEMU_PID
_QEMU_PID
This commit is contained in:
		
						commit
						40d8dd1891
					
				
							
								
								
									
										15
									
								
								run/power.sh
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								run/power.sh
									
									
									
									
									
								
							@ -21,6 +21,7 @@ _trap(){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
_graceful_shutdown() {
 | 
					_graceful_shutdown() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  [ ! -f "${_QEMU_PID}" ] && return
 | 
				
			||||||
  [ -f "${_QEMU_SHUTDOWN_COUNTER}" ] && return
 | 
					  [ -f "${_QEMU_SHUTDOWN_COUNTER}" ] && return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  set +e
 | 
					  set +e
 | 
				
			||||||
@ -45,18 +46,20 @@ _graceful_shutdown(){
 | 
				
			|||||||
    AGENT="${STORAGE}/${BASE}.agent"
 | 
					    AGENT="${STORAGE}/${BASE}.agent"
 | 
				
			||||||
    [ -f "$AGENT" ] && AGENT_VERSION=$(cat "${AGENT}") || AGENT_VERSION=1
 | 
					    [ -f "$AGENT" ] && AGENT_VERSION=$(cat "${AGENT}") || AGENT_VERSION=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((AGENT_VERSION < 2)); then
 | 
					    if ((AGENT_VERSION > 1)); then
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      # Send a NMI interrupt which will be detected by the kernel
 | 
				
			||||||
 | 
					      echo 'nmi' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      echo
 | 
					      echo
 | 
				
			||||||
      echo "Please update the VirtualDSM Agent to allow gracefull shutdowns..."
 | 
					      echo "Please update the VirtualDSM Agent to allow gracefull shutdowns..."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      PID=$(cat "${_QEMU_PID}")
 | 
				
			||||||
 | 
					      kill -15 "${PID}"
 | 
				
			||||||
      pkill -f qemu-system-x86_64
 | 
					      pkill -f qemu-system-x86_64
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
      # Send a NMI interrupt which will be detected by the kernel
 | 
					 | 
				
			||||||
      echo 'nmi' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user