以下列举一些样例: service{name"groovy"type"WEB_SERVER"elastictruenumInstances2maxAllowedInstances2// define SLA requirements for each service instance with regards to isolation from other services// if this is not defined - defaults to dedicated mode. which means each service instance is insalled on a dedicated VM.isolationSLA{global{// global - meaning each service instance can be installed on any VM that answer the requirements below.// allowing services to share VM's. Note: VM's running management process are not included.instanceCpuCores0// no CPU requirements, this way instances can be installed on the same VM even if it has just one CPU(can also define 0.5 CPU requirements and so on...)instanceMemoryMB128// each instance needs 128MB to be allocated for him on the VM.useManagementtrue// Enables installing services/applications on the management machines. Defaults to false.}}} 还有一些SLA的例子可以定义在* -service.groovy文件中isolationSLA{appShared{// services belonging to the same application may share machinesinstanceCpuCores0instanceMemoryMB128}}isolationSLA{global{// all services may share machinesinstanceCpuCores0instanceMemoryMB128}}isolationSLA{tenantShared{// service belonging to the same authenticationGroup may share machinesinstanceCpuCores0instanceMemoryMB128}} 如果没有对I solation SLA进行 定义,那么dedicated isolation SLA将被使用,即服务实例不能共享machines。 另外一个很重要的特性是,Cloudify允许重用对服务特性的定义,即可以将某个标准的服务定义单独编写一个 外部公用的groovy文件,然后由不同Service Recipe描述文件加载读取。例如: 一个定义为可以在Web管理控制台进行显示性能指标的layout样式 userInterface.groovy如下:userInterface{metricGroups=[metricGroup{name="process"metrics=["cpu","memory"]}]widgetGroups=[widgetGroup{name="cpu"widgets=[balanceGauge{metric="cpu"},barLineChart{metric="cpu"}]},widgetGroup{name="memory"widgets=[balanceGauge{metric="memory"},barLineChart{metric="memory"axisYUnitUnit.PERCENTAGE}]}]}那么Service Recipe描述文件可以做如下定义引用:service{name"myService"……userInterfaceload("userInterface.groovy")}