Chinaunix首页 | 论坛 | 博客
  • 博客访问: 189434
  • 博文数量: 19
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1062
  • 用 户 组: 普通用户
  • 注册时间: 2013-09-10 15:52
个人简介

经历过才能真的感受,做一个靠谱的人!

文章分类

全部博文(19)

文章存档

2015年(1)

2013年(18)

我的朋友

分类: 云计算

2013-09-12 21:22:55

CloudSim源码分析之Datacenter创建 

1、创建物理机列表。List hostList = new ArrayList();

2、创建PE列表。一个物理机包含一个或多个PECPU)。List peList = new ArrayList();

3、创建PE,并将其添加到PE列表。peList.add(new Pe(0, new PeProvisionerSimple(mips)));可以设置PEIDmips

4、创建物理机,并添加到物理机列表。物理机的配置参数有:id,内存,存储,带宽,PE列表,虚拟机分配策略(时间共享和空间共享)。

点击(此处)折叠或打开

  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 = new LinkedList<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);

5、创建数据中心特征DatacenterCharacteristics对象,用来存储数据中心的属性,包含体系结构、操作系统、虚拟机类型、时区、价格(使用该数据中心单价)、单位内存价格、单位存储价格、单位带宽价格、机器列表。

点击(此处)折叠或打开

  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.         );

6、创建数据中心对象,它的主要参数有名称、特征对象、虚拟机分配策略(目前只有最简单的,研究者可以替换新策略)、用于数据仿真的存储列表以及调度间隔。

 

阅读(3912) | 评论(0) | 转发(3) |
给主人留下些什么吧!~~