mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-11-04 00:02:37 +01:00 
			
		
		
		
	bug 8264: "cp" is faster than "qemu-img convert" when copying template from secondary to primary
status 8264: resolved fixed
This commit is contained in:
		
							parent
							
								
									c51e68a2d5
								
							
						
					
					
						commit
						4f3d492366
					
				@ -45,6 +45,8 @@ public class KVMGuestOsMapper {
 | 
			
		||||
		s_mapper.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5.4");
 | 
			
		||||
		s_mapper.put("Red Hat Enterprise Linux 5.5 (32-bit)", "Red Hat Enterprise Linux 5.5");
 | 
			
		||||
		s_mapper.put("Red Hat Enterprise Linux 5.5 (64-bit)", "Red Hat Enterprise Linux 5.5");
 | 
			
		||||
		s_mapper.put("Red Hat Enterprise Linux 6.0 (32-bit)", "Red Hat Enterprise Linux 6.0");
 | 
			
		||||
		s_mapper.put("Red Hat Enterprise Linux 6.0 (64-bit)", "Red Hat Enterprise Linux 6.0");
 | 
			
		||||
		s_mapper.put("Fedora 13", "Fedora 13");
 | 
			
		||||
		s_mapper.put("Fedora 12", "Fedora 12");
 | 
			
		||||
		s_mapper.put("Fedora 11", "Fedora 11");
 | 
			
		||||
 | 
			
		||||
@ -1834,7 +1834,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	protected Answer execute(StopCommand cmd) {
 | 
			
		||||
	    StopAnswer answer = null;
 | 
			
		||||
        final String vmName = cmd.getVmName();
 | 
			
		||||
        
 | 
			
		||||
        Long bytesReceived = new Long(0);
 | 
			
		||||
@ -1854,14 +1853,16 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
 | 
			
		||||
            if (result != null && result2 != null) {
 | 
			
		||||
                result = result2 + result;
 | 
			
		||||
            }
 | 
			
		||||
            
 | 
			
		||||
            state = State.Stopped;
 | 
			
		||||
            return new StopAnswer(cmd, result, 0, bytesSent, bytesReceived);
 | 
			
		||||
        } catch (LibvirtException e) {
 | 
			
		||||
        	return new StopAnswer(cmd, e.getMessage());
 | 
			
		||||
        } finally {
 | 
			
		||||
            if (answer == null || !answer.getResult()) {
 | 
			
		||||
                synchronized(_vms) {
 | 
			
		||||
            synchronized(_vms) {
 | 
			
		||||
                if (state != null) {
 | 
			
		||||
                    _vms.put(vmName, state);
 | 
			
		||||
                } else {
 | 
			
		||||
                    _vms.remove(vmName);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -335,17 +335,11 @@ public class LibvirtStorageResource {
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public StorageVol copyVolume(StoragePool destPool, LibvirtStorageVolumeDef destVol, StorageVol srcVol) throws LibvirtException {
 | 
			
		||||
        if (_computingResource.isCentosHost()) {
 | 
			
		||||
            /*define a volume, then override the file*/
 | 
			
		||||
            
 | 
			
		||||
            StorageVol vol = destPool.storageVolCreateXML(destVol.toString(), 0);
 | 
			
		||||
            String srcPath = srcVol.getKey();
 | 
			
		||||
            String destPath = vol.getKey();
 | 
			
		||||
            Script.runSimpleBashScript("cp " + srcPath + " " + destPath );
 | 
			
		||||
            return vol;
 | 
			
		||||
        } else {
 | 
			
		||||
            return destPool.storageVolCreateXMLFrom(destVol.toString(), srcVol, 0);
 | 
			
		||||
        }
 | 
			
		||||
        StorageVol vol = destPool.storageVolCreateXML(destVol.toString(), 0);
 | 
			
		||||
        String srcPath = srcVol.getKey();
 | 
			
		||||
        String destPath = vol.getKey();
 | 
			
		||||
        Script.runSimpleBashScript("cp " + srcPath + " " + destPath );
 | 
			
		||||
        return vol;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public LibvirtStoragePoolDef getStoragePoolDef(Connect conn, StoragePool pool) throws LibvirtException {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user