How to allocate the cloudlets/tasks in a specific VM

  • Let vm1, vm2 are the two VMs.
  • Cloudlet cloudlet1 = new Cloudlet(id, length, pesNumber, fileSize, outputSize,utilizationModel, utilizationModel, utilizationModel);
    cloudlet1.setUserId(brokerId);
    id++;
    Cloudlet cloudlet2 = new Cloudlet(id, length, pesNumber, fileSize, outputSize,utilizationModel, utilizationModel, utilizationModel);
    cloudlet2.setUserId(brokerId);
    //add the cloudlets to the list
    cloudletList.add(cloudlet1);
    cloudletList.add(cloudlet2);
    //submit cloudlet list to the broker
    broker.submitCloudletList(cloudletList);
    //bind the cloudlets to the vms. This way, the broker
    // will submit the bound cloudlets only to the specific VM
    broker.bindCloudletToVm(cloudlet1.getCloudletId(),vm1.getId());
    broker.bindCloudletToVm(cloudlet2.getCloudletId(),vm2.getId());