示例#1
0
 @Override
 public void destroy(Asset asset) throws Exception {
   Partition par = new Partition(asset);
   String nodeType = par.getNodeType();
   // For support multiple
   // virtual machine leasing partition.
   if (PartitionAC.VM.equals(nodeType)) {
     VirtualClient vc = VirtualManager.getInstance().getVirtualClient();
     vc.freeVMPartition(par);
     log.info("Partition (" + par.getName() + ") with VM nodetype of PartitionAC is destroying.");
     return;
   }
   log.info("Partition (" + asset.getName() + ") of PartitionAC is destroying.");
 }
示例#2
0
 @Override
 public Asset create(Asset asset) throws Exception {
   Partition par = new Partition(asset);
   String nodeType = par.getNodeType();
   if (!isValidType(nodeType)) {
     throw new Exception(
         "The partition of "
             + asset.getName()
             + " should has a valid attribute with the name of nodeType.");
   }
   // For support multiple
   // virtual machine leasing partition.
   if (PartitionAC.VM.equals(nodeType)) {
     VirtualClient vc = VirtualManager.getInstance().getVirtualClient();
     Partition newpar = vc.allocateVMPartition(par);
     log.info("Partition (" + par.getName() + ") with VM nodetype of PartitionAC is creating.");
     return newpar;
   }
   log.info("Partition (" + par.getName() + ") of PartitionAC is creating.");
   return par;
 }