mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	This PR marks the multipath scripts as executable.
This fixes the issue that in 4.19.0.0-RC2, vms can not be stopped in ubuntu hosts.
2024-01-17 12:56:26,061 ERROR [c.c.v.VmWorkJobHandlerProxy] (Work-Job-Executor-4:ctx-e3503563 job-38/job-39 ctx-42706275) (logid:81ede4e9) Invocation exception, caused by: com.cloud.utils.exception.CloudRuntimeException: Unable to stop the virtual machine due to java.lang.NullPointerException
        at com.cloud.utils.script.Script.getExitValue(Script.java:74)
        at com.cloud.hypervisor.kvm.storage.MultipathSCSIAdapterBase.runScript(MultipathSCSIAdapterBase.java:476)
        at com.cloud.hypervisor.kvm.storage.MultipathSCSIAdapterBase.disconnectPhysicalDiskByPath(MultipathSCSIAdapterBase.java:226)
        at com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager.disconnectPhysicalDiskByPath(KVMStoragePoolManager.java:205)
        at com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.cleanupDisk(LibvirtComputingResource.java:3335)
        at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtStopCommandWrapper.execute(LibvirtStopCommandWrapper.java:101)
        at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtStopCommandWrapper.execute(LibvirtStopCommandWrapper.java:49)
        at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRequestWrapper.execute(LibvirtRequestWrapper.java:78)
        at com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.executeRequest(LibvirtComputingResource.java:1903)
		
	
			
		
			
				
	
	
		
			71 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			71 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| # Licensed to the Apache Software Foundation (ASF) under one
 | |
| # or more contributor license agreements.  See the NOTICE file
 | |
| # distributed with this work for additional information
 | |
| # regarding copyright ownership.  The ASF licenses this file
 | |
| # to you under the Apache License, Version 2.0 (the
 | |
| # "License"); you may not use this file except in compliance
 | |
| # with the License.  You may obtain a copy of the License at
 | |
| #
 | |
| #   http://www.apache.org/licenses/LICENSE-2.0
 | |
| #
 | |
| # Unless required by applicable law or agreed to in writing,
 | |
| # software distributed under the License is distributed on an
 | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 | |
| # KIND, either express or implied.  See the License for the
 | |
| # specific language governing permissions and limitations
 | |
| # under the License.
 | |
| 
 | |
| notifyqemu() {
 | |
|   if `virsh help 2>/dev/null | grep -q blockresize`
 | |
|   then
 | |
|     if `virsh domstate $VMNAME >/dev/null 2>&1`
 | |
|     then
 | |
|       sizeinkb=$(($NEWSIZE/1024))
 | |
|       devicepath=$(virsh domblklist $VMNAME | grep ${WWID} | awk '{print $1}')
 | |
|       virsh blockresize --path $devicepath --size $sizeinkb ${VMNAME} >/dev/null 2>&1
 | |
|       retval=$?
 | |
|       if [ -z $retval ] || [ $retval -ne 0 ]
 | |
|       then
 | |
|         log "failed to live resize $path to size of $sizeinkb kb" 1
 | |
|       else
 | |
|         liveresize='true'
 | |
|       fi
 | |
|     fi
 | |
|   fi
 | |
| }
 | |
| 
 | |
| WWID=${1:?"WWID required"}
 | |
| VMNAME=${2:?"VMName required"}
 | |
| NEWSIZE=${3:?"New size required in bytes"}
 | |
| 
 | |
| WWID=$(echo $WWID | tr '[:upper:]' '[:lower:]')
 | |
| 
 | |
| export WWID VMNAME NEWSIZE
 | |
| 
 | |
| systemctl is-active multipathd || systemctl restart multipathd || {
 | |
|    echo "$(date): Multipathd is NOT running and cannot be started.  This must be corrected before this host can access this storage volume."
 | |
|    logger -t "CS_SCSI_VOL_RESIZE" "Unable to notify running VM of resize for ${WWID} because multipathd is not currently running and cannot be started"
 | |
|    exit 1
 | |
| }
 | |
| 
 | |
| logger -t "CS_SCSI_VOL_RESIZE" "${WWID} resizing disk path at /dev/mapper/3${WWID} STARTING"
 | |
| 
 | |
| for device in $(multipath -ll 3${WWID} | egrep '^  ' | awk '{print $2}'); do
 | |
|     echo "1" > /sys/bus/scsi/drivers/sd/${device}/rescan;
 | |
| done
 | |
| 
 | |
| sleep 3
 | |
| 
 | |
| multipathd reconfigure
 | |
| 
 | |
| sleep 3
 | |
| 
 | |
| multipath -ll 3${WWID}
 | |
| 
 | |
| notifyqemu
 | |
| 
 | |
| logger -t "CS_SCSI_VOL_RESIZE" "${WWID} resizing disk path at /dev/mapper/3${WWID} COMPLETE"
 | |
| 
 | |
| exit 0
 |