CloudSim源碼分析-Datacenter創建

1、創建物理機列表。List<Host> hostList = newArrayList<Host>();

2、創建PE列表。一個物理機包含一個或多個PECPU)。List<Pe> peList = new ArrayList<Pe>();

3、創建PE,並將其添加到PE列表。peList.add(new Pe(0, new PeProvisionerSimple(mips)));可以設置PEIDmips

4、創建物理機,並添加到物理機列表。物理機的配置參數有:id,內存,存儲,帶寬,PE列表,虛擬機分配策略(時間共享和空間共享),並加入物理機列表。

  1. int hostId = 0;
  2.         int ram = 2048;// host memory (MB)

  3.         long storage = 1000000;// host storage

  4.         int bw = 10000;

  5.         hostList.add(
  6.             new Host(
  7.                 hostId,
  8.                 new RamProvisionerSimple(ram),
  9.                 new BwProvisionerSimple(bw),
  10.                 storage,
  11.                 peList,
  12.                 new VmSchedulerTimeShared(peList)
  13.             )
  14.         );

5、創建數據中心特徵DatacenterCharacteristics對象,用來存儲數據中心的屬性,包含體系結構、操作系統、虛擬機類型、時區、價格(使用該數據中心單價)、單位內存價格、單位存儲價格、單位帶寬價格、機器列表。

  1.        String arch ="x86";// system architecture

  2.         String os ="Linux";// operating system

  3.         String vmm ="Xen";
  4.         double time_zone = 10.0;// time zone this resource located

  5.         double cost = 3.0;// the cost of using processing in this resource

  6.         double costPerMem = 0.05;// the cost of using memory in this resource

  7.         double costPerStorage = 0.001;// the cost of using storage in this

  8.                                         // resource

  9.         double costPerBw = 0.0;// the cost of using bw in this resource

  10.         LinkedList<Storage> storageList =newLinkedList<Storage>();// we are not adding SAN

  11.                                                     // devices by now


  12.         DatacenterCharacteristics characteristics =new DatacenterCharacteristics(
  13.                 arch, os, vmm, hostList, time_zone, cost, costPerMem,
  14.                 costPerStorage, costPerBw);

6、創建數據中心對象,它的主要參數有名稱、特徵對象、虛擬機分配策略(目前只有最簡單的,研究者可以替換新策略)、用於數據仿真的存儲列表以及調度間隔。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章