test
diff --git a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
index 42cdb88..da70408 100755
--- a/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -1008,6 +1008,9 @@
         final String csr = caManager.generateKeyStoreAndCsr(vmHost, sshAccessDetails);
         if (!Strings.isNullOrEmpty(csr)) {
             final Map<String, String> ipAddressDetails = new HashMap<>(sshAccessDetails);
+            for (Map.Entry<String,String> e : ipAddressDetails.entrySet()) {
+                s_logger.info("PEARL - k = " + e.getKey() + " v: "+ e.getValue());
+            }
             ipAddressDetails.remove(NetworkElementCommand.ROUTER_NAME);
             final Certificate certificate = caManager.issueCertificate(csr, Arrays.asList(vm.getHostName(), vm.getInstanceName()),
                     new ArrayList<>(ipAddressDetails.values()), CAManager.CertValidityPeriod.value(), null);
diff --git a/engine/schema/pom.xml b/engine/schema/pom.xml
index 3b1bba2..77dda5f 100644
--- a/engine/schema/pom.xml
+++ b/engine/schema/pom.xml
@@ -90,7 +90,9 @@
                         <configuration>
                             <source>
                                 def csVersion = pom.properties['cs.version']
+                                println(csVersion)
                                 def patch = pom.properties['patch.version']
+                                println(patch)
                                 def templateList = []
                                 templateList.add("systemvmtemplate-${csVersion}.${patch}-kvm")
                                 templateList.add("systemvmtemplate-${csVersion}.${patch}-vmware")
@@ -123,7 +125,8 @@
                             <goal>wget</goal>
                         </goals>
                         <configuration>
-                            <url>https://download.cloudstack.org/systemvm/${cs.version}/md5sum.txt</url>
+<!--                            <url>https://download.cloudstack.org/systemvm/${cs.version}/md5sum.txt</url>-->
+                            <url>http://10.0.3.122/systemvmtemplate/custom/cks-debian/${cs.version}/md5sum.txt</url>
                             <outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
                             <skipCache>true</skipCache>
                             <overwrite>true</overwrite>
@@ -182,7 +185,8 @@
                                 </goals>
                                 <configuration>
                                     <checkSignature>true</checkSignature>
-                                    <url>https://download.cloudstack.org/systemvm/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-kvm.qcow2.bz2</url>
+<!--                                    <url>https://download.cloudstack.org/systemvm/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-kvm.qcow2.bz2</url>-->
+                                        <url>http://10.0.3.122/systemvmtemplate/custom/cks-debian/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-kvm.qcow2.bz2</url>
                                     <outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
                                     <md5>${kvm.checksum}</md5>
                                 </configuration>
@@ -194,7 +198,8 @@
                                 </goals>
                                 <configuration>
                                     <checkSignature>true</checkSignature>
-                                    <url>https://download.cloudstack.org/systemvm/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-vmware.ova</url>
+<!--                                    <url>https://download.cloudstack.org/systemvm/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-vmware.ova</url>-->
+                                    <url>http://10.0.3.122/systemvmtemplate/custom/cks-debian/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-vmware.ova</url>
                                     <outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
                                     <md5>${vmware.checksum}</md5>
                                 </configuration>
@@ -206,7 +211,8 @@
                                 </goals>
                                 <configuration>
                                     <checkSignature>true</checkSignature>
-                                    <url>https://download.cloudstack.org/systemvm/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-xen.vhd.bz2</url>
+<!--                                    <url>https://download.cloudstack.org/systemvm/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-xen.vhd.bz2</url>-->
+                                    <url>http://10.0.3.122/systemvmtemplate/custom/cks-debian/${cs.version}/systemvmtemplate-${cs.version}.${patch.version}-xen.vhd.bz2</url>
                                     <outputDirectory>${basedir}/dist/systemvm-templates/</outputDirectory>
                                     <md5>${xen.checksum}</md5>
                                 </configuration>
diff --git a/pom.xml b/pom.xml
index 69f520b..6813bb8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,7 +49,7 @@
         <!-- keep in alphabetic order -->
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <project.systemvm.template.version>4.16.0.0</project.systemvm.template.version>
+        <project.systemvm.template.version>4.16.1.0</project.systemvm.template.version>
 
         <!-- Build properties -->
         <cs.jdk.version>11</cs.jdk.version>
diff --git a/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 7434ea8..1dcaf7b 100644
--- a/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/main/java/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@ -1210,7 +1210,8 @@
 
     @Override
     public boolean finalizeVirtualMachineProfile(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
-
+//        final Certificate certificate = caManager.issueCertificate(null, Arrays.asList(profile.getHostName(), profile.getInstanceName()),
+//                new ArrayList<>(ipAddressDetails.values()), CAManager.CertValidityPeriod.value(), null);
         ConsoleProxyVO vm = consoleProxyDao.findById(profile.getId());
         Map<String, String> details = userVmDetailsDao.listDetailsKeyPairs(vm.getId());
         vm.setDetails(details);
@@ -1280,6 +1281,15 @@
             buf.append(" dns2=").append(dc.getDns2());
         }
 
+//        try {
+//            buf.append(" certificate=").append(CertUtils.x509CertificateToPem(certificate.getClientCertificate()));
+//            buf.append(" cacertificate=").append(CertUtils.x509CertificatesToPem(certificate.getCaCertificates()));
+//            if (certificate.getPrivateKey() != null) {
+//                buf.append(" privatekey=").append(CertUtils.privateKeyToPem(certificate.getPrivateKey()));
+//            }
+//        } catch (IOException e) {
+//            throw new CloudRuntimeException("Failed to transform X509 cert to PEM format", e);
+//        }
         buf.append(" keystore_password=").append(PasswordGenerator.generateRandomPassword(16));
         buf.append(" validity=").append(CAManager.CertValidityPeriod.value());
         String bootArgs = buf.toString();
diff --git a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
index 370dfc0..5a50fe8 100755
--- a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
+++ b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config
@@ -54,7 +54,7 @@
   fi
 
   eval $(validate_checksums $md5file $oldpatchfile)
-  if [ "$oldmd5" == "$newmd5" ] && [ ! -f ${patchfile} ]; then
+  if [ "$oldmd5" == "$newmd5" ] && [ -d /usr/local/cloud/systemvm ] && [ "$(ls -A /usr/local/cloud/systemvm)" ]; then
     log_it "Checksum matches, do need to patch"
     return 0
   fi
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index 7075c13..285d818 100755
--- a/tools/appliance/build.sh
+++ b/tools/appliance/build.sh
@@ -348,9 +348,9 @@
   packer_build
 
   # process the disk at dist
-  kvm_export
-  ovm_export
-  xen_server_export
+#  kvm_export
+#  ovm_export
+#  xen_server_export
   vmware_export
 #  hyperv_export
   rm -f "dist/${appliance}"