@@ -97,7 +97,7 @@ public class SystemVmTemplateRegistration {
9797 private static final String ABSOLUTE_TEMPLATE_PATH = "/usr/share/cloudstack-management/templates/systemvm/" ;
9898 private static final String TEMPLATES_PATH = fetchTemplatesPath ();
9999 private static final String METADATA_FILE_NAME = "metadata.ini" ;
100- protected static final String METADATA_FILE = TEMPLATES_PATH + METADATA_FILE_NAME ;
100+ private static final String METADATA_FILE = TEMPLATES_PATH + METADATA_FILE_NAME ;
101101 public static final String TEMPORARY_SECONDARY_STORE = "tmp" ;
102102 private static final String PARTIAL_TEMPLATE_FOLDER = String .format ("/template/tmpl/%d/" , Account .ACCOUNT_ID_SYSTEM );
103103 private static final String storageScriptsDir = "scripts/storage/secondary" ;
@@ -106,7 +106,7 @@ public class SystemVmTemplateRegistration {
106106 private static final Integer LINUX_7_ID = 183 ;
107107 private static final Integer SCRIPT_TIMEOUT = 1800000 ;
108108 private static final Integer LOCK_WAIT_TIMEOUT = 1200 ;
109- protected static final List <CPU .CPUArch > DOWNLOADABLE_TEMPLATE_ARCH_TYPES = Arrays .asList (
109+ private static final List <CPU .CPUArch > DOWNLOADABLE_TEMPLATE_ARCH_TYPES = Arrays .asList (
110110 CPU .CPUArch .arm64
111111 );
112112
@@ -173,10 +173,6 @@ public String getSystemVmTemplateVersion() {
173173 return systemVmTemplateVersion ;
174174 }
175175
176- public File getTempDownloadDir () {
177- return tempDownloadDir ;
178- }
179-
180176 private static class SystemVMTemplateDetails {
181177 Long id ;
182178 String uuid ;
@@ -395,15 +391,15 @@ private static String getHypervisorArchLog(Hypervisor.HypervisorType hypervisorT
395391 return sb .toString ();
396392 }
397393
398- protected static String getHypervisorArchKey (Hypervisor .HypervisorType hypervisorType , CPU .CPUArch arch ) {
394+ private static String getHypervisorArchKey (Hypervisor .HypervisorType hypervisorType , CPU .CPUArch arch ) {
399395 if (Hypervisor .HypervisorType .KVM .equals (hypervisorType )) {
400396 return String .format ("%s-%s" , hypervisorType .name ().toLowerCase (),
401397 arch == null ? CPU .CPUArch .amd64 .getType () : arch .getType ());
402398 }
403399 return hypervisorType .name ().toLowerCase ();
404400 }
405401
406- protected static MetadataTemplateDetails getMetadataTemplateDetails (Hypervisor .HypervisorType hypervisorType ,
402+ private static MetadataTemplateDetails getMetadataTemplateDetails (Hypervisor .HypervisorType hypervisorType ,
407403 CPU .CPUArch arch ) {
408404 return NewTemplateMap .get (getHypervisorArchKey (hypervisorType , arch ));
409405 }
@@ -445,7 +441,7 @@ private List<Long> getEligibleZoneIds() {
445441 return zoneIds ;
446442 }
447443
448- protected Pair <String , Long > getNfsStoreInZone (Long zoneId ) {
444+ private Pair <String , Long > getNfsStoreInZone (Long zoneId ) {
449445 ImageStoreVO storeVO = imageStoreDao .findOneByZoneAndProtocol (zoneId , "nfs" );
450446 if (storeVO == null ) {
451447 String errMsg = String .format ("Failed to fetch NFS store in zone = %s for SystemVM template registration" ,
@@ -460,13 +456,12 @@ protected Pair<String, Long> getNfsStoreInZone(Long zoneId) {
460456
461457 public static void mountStore (String storeUrl , String path , String nfsVersion ) {
462458 try {
463- if (storeUrl == null ) {
464- return ;
459+ if (storeUrl != null ) {
460+ URI uri = new URI (UriUtils .encodeURIComponent (storeUrl ));
461+ String host = uri .getHost ();
462+ String mountPath = uri .getPath ();
463+ Script .runSimpleBashScript (getMountCommand (nfsVersion , host + ":" + mountPath , path ));
465464 }
466- URI uri = new URI (UriUtils .encodeURIComponent (storeUrl ));
467- String host = uri .getHost ();
468- String mountPath = uri .getPath ();
469- Script .runSimpleBashScript (getMountCommand (nfsVersion , host + ":" + mountPath , path ));
470465 } catch (Exception e ) {
471466 String msg = "NFS Store URL is not in the correct format" ;
472467 LOGGER .error (msg , e );
@@ -788,7 +783,7 @@ public static String parseMetadataFile() {
788783 hypervisorType .second ()));
789784 }
790785 Ini .Section defaultSection = ini .get ("default" );
791- return defaultSection .get ("version" ). trim () ;
786+ return defaultSection .get ("version" );
792787 }
793788
794789
@@ -835,7 +830,7 @@ protected boolean isTemplateFileChecksumDifferent(MetadataTemplateDetails templa
835830 return false ;
836831 }
837832
838- protected void validateTemplates (List <Pair <Hypervisor .HypervisorType , CPU .CPUArch >> hypervisorsArchInUse ) {
833+ private void validateTemplates (List <Pair <Hypervisor .HypervisorType , CPU .CPUArch >> hypervisorsArchInUse ) {
839834 boolean templatesFound = true ;
840835 for (Pair <Hypervisor .HypervisorType , CPU .CPUArch > hypervisorArch : hypervisorsArchInUse ) {
841836 MetadataTemplateDetails matchedTemplate = getMetadataTemplateDetails (hypervisorArch .first (),
0 commit comments