Sunday, April 13, 2014

understanding the Code for datacenter, host and VM's


Trying to understand how to simulate datacenter with host and VM's
According to the example problem,
A simple example showing how to create a datacenter with one host and run one cloudlet on it.

To create a datacentre:
Create host list and PE list, add the PE list to the host list and add that to the datacentre.
host has
  • hostID - 0
  • ram - 2048MB
  • storage: 1000000 (host storage)
  • bw - 10000
1.  PE list : need to store Pe id and MIPS Rating
  • mips : 1000
List<Pe> peList = new ArrayList<Pe>();
int mips = 1000;
peList.add(new Pe(0, new PeProvisionerSimple(mips)));

2.  List<Host> hostList = new ArrayList<Host>();
 new Host(    hostId,
    new RamProvisionerSimple(ram),
    new BwProvisionerSimple(bw),
    storage,
    peList,
    new VmSchedulerTimeShared(peList)
   )
  );

3.  Add datacentre characteristics
  • arch : x86
  • os : Linux
  • vmm: Xen
  • time-zone: 10
  • cost per sec : 3
  • cost per Memory : 0.05
  • cost per Storage : 0.001
  • cost per bw : 0.0
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
    arch, os, vmm, hostList, time_zone, cost, costPerMem,
    costPerStorage, costPerBw);


4.  Create a datacentre
   datacenter = new Datacenter(name, characteristics, new VmAllocationPolicySimple(hostList), storageList, 0);

VmAllocationPolicySimple is an VmAllocationPolicy that chooses, as the host for a VM, the host with less PEs in use.
5.  Create VM list ( in this case 1)
  • vmid : 0
  • mips : 1000
  • size : 10000
  • ram: 512
  • bw : 1000
  • pesnumber : 1
  • vmm: Xen
Vm vm = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new CloudletSchedulerTimeShared()); 
vmlist.add(vm);
broker.submitVmList(vmlist); 

No comments:

Post a Comment