mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Don't depend on static paths especially if we are already checking that
location using the getResource call.
This commit is contained in:
		
							parent
							
								
									ae4d49810e
								
							
						
					
					
						commit
						328599ae0b
					
				| @ -18,6 +18,25 @@ | |||||||
| // Automatically generated by addcopyright.py at 01/29/2013 | // Automatically generated by addcopyright.py at 01/29/2013 | ||||||
| package com.cloud.baremetal.networkservice; | package com.cloud.baremetal.networkservice; | ||||||
| 
 | 
 | ||||||
|  | import java.io.File; | ||||||
|  | import java.net.URI; | ||||||
|  | import java.net.URL; | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.Arrays; | ||||||
|  | import java.util.HashMap; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  | 
 | ||||||
|  | import javax.ejb.Local; | ||||||
|  | import javax.inject.Inject; | ||||||
|  | 
 | ||||||
|  | import org.apache.log4j.Logger; | ||||||
|  | 
 | ||||||
|  | import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd; | ||||||
|  | import org.apache.cloudstack.api.AddBaremetalPxeCmd; | ||||||
|  | import org.apache.cloudstack.api.ListBaremetalPxeServersCmd; | ||||||
|  | import org.apache.cloudstack.framework.config.dao.ConfigurationDao; | ||||||
|  | 
 | ||||||
| import com.cloud.agent.api.Answer; | import com.cloud.agent.api.Answer; | ||||||
| import com.cloud.agent.api.baremetal.IpmISetBootDevCommand; | import com.cloud.agent.api.baremetal.IpmISetBootDevCommand; | ||||||
| import com.cloud.agent.api.baremetal.IpmISetBootDevCommand.BootDev; | import com.cloud.agent.api.baremetal.IpmISetBootDevCommand.BootDev; | ||||||
| @ -60,23 +79,6 @@ import com.cloud.vm.ReservationContext; | |||||||
| import com.cloud.vm.VirtualMachineProfile; | import com.cloud.vm.VirtualMachineProfile; | ||||||
| import com.cloud.vm.dao.DomainRouterDao; | import com.cloud.vm.dao.DomainRouterDao; | ||||||
| import com.cloud.vm.dao.NicDao; | import com.cloud.vm.dao.NicDao; | ||||||
| import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd; |  | ||||||
| import org.apache.cloudstack.api.AddBaremetalPxeCmd; |  | ||||||
| import org.apache.cloudstack.api.ListBaremetalPxeServersCmd; |  | ||||||
| import org.apache.cloudstack.framework.config.dao.ConfigurationDao; |  | ||||||
| import org.apache.log4j.Logger; |  | ||||||
| import org.springframework.web.util.UriComponentsBuilder; |  | ||||||
| 
 |  | ||||||
| import javax.ejb.Local; |  | ||||||
| import javax.inject.Inject; |  | ||||||
| import java.io.File; |  | ||||||
| import java.net.URI; |  | ||||||
| import java.net.URL; |  | ||||||
| import java.util.ArrayList; |  | ||||||
| import java.util.Arrays; |  | ||||||
| import java.util.HashMap; |  | ||||||
| import java.util.List; |  | ||||||
| import java.util.Map; |  | ||||||
| 
 | 
 | ||||||
| @Local(value = BaremetalPxeService.class) | @Local(value = BaremetalPxeService.class) | ||||||
| public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase implements BaremetalPxeService { | public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase implements BaremetalPxeService { | ||||||
| @ -163,12 +165,9 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple | |||||||
|         if (url != null) { |         if (url != null) { | ||||||
|             keyFile = new File(url.getPath()); |             keyFile = new File(url.getPath()); | ||||||
|         } |         } | ||||||
|         if (keyFile == null || !keyFile.exists()) { |         if (keyFile == null || !keyFile.canRead()) { | ||||||
|             keyFile = new File("/usr/share/cloudstack-common/scripts/vm/systemvm/id_rsa.cloud"); |             s_logger.error("Unable to locate id_rsa.cloud"); | ||||||
|         } |             return null; | ||||||
|         assert (keyFile != null); |  | ||||||
|         if (!keyFile.exists()) { |  | ||||||
|             s_logger.error("Unable to locate id_rsa.cloud in your setup at " + keyFile.toString()); |  | ||||||
|         } |         } | ||||||
|         return keyFile; |         return keyFile; | ||||||
|     } |     } | ||||||
| @ -204,15 +203,6 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple | |||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private URI buildUrl(String mgmtIp, String subPath) { |  | ||||||
|         UriComponentsBuilder ub = UriComponentsBuilder.newInstance(); |  | ||||||
|         ub.scheme("http"); |  | ||||||
|         ub.scheme(mgmtIp); |  | ||||||
|         ub.port(10086); |  | ||||||
|         ub.path(subPath); |  | ||||||
|         return ub.build().toUri(); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     private boolean preparePxeInAdvancedZone(VirtualMachineProfile profile, NicProfile nic, Network network, DeployDestination dest, ReservationContext context) throws Exception { |     private boolean preparePxeInAdvancedZone(VirtualMachineProfile profile, NicProfile nic, Network network, DeployDestination dest, ReservationContext context) throws Exception { | ||||||
|         DomainRouterVO vr = getVirtualRouter(network); |         DomainRouterVO vr = getVirtualRouter(network); | ||||||
|         List<NicVO> nics = _nicDao.listByVmId(vr.getId()); |         List<NicVO> nics = _nicDao.listByVmId(vr.getId()); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user