private void getManifestValues(String instanceId, Manifest mani) { System.out.println("instanceId: " + instanceId); // Get IP Extensions VirtualHardwareSection vhs = mani.getInfrastructureProviderExtensions() .getVirtualSystem(instanceId) .getVirtualHardwareSection(); int vhscpuSpeed = vhs.getCPUSpeed(); int vhsMemorySize = vhs.getMemorySize(); int vhsNumCPU = vhs.getNumberOfVirtualCPUs(); System.out.println("smcpuspeed " + vhscpuSpeed); System.out.println("smmemorysize " + vhsMemorySize); System.out.println("smnumcpu " + vhsNumCPU); }
public SetAdmissionControlDecision(String serviceManifest, String ACdecision, Logger log) { log.info("Ready to attach AdmissionControlDecision to SM"); // log.info("serviceManifest : "+serviceManifest); // Manifest ipManifest = Manifest.Factory.newInstance(serviceManifest); Manifest ipManifest = null; try { // ipManifest = Manifest.Factory.newInstance(serviceManifest); ipManifest = eu.optimis.manifest.api.ip.Manifest.Factory.newInstance(serviceManifest); // XmlBeanServiceManifestDocument xmlBeanManifest = // XmlBeanServiceManifestDocument.Factory.parse(serviceManifest); // ipManifest = Manifest.Factory.newInstance(xmlBeanManifest); if (ipManifest.isSetInfrastructureProviderExtensions()) if (ipManifest.getInfrastructureProviderExtensions().isSetAllocationOffer()) ipManifest.getInfrastructureProviderExtensions().unsetAllocationOffer(); /* } catch (XmlException x) { String Message="XmlException "+x.getMessage(); System.out.println(Message); log.error(x.getMessage()); x.printStackTrace(); */ } catch (RuntimeException re) { String Message = "RuntimeException " + re.getMessage(); System.out.println(Message); log.error(re.getMessage()); // e.printStackTrace(); } catch (Exception e) { String Message = "RuntimeException " + e.getMessage(); System.out.println(Message); log.error(e.getMessage()); // e.printStackTrace(); } ipManifest.initializeInfrastructureProviderExtensions(); log.info("initializeInfrastructureProviderExtensions"); String AdmissionControlDecision = null; if (ACdecision.contains("Accepted")) AdmissionControlDecision = AllocationOfferDecision.accepted.toString(); else if (ACdecision.contains("Rejected")) AdmissionControlDecision = AllocationOfferDecision.rejected.toString(); else if (ACdecision.contains("Partial accepted")) AdmissionControlDecision = AllocationOfferDecision.partial.toString(); ipManifest.getInfrastructureProviderExtensions().addNewAllocationOffer(); ipManifest .getInfrastructureProviderExtensions() .getAllocationOffer() .setDecision(AdmissionControlDecision); String smg = " ACdecision " + AdmissionControlDecision + " Attached to SM"; System.out.println(smg); log.info(smg); // serviceManifestWithACdecision = ipManifest.toString(); try { serviceManifestWithACdecision = ipManifest.toString(); } catch (Exception e) { String Message = "RuntimeException " + e.getMessage() + " Ignored"; System.out.println(Message); log.error(e.getMessage()); e.printStackTrace(); } log.info("Finish of attach AdmissionControlDecision to SM"); } // constructor