private void createEsxiSession(ImageServerDialog d,ComputeImageJob job,ComputeImage ci,ComputeImageServer imageServer){
  String s=ImageServerUtils.getResourceAsString(ESXI5X_UUID_TEMPLATE);
  StringBuilder sb=new StringBuilder(s);
  ImageServerUtils.replaceAll(sb,"${os_full_name}",ci.getImageName());
  ImageServerUtils.replaceAll(sb,"${os_path}",ci.getPathToDirectory());
  ImageServerUtils.replaceAll(sb,"${pxe_identifier}",job.getPxeBootIdentifier());
  String content=sb.toString();
  log.trace(content);
  d.writeFile(imageServer.getTftpBootDir() + PXELINUX_CFG_DIR + job.getPxeBootIdentifier(),content);
  s=d.readFile(imageServer.getTftpBootDir() + ci.getPathToDirectory() + "/boot.cfg");
  sb=new StringBuilder(s.trim());
  ImageServerUtils.replaceAll(sb,"/","/" + ci.getPathToDirectory());
  ImageServerUtils.replaceAll(sb,"runweasel","runweasel vmkopts=debugLogToSerial:1 ks=http://" + imageServer.getImageServerSecondIp() + ":"+ imageServer.getImageServerHttpPort()+ "/ks/"+ job.getPxeBootIdentifier()+ " kssendmac");
  content=sb.toString();
  log.trace(content);
  d.writeFile(imageServer.getTftpBootDir() + PXELINUX_CFG_DIR + job.getPxeBootIdentifier()+ ".boot.cfg",content);
  content=generateKickstart(job,ci,imageServer);
  d.writeFile(imageServer.getTftpBootDir() + HTTP_KICKSTART_DIR + job.getPxeBootIdentifier(),content);
  content=generateFirstboot(job,ci);
  d.writeFile(imageServer.getTftpBootDir() + HTTP_FIRSTBOOT_DIR + job.getPxeBootIdentifier(),content);
  d.rm(imageServer.getTftpBootDir() + HTTP_SUCCESS_DIR + job.getPxeBootIdentifier());
  d.rm(imageServer.getTftpBootDir() + HTTP_FAILURE_DIR + job.getPxeBootIdentifier());
}

private void createEsxiSession ( ImageServerDialog d , ComputeImageJob job , ComputeImage ci , ComputeImageServer imageServer ) { String s = ImageServerUtils . getResourceAsString ( ESXI5X_UUID_TEMPLATE ) ; StringBuilder sb = new StringBuilder ( s ) ; ImageServerUtils . replaceAll ( sb , "${os_full_name}" , ci . getImageName ( ) ) ; ImageServerUtils . replaceAll ( sb , "${os_path}" , ci . getPathToDirectory ( ) ) ; ImageServerUtils . replaceAll ( sb , "${pxe_identifier}" , job . getPxeBootIdentifier ( ) ) ; String content = sb . toString ( ) ; log . trace ( content ) ; d . writeFile ( imageServer . getTftpBootDir ( ) + PXELINUX_CFG_DIR + job . getPxeBootIdentifier ( ) , content ) ; s = d . readFile ( imageServer . getTftpBootDir ( ) + ci . getPathToDirectory ( ) + "/boot.cfg" ) ; sb = new StringBuilder ( s . trim ( ) ) ; ImageServerUtils . replaceAll ( sb , "/" , "/" + ci . getPathToDirectory ( ) ) ; ImageServerUtils . replaceAll ( sb , "runweasel" , "runweasel vmkopts=debugLogToSerial:1 ks=http://" + imageServer . getImageServerSecondIp ( ) + ":" + imageServer . getImageServerHttpPort ( ) + "/ks/" + job . getPxeBootIdentifier ( ) + " kssendmac" ) ; content = sb . toString ( ) ; log . trace ( content ) ; d . writeFile ( imageServer . getTftpBootDir ( ) + PXELINUX_CFG_DIR + job . getPxeBootIdentifier ( ) + ".boot.cfg" , content ) ; content = generateKickstart ( job , ci , imageServer ) ; d . writeFile ( imageServer . getTftpBootDir ( ) + HTTP_KICKSTART_DIR + job . getPxeBootIdentifier ( ) , content ) ; content = generateFirstboot ( job , ci ) ; d . writeFile ( imageServer . getTftpBootDir ( ) + HTTP_FIRSTBOOT_DIR + job . getPxeBootIdentifier ( ) , content ) ; d . rm ( imageServer . getTftpBootDir ( ) + HTTP_SUCCESS_DIR + job . getPxeBootIdentifier ( ) ) ; d . rm ( imageServer . getTftpBootDir ( ) + HTTP_FAILURE_DIR + job . getPxeBootIdentifier ( ) ) ; }
create pxe uuid config and pxe uuid boot . cfg files for esxi 5 . x and 6 . x and put them under tftpboot / pxelinux . cfg / .
