@Override
  public void prepareSecondaryStorageStore(String storageUrl) {
    String mountPoint = getMountPoint(storageUrl);

    GlobalLock lock = GlobalLock.getInternLock("prepare.systemvm");
    try {
      if (lock.lock(3600)) {
        try {
          File patchFolder = new File(mountPoint + "/systemvm");
          if (!patchFolder.exists()) {
            if (!patchFolder.mkdirs()) {
              String msg =
                  "Unable to create systemvm folder on secondary storage. location: "
                      + patchFolder.toString();
              s_logger.error(msg);
              throw new CloudRuntimeException(msg);
            }
          }

          File srcIso = getSystemVMPatchIsoFile();
          File destIso = new File(mountPoint + "/systemvm/" + getSystemVMIsoFileNameOnDatastore());
          if (!destIso.exists()) {
            s_logger.info(
                "Inject SSH key pairs before copying systemvm.iso into secondary storage");
            _configServer.updateKeyPairs();

            s_logger.info(
                "Copy System VM patch ISO file to secondary storage. source ISO: "
                    + srcIso.getAbsolutePath()
                    + ", destination: "
                    + destIso.getAbsolutePath());
            try {
              FileUtil.copyfile(srcIso, destIso);
            } catch (IOException e) {
              s_logger.error("Unexpected exception ", e);

              String msg =
                  "Unable to copy systemvm ISO on secondary storage. src location: "
                      + srcIso.toString()
                      + ", dest location: "
                      + destIso;
              s_logger.error(msg);
              throw new CloudRuntimeException(msg);
            }
          } else {
            if (s_logger.isTraceEnabled()) {
              s_logger.trace("SystemVM ISO file " + destIso.getPath() + " already exists");
            }
          }
        } finally {
          lock.unlock();
        }
      }
    } finally {
      lock.releaseRef();
    }
  }
 @Override
 public void init() throws ServletException {
   // Save Configuration Values
   // ComponentLocator loc = ComponentLocator.getLocator(ConfigurationServer.Name);
   ConfigurationServer c =
       (ConfigurationServer) ComponentLocator.getComponent(ConfigurationServer.Name);
   // ConfigurationServer c = new ConfigurationServerImpl();
   try {
     c.persistDefaultValues();
     s_locator = ComponentLocator.getLocator(ManagementServer.Name);
     ManagementServer ms = (ManagementServer) ComponentLocator.getComponent(ManagementServer.Name);
     ms.enableAdminUser("password");
     ApiServer.initApiServer(ms.getApiConfig());
   } catch (InvalidParameterValueException ipve) {
     s_logger.error("Exception starting management server ", ipve);
     throw new ServletException(ipve.getMessage());
   } catch (Exception e) {
     s_logger.error("Exception starting management server ", e);
     throw new ServletException(e.getMessage());
   }
 }