How to allocate the Cloudlets in the VMs of a specific Host

  • To allocate the cloudlets to a specific Host means, first choose the specific Host from the created hosts list. Let “host” be the specific Host want to be allocated to cloudlets. Then, have to get the VMs which are created in that specific host. And the cloudlets are assigned to the VMs in that specific Host “host’.
  • protected void submitCloudlets() {
    …..;
    ……..;
    ** Get the HostList;
    getHostList();
    for(int i=0;i<getHostList().size();i++){
    host=//specific Host chosen based on one’s own concept/idea;
    }
    ** Get the VMs created in that specific host.
    List<Vm> vms=new ArrayList<Vm>();
    vms=host.getVmList(); //retrieve the VM list which has been created in Host host.
    ** Get the cloudlets list
    getCloudletList();
    for(Cloudlet cl: getCloudletList()){
    // Let "vi" be the VM chosen from vms list.
    cl.setVmId(vi.getId());
    sendNow(getVmsToDatacentersMap().get(vi.getId()), CloudSimTags.CLOUDLET_SUBMIT,cl);
    cloudletsSubmitted++;
    getCloudletSubmittedList().add(cl);
    }
    }