private void createSymLinks(Mpack mpack) throws IOException {

    String stackName = mpack.getName();
    String stackVersion = mpack.getVersion();
    File stack = new File(stackRoot + "/" + stackName);
    Path stackPath = Paths.get(stackRoot + "/" + stackName + "/" + stackVersion);
    Path mpackPath = Paths.get(mpackStaging + "/" + mpack.getName() + "/" + mpack.getVersion());
    if(Files.isSymbolicLink(stackPath))
      Files.delete(stackPath);
    Files.createSymbolicLink(stackPath, mpackPath);
  }
Create a linkage between the staging directory and the working directory i.e from mpacks-v2 to stackRoot.
This will enable StackManager to parse the newly registered mpack as part of the stacks.
@throws IOException
ambari-server/src/test/java/org/apache/ambari/server/mpack/MpackManagerMock.java