[vcloud|compute] improve models add tests

Improve the models to work with the current api version. add tests
that use fake-data, that was captured from a real vCloud.

Also removed a couple of dead code. Tests have been added for
everything that changed or have been added. All the existing but
untouched parts have not been tested.
This commit is contained in:
Peter Meier 2011-10-05 11:58:50 +02:00
parent 3499179991
commit 750fb59f25
31 changed files with 1401 additions and 197 deletions

View File

@ -107,6 +107,7 @@ module Fog
request :get_network_ips
request :get_network_extensions
request :get_organization
request :get_server
request :get_task
request :get_task_list
request :get_vapp

View File

@ -0,0 +1,37 @@
module Fog
module Vcloud
class Compute
module Helpers
module Status
def friendly_status
load_unless_loaded!
case status
when '0'
'creating'
when '8'
'off'
when '4'
'on'
else
'unknown'
end
end
def on?
reload_status
status == '4'
end
def off?
reload_status
status == '8'
end
def reload_status
reload # always ensure we have the correct status
end
end
end
end
end
end

View File

@ -3,14 +3,13 @@ module Fog
class Compute
class Network < Fog::Vcloud::Model
identity :href
identity :href, :aliases => :Href
ignore_attributes :xmlns, :xmlns_xsi, :xmlns_xsd, :xmlns_i, :Id
attribute :name, :aliases => :Name
#attribute :id, :aliases => :Id
attribute :description
attribute :description, :aliases => :Description
attribute :configuration, :aliases => :Configuration
attribute :links, :aliases => :Link, :type => :array

View File

@ -14,15 +14,18 @@ module Fog
def all
self.href = connection.default_vdc_href unless self.href
data = nil
if self.href =~ /\/vdc\//
check_href!("Vdc")
if data = connection.get_vdc(self.href).body[:AvailableNetworks][:Network]
load(data)
end
else
data = [connection.get_vdc(self.href).body[:AvailableNetworks][:Network]].flatten.compact
elsif self.href =~ /\/org\//
check_href!("Org")
load(connection.get_organization(self.href).body[:Link].select{|l| l[:type] == 'application/vnd.vmware.vcloud.network+xml' })
data = connection.get_organization(self.href).body[:Link].select{|l| l[:type] == 'application/vnd.vmware.vcloud.network+xml' }
elsif self.href =~ /\/vApp\//
check_href!("Vapp")
data = [(connection.get_vapp(self.href).body[:NetworkConfigSection]||{})[:NetworkConfig]].flatten.compact.collect{|n| n[:Configuration][:ParentNetwork] unless n[:Configuration].nil? }.compact
end
load([*data]) unless data.nil?
end
def get(uri)

View File

@ -8,6 +8,7 @@ module Fog
ignore_attributes :xmlns, :xmlns_xsi, :xmlns_xsd
attribute :name
attribute :description, :aliases => :Description
attribute :type
attribute :full_name, :aliases => :FullName
attribute :other_links, :aliases => :Link
@ -37,26 +38,6 @@ module Fog
:href => href )
end
private
def collection_based_on_type(type, klass = nil)
load_unless_loaded!
test_links = other_links.kind_of?(Array) ? other_links : [other_links]
if link = test_links.detect { |link| link[:type] == type }
case type
when "application/vnd.vmware.vcloud.catalog+xml"
Fog::Vcloud::Compute::Catalog
when "application/vnd.vmware.vcloud.vdc+xml"
Fog::Vcloud::Compute::Vdc
when "application/vnd.vmware.vcloud.network+xml"
Fog::Vcloud::Compute::Network
when "application/vnd.vmware.vcloud.network+xml"
Fog::Vcloud::Compute::Network
end.new( :connection => connection, :href => link[:href] )
else
[ ]
end
end
end
end
end

View File

@ -1,8 +1,11 @@
require 'fog/vcloud/models/compute/helpers/status'
module Fog
module Vcloud
class Compute
class Server < Fog::Vcloud::Model
include Fog::Vcloud::Compute::Helpers::Status
identity :href, :aliases => :Href
ignore_attributes :xmlns, :xmlns_i, :xmlns_xsi, :xmlns_xsd
@ -10,13 +13,17 @@ module Fog
attribute :type
attribute :name
attribute :status
attribute :deployed, :type => :boolean
attribute :description, :aliases => :Description
attribute :vapp_scoped_local_id, :aliases => :VAppScopedLocalId
attribute :network_connections, :aliases => :NetworkConnectionSection, :squash => :NetworkConnection
attribute :virtual_hardware, :aliases => :'ovf:VirtualHardwareSection', :squash => :'ovf:Item'
attribute :guest_customization, :aliases => :GuestCustomizationSection
attribute :operating_system, :aliases => :'ovf:OperatingSystemSection'
attribute :description, :aliases => :Description
attribute :links, :aliases => :Link, :type => :array
attribute :tasks, :aliases => :Tasks, :type => :array
@ -30,41 +37,22 @@ module Fog
self.operating_system[:'ovf:Description']
end
def os_type
load_unless_loaded!
self.operating_system[:vmw_osType]
end
def ip_addresses
load_unless_loaded!
self.network_connections.collect{|n| n[:IpAddress] }
end
def friendly_status
load_unless_loaded!
case status
when '0'
'creating'
when '8'
'off'
when '4'
'on'
else
'unkown'
end
end
def ready?
reload_status # always ensure we have the correct status
running_tasks = tasks && tasks.flatten.any? {|ti| ti.kind_of?(Hash) && ti[:status] == 'running' }
status != '0' && !running_tasks # 0 is provisioning, and no running tasks
end
def on?
reload_status # always ensure we have the correct status
status == '4'
end
def off?
reload_status # always ensure we have the correct status
status == '8'
end
def power_on
power_operation( :power_on => :powerOn )
end
@ -125,7 +113,7 @@ module Fog
def disks
disk_mess.map do |dm|
{ :number => dm[:"rasd:AddressOnParent"], :size => dm[:"rasd:VirtualQuantity"].to_i, :resource => dm[:"rasd:HostResource"] }
{ :number => dm[:"rasd:AddressOnParent"].to_i, :size => dm[:"rasd:HostResource"][:vcloud_capacity].to_i, :resource => dm[:"rasd:HostResource"] }
end
end
@ -241,22 +229,22 @@ module Fog
def memory_mess
load_unless_loaded!
if virtual_hardware_section
virtual_hardware_section.detect { |item| item[:"rasd:ResourceType"] == "4" }
if virtual_hardware
virtual_hardware.detect { |item| item[:"rasd:ResourceType"] == "4" }
end
end
def cpu_mess
load_unless_loaded!
if virtual_hardware_section
virtual_hardware_section.detect { |item| item[:"rasd:ResourceType"] == "3" }
if virtual_hardware
virtual_hardware.detect { |item| item[:"rasd:ResourceType"] == "3" }
end
end
def disk_mess
load_unless_loaded!
if virtual_hardware_section
virtual_hardware_section.select { |item| item[:"rasd:ResourceType"] == "17" }
if virtual_hardware
virtual_hardware.select { |item| item[:"rasd:ResourceType"] == "17" }
else
[]
end

View File

@ -13,14 +13,9 @@ module Fog
attribute :href, :aliases => :Href
def all
if self.href =~ /\/vdc\//
check_href!("Vdc")
load(_vapps)
else
check_href!("Vapp")
attributes[:vapp].load_unless_loaded!
load(attributes[:vapp].children||[])
end
check_href!("Vapp")
vapp.load_unless_loaded!
load(vapp.children||[])
end
def get(uri)
@ -43,19 +38,16 @@ module Fog
private
def _resource_entities
if Hash === resource_entities = connection.get_vdc(href).body[:ResourceEntities]
resource_entities[:ResourceEntity]
end
def vapp
@vapp ||= (attributes[:vapp] || init_vapp)
end
def _vapps
resource_entities = _resource_entities
if resource_entities.nil?
[]
else
resource_entities.select {|re| re[:type] == 'application/vnd.vmware.vcloud.vApp+xml' }
end
def init_vapp
Fog::Vcloud::Compute::Vapp.new(
:connection => connection,
:href => self.href,
:collection => Fog::Vcloud::Compute::Vapps.new(:connection => connection)
)
end
end

View File

@ -1,8 +1,11 @@
require 'fog/vcloud/models/compute/helpers/status'
module Fog
module Vcloud
class Compute
class Vapp < Fog::Vcloud::Model
include Fog::Vcloud::Compute::Helpers::Status
identity :href
ignore_attributes :xmlns, :xmlns_xsi, :xmlns_xsd
@ -10,10 +13,12 @@ module Fog
attribute :name
attribute :type
attribute :status
attribute :description
attribute :description, :aliases => :Description
attribute :deployed, :type => :boolean
attribute :children, :aliases => :Children, :squash => :Vm
attribute :lease_settings, :aliases => :LeaseSettingsSection
attribute :other_links, :aliases => :Link
def servers
@ -23,6 +28,13 @@ module Fog
:vapp => self
)
end
def networks
@networks ||= Fog::Vcloud::Compute::Networks.
new( :connection => connection,
:href => href
)
end
end
end
end

View File

@ -9,7 +9,7 @@ module Fog
model Fog::Vcloud::Compute::Vapp
undef_method :create
attribute :href
def all

View File

@ -10,13 +10,17 @@ module Fog
attribute :name
attribute :type
attribute :description, :aliases => :Description
attribute :other_links, :aliases => :Link
attribute :network_quota, :aliases => :NetworkQuota, :type => :integer
attribute :nic_quota, :aliases => :NicQuota, :type => :integer
attribute :vm_quota, :aliases => :VmQuota, :type => :integer
attribute :is_enabled, :aliases => :IsEnabled, :type => :boolean
attribute :compute_capacity, :aliases => :ComputeCapacity
attribute :storage_capacity, :aliases => :StorageCapacity
attribute :available_networks, :aliases => :AvailableNetworks, :squash => :Network
attribute :other_links, :aliases => :Link
attribute :resource_entities, :aliases => :ResourceEntities, :squash => :ResourceEntity
attribute :deployed_vm_quota
attribute :instantiated_vm_quota
def networks
@networks ||= Fog::Vcloud::Compute::Networks.
@ -24,12 +28,6 @@ module Fog
:href => href )
end
def servers
@servers ||= Fog::Vcloud::Compute::Servers.
new( :connection => connection,
:href => href )
end
def vapps
@vapps ||= Fog::Vcloud::Compute::Vapps.
new( :connection => connection,
@ -37,22 +35,6 @@ module Fog
)
end
private
def collection_based_on_type(type, klass = nil)
load_unless_loaded!
test_links = other_links.kind_of?(Array) ? other_links : [other_links]
if link = test_links.detect { |link| link[:type] == type }
case type
when "application/vnd.vmware.vcloud.catalog+xml"
Fog::Vcloud::Compute::Catalog
when "application/vnd.vmware.vcloud.vApp+xml"
Fog::Vcloud::Compute::Vapp
end.new( :connection => connection, :href => link[:href] )
else
[ ]
end
end
end
end
end

View File

@ -0,0 +1,10 @@
module Fog
module Vcloud
class Compute
class Real
basic_request :get_server
end
end
end
end

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<ExternalNetwork xmlns="http://www.vmware.com/vcloud/v1" name="ParentNetwork1" type="application/vnd.vmware.admin.network+xml" href="https://vcloud.example.com/api/v1.0/admin/network/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
<Description>Internet Connection</Description>
<Configuration>
<IpScope>
<IsInherited>false</IsInherited>
<Gateway>172.0.0.1</Gateway>
<Netmask>255.255.255.0</Netmask>
<Dns1>172.0.0.2</Dns1>
<Dns2>172.0.0.190</Dns2>
<IpRanges>
<IpRange>
<StartAddress>172.0.0.142</StartAddress>
<EndAddress>172.0.0.156</EndAddress>
</IpRange>
<IpRange>
<StartAddress>172.0.0.160</StartAddress>
<EndAddress>172.0.0.184</EndAddress>
</IpRange>
<IpRange>
<StartAddress>172.0.0.195</StartAddress>
<EndAddress>172.0.0.235</EndAddress>
</IpRange>
</IpRanges>
<AllocatedIpAddresses>
<IpAddress>172.0.0.153</IpAddress>
<IpAddress>172.0.0.147</IpAddress>
<IpAddress>172.0.0.221</IpAddress>
<IpAddress>172.0.0.226</IpAddress>
<IpAddress>172.0.0.151</IpAddress>
<IpAddress>172.0.0.161</IpAddress>
<IpAddress>172.0.0.164</IpAddress>
<IpAddress>172.0.0.163</IpAddress>
<IpAddress>172.0.0.218</IpAddress>
<IpAddress>172.0.0.173</IpAddress>
<IpAddress>172.0.0.172</IpAddress>
<IpAddress>172.0.0.175</IpAddress>
<IpAddress>172.0.0.178</IpAddress>
<IpAddress>172.0.0.197</IpAddress>
<IpAddress>172.0.0.180</IpAddress>
<IpAddress>172.0.0.201</IpAddress>
<IpAddress>172.0.0.156</IpAddress>
<IpAddress>172.0.0.202</IpAddress>
<IpAddress>172.0.0.183</IpAddress>
<IpAddress>172.0.0.149</IpAddress>
<IpAddress>172.0.0.214</IpAddress>
<IpAddress>172.0.0.171</IpAddress>
<IpAddress>172.0.0.162</IpAddress>
<IpAddress>172.0.0.198</IpAddress>
<IpAddress>172.0.0.224</IpAddress>
<IpAddress>172.0.0.195</IpAddress>
<IpAddress>172.0.0.196</IpAddress>
<IpAddress>172.0.0.150</IpAddress>
<IpAddress>172.0.0.169</IpAddress>
<IpAddress>172.0.0.170</IpAddress>
<IpAddress>172.0.0.176</IpAddress>
<IpAddress>172.0.0.200</IpAddress>
<IpAddress>172.0.0.179</IpAddress>
<IpAddress>172.0.0.205</IpAddress>
<IpAddress>172.0.0.213</IpAddress>
<IpAddress>172.0.0.210</IpAddress>
<IpAddress>172.0.0.215</IpAddress>
<IpAddress>172.0.0.219</IpAddress>
<IpAddress>172.0.0.208</IpAddress>
<IpAddress>172.0.0.216</IpAddress>
<IpAddress>172.0.0.217</IpAddress>
<IpAddress>172.0.0.204</IpAddress>
<IpAddress>172.0.0.232</IpAddress>
<IpAddress>172.0.0.154</IpAddress>
<IpAddress>172.0.0.235</IpAddress>
<IpAddress>172.0.0.146</IpAddress>
<IpAddress>172.0.0.209</IpAddress>
<IpAddress>172.0.0.211</IpAddress>
<IpAddress>172.0.0.199</IpAddress>
<IpAddress>172.0.0.155</IpAddress>
<IpAddress>172.0.0.142</IpAddress>
<IpAddress>172.0.0.160</IpAddress>
<IpAddress>172.0.0.212</IpAddress>
<IpAddress>172.0.0.177</IpAddress>
<IpAddress>172.0.0.167</IpAddress>
<IpAddress>172.0.0.166</IpAddress>
<IpAddress>172.0.0.168</IpAddress>
<IpAddress>172.0.0.165</IpAddress>
<IpAddress>172.0.0.181</IpAddress>
<IpAddress>172.0.0.184</IpAddress>
<IpAddress>172.0.0.143</IpAddress>
<IpAddress>172.0.0.230</IpAddress>
<IpAddress>172.0.0.206</IpAddress>
<IpAddress>172.0.0.233</IpAddress>
<IpAddress>172.0.0.222</IpAddress>
<IpAddress>172.0.0.225</IpAddress>
<IpAddress>172.0.0.220</IpAddress>
<IpAddress>172.0.0.227</IpAddress>
<IpAddress>172.0.0.148</IpAddress>
<IpAddress>172.0.0.228</IpAddress>
<IpAddress>172.0.0.229</IpAddress>
<IpAddress>172.0.0.231</IpAddress>
<IpAddress>172.0.0.152</IpAddress>
<IpAddress>172.0.0.145</IpAddress>
<IpAddress>172.0.0.174</IpAddress>
<IpAddress>172.0.0.182</IpAddress>
<IpAddress>172.0.0.203</IpAddress>
<IpAddress>172.0.0.207</IpAddress>
<IpAddress>172.0.0.144</IpAddress>
</AllocatedIpAddresses>
</IpScope>
<FenceMode>isolated</FenceMode>
</Configuration>
<ProviderInfo>NETWORK:dvportgroup-230 on com.vmware.vcloud.entity.vimserver:35935555</ProviderInfo>
</ExternalNetwork>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<OrgList xmlns="http://www.vmware.com/vcloud/v1" type="application/vnd.vmware.vcloud.orgList+xml" href="https://vcloud.example.com/api/v1.0/org/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
<Org type="application/vnd.vmware.vcloud.org+xml" name="Org1" href="https://vcloud.example.com/api/v1.0/org/1"/>
<Org type="application/vnd.vmware.vcloud.org+xml" name="Org2" href="https://vcloud.example.com/api/v1.0/org/2"/>
</OrgList>

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1" name="Network1" type="application/vnd.vmware.vcloud.network+xml" href="https://vcloud.example.com/api/v1.0/network/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
<Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloud.example.com/api/v1.0/org/1"/>
<Description>Some fancy Network</Description>
<Configuration>
<IpScope>
<IsInherited>false</IsInherited>
<Gateway>192.168.0.1</Gateway>
<Netmask>255.255.255.0</Netmask>
<Dns1>172.0.0.2</Dns1>
<Dns2>172.0.0.190</Dns2>
<IpRanges>
<IpRange>
<StartAddress>192.168.0.101</StartAddress>
<EndAddress>192.168.0.150</EndAddress>
</IpRange>
</IpRanges>
<AllocatedIpAddresses>
<IpAddress>192.168.0.1</IpAddress>
</AllocatedIpAddresses>
</IpScope>
<ParentNetwork type="application/vnd.vmware.admin.network+xml" name="ParentNetwork1" href="https://vcloud.example.com/api/v1.0/admin/network/2"/>
<FenceMode>natRouted</FenceMode>
<Features>
<DhcpService>
<IsEnabled>false</IsEnabled>
<DefaultLeaseTime>3600</DefaultLeaseTime>
<MaxLeaseTime>7200</MaxLeaseTime>
<IpRange>
<StartAddress>192.168.0.151</StartAddress>
<EndAddress>192.168.0.254</EndAddress>
</IpRange>
</DhcpService>
<FirewallService>
<IsEnabled>true</IsEnabled>
</FirewallService>
<NatService>
<IsEnabled>false</IsEnabled>
<NatType>portForwarding</NatType>
<Policy>allowTraffic</Policy>
</NatService>
</Features>
</Configuration>
</OrgNetwork>

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1" name="Network2" type="application/vnd.vmware.vcloud.network+xml" href="https://vcloud.example.com/api/v1.0/network/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
<Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloud.example.com/api/v1.0/org/1"/>
<Description>Description</Description>
<Configuration>
<IpScope>
<IsInherited>false</IsInherited>
<Gateway>192.168.251.254</Gateway>
<Netmask>255.255.255.0</Netmask>
<Dns1>192.168.251.254</Dns1>
<IpRanges>
<IpRange>
<StartAddress>192.168.251.101</StartAddress>
<EndAddress>192.168.251.200</EndAddress>
</IpRange>
</IpRanges>
</IpScope>
<FenceMode>isolated</FenceMode>
<Features>
<DhcpService>
<IsEnabled>false</IsEnabled>
<DefaultLeaseTime>3600</DefaultLeaseTime>
<MaxLeaseTime>7200</MaxLeaseTime>
<IpRange>
<StartAddress>192.168.251.1</StartAddress>
<EndAddress>192.168.251.100</EndAddress>
</IpRange>
</DhcpService>
</Features>
</Configuration>
</OrgNetwork>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<Org xmlns="http://www.vmware.com/vcloud/v1" name="Org1" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloud.example.com/api/v1.0/org/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
<Link rel="down" type="application/vnd.vmware.vcloud.vdc+xml" name="vDC1" href="https://vcloud.example.com/api/v1.0/vdc/1"/>
<Link rel="down" type="application/vnd.vmware.vcloud.tasksList+xml" href="https://vcloud.example.com/api/v1.0/tasksList/1"/>
<Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="Catalog1" href="https://vcloud.example.com/api/v1.0/catalog/1"/>
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/org/1/catalog/1/controlAccess/"/>
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/org/1/catalog/1/action/controlAccess"/>
<Link rel="down" type="application/vnd.vmware.vcloud.catalog+xml" name="Catalog2" href="https://vcloud.example.com/api/v1.0/catalog/2"/>
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/org/1/catalog/2/controlAccess/"/>
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/org/1/catalog/2/action/controlAccess"/>
<Link rel="down" type="application/vnd.vmware.vcloud.network+xml" name="Network1" href="https://vcloud.example.com/api/v1.0/network/1"/>
<Link rel="down" type="application/vnd.vmware.vcloud.network+xml" name="Network2" href="https://vcloud.example.com/api/v1.0/network/2"/>
<Description>Some fancy
Description</Description>
<FullName>My Full Name</FullName>
</Org>

View File

@ -0,0 +1,369 @@
<?xml version="1.0" encoding="UTF-8"?>
<VApp xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1" deployed="true" status="8" name="vApp1" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1 http://vcloud.example.com/api/v1.0/schema/vmwextensions.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
<Link rel="power:powerOn" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/power/action/powerOn"/>
<Link rel="power:powerOff" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/power/action/powerOff"/>
<Link rel="deploy" type="application/vnd.vmware.vcloud.deployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/action/deploy"/>
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/action/undeploy"/>
<Link rel="down" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/controlAccess/"/>
<Link rel="controlAccess" type="application/vnd.vmware.vcloud.controlAccess+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/action/controlAccess"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcloud.example.com/api/v1.0/vdc/652994200"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1"/>
<Description>Some Description of a vApp</Description>
<LeaseSettingsSection type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/leaseSettingsSection/" ovf:required="false">
<ovf:Info>Lease settings section</ovf:Info>
<Link rel="edit" type="application/vnd.vmware.vcloud.leaseSettingsSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/leaseSettingsSection/"/>
<DeploymentLeaseInSeconds>0</DeploymentLeaseInSeconds>
<StorageLeaseInSeconds>0</StorageLeaseInSeconds>
</LeaseSettingsSection>
<ovf:StartupSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/startupSection/" vcloud:type="application/vnd.vmware.vcloud.startupSection+xml">
<ovf:Info>VApp startup section</ovf:Info>
<ovf:Item ovf:stopDelay="0" ovf:stopAction="guestShutdown" ovf:startDelay="30" ovf:startAction="powerOn" ovf:order="2" ovf:id="vm1"/>
<ovf:Item ovf:stopDelay="30" ovf:stopAction="guestShutdown" ovf:startDelay="0" ovf:startAction="powerOn" ovf:order="1" ovf:id="vm2"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.startupSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/startupSection/"/>
</ovf:StartupSection>
<ovf:NetworkSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/networkSection/" vcloud:type="application/vnd.vmware.vcloud.networkSection+xml">
<ovf:Info>The list of logical networks</ovf:Info>
<ovf:Network ovf:name="Network1">
<ovf:Description/>
</ovf:Network>
</ovf:NetworkSection>
<NetworkConfigSection type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/networkConfigSection/" ovf:required="false">
<ovf:Info>The configuration parameters for logical networks</ovf:Info>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConfigSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1/networkConfigSection/"/>
<NetworkConfig networkName="Network1">
<Description>Some Network Description</Description>
<Configuration>
<IpScope>
<IsInherited>false</IsInherited>
<Gateway>192.168.2.1</Gateway>
<Netmask>255.255.255.0</Netmask>
<Dns1>192.168.2.1</Dns1>
<IpRanges>
<IpRange>
<StartAddress>192.168.2.101</StartAddress>
<EndAddress>192.168.2.150</EndAddress>
</IpRange>
</IpRanges>
<AllocatedIpAddresses>
<IpAddress>192.168.2.101</IpAddress>
<IpAddress>192.168.2.1</IpAddress>
<IpAddress>192.168.2.102</IpAddress>
</AllocatedIpAddresses>
</IpScope>
<ParentNetwork type="application/vnd.vmware.vcloud.network+xml" name="Network1" href="https://vcloud.example.com/api/v1.0/network/1"/>
<FenceMode>natRouted</FenceMode>
<Features>
<DhcpService>
<IsEnabled>false</IsEnabled>
<DefaultLeaseTime>7200</DefaultLeaseTime>
<MaxLeaseTime>7200</MaxLeaseTime>
<IpRange/>
</DhcpService>
<FirewallService>
<IsEnabled>true</IsEnabled>
</FirewallService>
<NatService>
<IsEnabled>true</IsEnabled>
<NatType>ipTranslation</NatType>
<Policy>allowTraffic</Policy>
<NatRule>
<OneToOneVmRule>
<MappingMode>automatic</MappingMode>
<ExternalIP>192.168.1.102</ExternalIP>
<VAppScopedVmId>vm1</VAppScopedVmId>
<VmNicId>0</VmNicId>
</OneToOneVmRule>
</NatRule>
<NatRule>
<OneToOneVmRule>
<MappingMode>automatic</MappingMode>
<ExternalIP>192.168.1.103</ExternalIP>
<VAppScopedVmId>vm2</VAppScopedVmId>
<VmNicId>0</VmNicId>
</OneToOneVmRule>
</NatRule>
</NatService>
</Features>
</Configuration>
<IsDeployed>true</IsDeployed>
</NetworkConfig>
</NetworkConfigSection>
<Children>
<Vm deployed="true" status="8" name="vm2" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2">
<VCloudExtension required="false">
<vmext:VimObjectRef>
<vmext:VimServerRef type="application/vnd.vmware.admin.vmwvirtualcenter+xml" name="vm2.example.com" href="https://vcloud.example.com/api/v1.0/admin/extension/vimServer/2"/>
<vmext:MoRef>vm-595</vmext:MoRef>
<vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
</vmext:VimObjectRef>
</VCloudExtension>
<Link rel="power:powerOn" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/power/action/powerOn"/>
<Link rel="power:powerOff" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/power/action/powerOff"/>
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/action/undeploy"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2"/>
<Link rel="screen:thumbnail" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/screen"/>
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/media/action/insertMedia"/>
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/media/action/ejectMedia"/>
<Description/>
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>vm2</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:02:03</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:ipAddress="192.168.2.102" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">Network1</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource vcloud:capacity="1600" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu"/>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>512 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>512</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory"/>
</ovf:Item>
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/disks"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/disks"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/media"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/networkCards"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/networkCards"/>
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/operatingSystemSection/"/>
</ovf:OperatingSystemSection>
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/networkConnectionSection/" ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="Network1">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>192.168.2.102</IpAddress>
<ExternalIpAddress>192.168.1.103</ExternalIpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:00:03</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/networkConnectionSection/"/>
</NetworkConnectionSection>
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/guestCustomizationSection/" ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>2</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<AdminPassword>password</AdminPassword>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript/>
<ComputerName>vm2</ComputerName>
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/guestCustomizationSection/"/>
</GuestCustomizationSection>
<VAppScopedLocalId>vmware_RHEL5-U5-64-small_v02</VAppScopedLocalId>
</Vm>
<Vm deployed="true" status="8" name="vm1" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1">
<VCloudExtension required="false">
<vmext:VimObjectRef>
<vmext:VimServerRef type="application/vnd.vmware.admin.vmwvirtualcenter+xml" name="vm1.example.com" href="https://vcloud.example.com/api/v1.0/admin/extension/vimServer/1"/>
<vmext:MoRef>vm-594</vmext:MoRef>
<vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
</vmext:VimObjectRef>
</VCloudExtension>
<Link rel="power:powerOn" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/power/action/powerOn"/>
<Link rel="power:powerOff" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/power/action/powerOff"/>
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/action/undeploy"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1"/>
<Link rel="screen:thumbnail" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/screen"/>
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/media/action/insertMedia"/>
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/media/action/ejectMedia"/>
<Description/>
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>vm1</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:02:04</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:ipAddress="192.168.2.101" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">Network1</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource vcloud:capacity="1600" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>512 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>512</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
</ovf:Item>
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/media"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-1/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/operatingSystemSection/"/>
</ovf:OperatingSystemSection>
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/networkConnectionSection/" ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="Network1">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>192.168.2.101</IpAddress>
<ExternalIpAddress>192.168.1.102</ExternalIpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:02:04</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/networkConnectionSection/"/>
</NetworkConnectionSection>
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/guestCustomizationSection/" ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>1</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<AdminPassword>password</AdminPassword>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript/>
<ComputerName>vm1</ComputerName>
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/guestCustomizationSection/"/>
</GuestCustomizationSection>
<VAppScopedLocalId>vmware_RHEL5-U5-64-small_v01</VAppScopedLocalId>
</Vm>
</Children>
</VApp>

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8"?>
<Vm xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1" deployed="true" status="8" name="vm1" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1 http://vcloud.example.com/api/v1.0/schema/vmwextensions.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
<VCloudExtension required="false">
<vmext:VimObjectRef>
<vmext:VimServerRef type="application/vnd.vmware.admin.vmwvirtualcenter+xml" name="vm1.example.com" href="https://vcloud.example.com/api/v1.0/admin/extension/vimServer/1"/>
<vmext:MoRef>vm-594</vmext:MoRef>
<vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
</vmext:VimObjectRef>
</VCloudExtension>
<Link rel="power:powerOn" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/power/action/powerOn"/>
<Link rel="power:powerOff" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/power/action/powerOff"/>
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/action/undeploy"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1006933678"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1"/>
<Link rel="screen:thumbnail" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/screen"/>
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/media/action/insertMedia"/>
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/media/action/ejectMedia"/>
<Description/>
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>vm1</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:02:04</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:ipAddress="192.168.2.101" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">Network1</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource vcloud:capacity="1600" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>512 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>512</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
</ovf:Item>
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/cpu"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/memory"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/disks"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/media"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/virtualHardwareSection/networkCards"/>
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-1/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/operatingSystemSection/"/>
</ovf:OperatingSystemSection>
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/networkConnectionSection/" ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="Network1">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>192.168.2.101</IpAddress>
<ExternalIpAddress>192.168.1.102</ExternalIpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:02:04</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/networkConnectionSection/"/>
</NetworkConnectionSection>
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/guestCustomizationSection/" ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>1</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<AdminPassword>password</AdminPassword>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript/>
<ComputerName>vm1</ComputerName>
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-1/guestCustomizationSection/"/>
</GuestCustomizationSection>
<VAppScopedLocalId>vmware_RHEL5-U5-64-small_v01</VAppScopedLocalId>
</Vm>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<Vm xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1" deployed="true" status="8" name="vm2" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1 http://vcloud.example.com/api/v1.0/schema/vmwextensions.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_VirtualSystemSettingData.xsd http://schemas.dmtf.org/ovf/envelope/1 http://schemas.dmtf.org/ovf/envelope/1/dsp8023_1.1.0.xsd http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2.22.0/CIM_ResourceAllocationSettingData.xsd http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
<VCloudExtension required="false">
<vmext:VimObjectRef>
<vmext:VimServerRef type="application/vnd.vmware.admin.vmwvirtualcenter+xml" name="vm2.example.com" href="https://vcloud.example.com/api/v1.0/admin/extension/vimServer/2"/>
<vmext:MoRef>vm-595</vmext:MoRef>
<vmext:VimObjectType>VIRTUAL_MACHINE</vmext:VimObjectType>
</vmext:VimObjectRef>
</VCloudExtension>
<Link rel="power:powerOn" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/power/action/powerOn"/>
<Link rel="power:powerOff" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/power/action/powerOff"/>
<Link rel="undeploy" type="application/vnd.vmware.vcloud.undeployVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/action/undeploy"/>
<Link rel="up" type="application/vnd.vmware.vcloud.vApp+xml" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1006933678"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.vm+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2"/>
<Link rel="screen:thumbnail" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/screen"/>
<Link rel="media:insertMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/media/action/insertMedia"/>
<Link rel="media:ejectMedia" type="application/vnd.vmware.vcloud.mediaInsertOrEjectParams+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/media/action/ejectMedia"/>
<Description>Some VM Description</Description>
<ovf:VirtualHardwareSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/" vcloud:type="application/vnd.vmware.vcloud.virtualHardwareSection+xml">
<ovf:Info>Virtual hardware requirements</ovf:Info>
<ovf:System>
<vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
<vssd:InstanceID>0</vssd:InstanceID>
<vssd:VirtualSystemIdentifier>vm2</vssd:VirtualSystemIdentifier>
<vssd:VirtualSystemType>vmx-07</vssd:VirtualSystemType>
</ovf:System>
<ovf:Item>
<rasd:Address>00:50:56:01:02:03</rasd:Address>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
<rasd:Connection vcloud:ipAddress="192.168.2.102" vcloud:primaryNetworkConnection="true" vcloud:ipAddressingMode="POOL">Network1</rasd:Connection>
<rasd:Description>PCNet32 ethernet adapter</rasd:Description>
<rasd:ElementName>Network adapter 0</rasd:ElementName>
<rasd:InstanceID>1</rasd:InstanceID>
<rasd:ResourceSubType>PCNet32</rasd:ResourceSubType>
<rasd:ResourceType>10</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>SCSI Controller</rasd:Description>
<rasd:ElementName>SCSI Controller 0</rasd:ElementName>
<rasd:InstanceID>2</rasd:InstanceID>
<rasd:ResourceSubType>lsilogicsas</rasd:ResourceSubType>
<rasd:ResourceType>6</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 1</rasd:ElementName>
<rasd:HostResource vcloud:capacity="1600" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
<rasd:InstanceID>2000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>1</rasd:AddressOnParent>
<rasd:Description>Hard disk</rasd:Description>
<rasd:ElementName>Hard disk 2</rasd:ElementName>
<rasd:HostResource vcloud:capacity="1600" vcloud:busType="6" vcloud:busSubType="lsilogicsas"/>
<rasd:InstanceID>3000</rasd:InstanceID>
<rasd:Parent>2</rasd:Parent>
<rasd:ResourceType>17</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:Address>0</rasd:Address>
<rasd:Description>IDE Controller</rasd:Description>
<rasd:ElementName>IDE Controller 0</rasd:ElementName>
<rasd:InstanceID>3</rasd:InstanceID>
<rasd:ResourceType>5</rasd:ResourceType>
</ovf:Item>
<ovf:Item>
<rasd:AddressOnParent>0</rasd:AddressOnParent>
<rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
<rasd:Description>CD/DVD Drive</rasd:Description>
<rasd:ElementName>CD/DVD Drive 1</rasd:ElementName>
<rasd:HostResource/>
<rasd:InstanceID>3002</rasd:InstanceID>
<rasd:Parent>3</rasd:Parent>
<rasd:ResourceType>15</rasd:ResourceType>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
<rasd:Description>Number of Virtual CPUs</rasd:Description>
<rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
<rasd:InstanceID>4</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>3</rasd:ResourceType>
<rasd:VirtualQuantity>1</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu"/>
</ovf:Item>
<ovf:Item vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml">
<rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
<rasd:Description>Memory Size</rasd:Description>
<rasd:ElementName>512 MB of memory</rasd:ElementName>
<rasd:InstanceID>5</rasd:InstanceID>
<rasd:Reservation>0</rasd:Reservation>
<rasd:ResourceType>4</rasd:ResourceType>
<rasd:VirtualQuantity>512</rasd:VirtualQuantity>
<rasd:Weight>0</rasd:Weight>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory"/>
</ovf:Item>
<Link rel="edit" type="application/vnd.vmware.vcloud.virtualHardwareSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/cpu"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/memory"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/disks"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/disks"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/media"/>
<Link rel="down" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/networkCards"/>
<Link rel="edit" type="application/vnd.vmware.vcloud.rasdItemsList+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/virtualHardwareSection/networkCards"/>
</ovf:VirtualHardwareSection>
<ovf:OperatingSystemSection xmlns:vcloud="http://www.vmware.com/vcloud/v1" xmlns:vmw="http://www.vmware.com/schema/ovf" ovf:id="80" vcloud:href="https://vcloud.example.com/api/v1.0/vApp/vm-2/operatingSystemSection/" vcloud:type="application/vnd.vmware.vcloud.operatingSystemSection+xml" vmw:osType="rhel5_64Guest">
<ovf:Info>Specifies the operating system installed</ovf:Info>
<ovf:Description>Red Hat Enterprise Linux 5 (64-bit)</ovf:Description>
<Link rel="edit" type="application/vnd.vmware.vcloud.operatingSystemSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/operatingSystemSection/"/>
</ovf:OperatingSystemSection>
<NetworkConnectionSection type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/networkConnectionSection/" ovf:required="false">
<ovf:Info>Specifies the available VM network connections</ovf:Info>
<PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex>
<NetworkConnection network="Network1">
<NetworkConnectionIndex>0</NetworkConnectionIndex>
<IpAddress>192.168.2.102</IpAddress>
<ExternalIpAddress>192.168.1.103</ExternalIpAddress>
<IsConnected>true</IsConnected>
<MACAddress>00:50:56:01:02:03</MACAddress>
<IpAddressAllocationMode>POOL</IpAddressAllocationMode>
</NetworkConnection>
<Link rel="edit" type="application/vnd.vmware.vcloud.networkConnectionSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/networkConnectionSection/"/>
</NetworkConnectionSection>
<GuestCustomizationSection type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/guestCustomizationSection/" ovf:required="false">
<ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
<Enabled>true</Enabled>
<ChangeSid>false</ChangeSid>
<VirtualMachineId>2</VirtualMachineId>
<JoinDomainEnabled>false</JoinDomainEnabled>
<UseOrgSettings>false</UseOrgSettings>
<AdminPasswordEnabled>true</AdminPasswordEnabled>
<AdminPasswordAuto>true</AdminPasswordAuto>
<AdminPassword>password</AdminPassword>
<ResetPasswordRequired>false</ResetPasswordRequired>
<CustomizationScript/>
<ComputerName>vm2</ComputerName>
<Link rel="edit" type="application/vnd.vmware.vcloud.guestCustomizationSection+xml" href="https://vcloud.example.com/api/v1.0/vApp/vm-2/guestCustomizationSection/"/>
</GuestCustomizationSection>
<VAppScopedLocalId>vmware_RHEL5-U5-64-small_v02</VAppScopedLocalId>
</Vm>

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<Vdc xmlns="http://www.vmware.com/vcloud/v1" xmlns:vmext="http://www.vmware.com/vcloud/extension/v1" status="1" name="vDC1" type="application/vnd.vmware.vcloud.vdc+xml" href="https://vcloud.example.com/api/v1.0/vdc/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1 http://vcloud.example.com/api/v1.0/schema/vmwextensions.xsd http://www.vmware.com/vcloud/v1 http://vcloud.example.com/api/v1.0/schema/master.xsd">
<VCloudExtension required="false">
<vmext:VimObjectRef>
<vmext:VimServerRef type="application/vnd.vmware.admin.vmwvirtualcenter+xml" name="host.example.com" href="https://vcloud.example.com/api/v1.0/admin/extension/vimServer/1"/>
<vmext:MoRef>resgroup-1</vmext:MoRef>
<vmext:VimObjectType>RESOURCE_POOL</vmext:VimObjectType>
</vmext:VimObjectRef>
</VCloudExtension>
<Link rel="up" type="application/vnd.vmware.vcloud.org+xml" href="https://vcloud.example.com/api/v1.0/org/1"/>
<Link rel="add" type="application/vnd.vmware.vcloud.uploadVAppTemplateParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/uploadVAppTemplate"/>
<Link rel="add" type="application/vnd.vmware.vcloud.media+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/media"/>
<Link rel="add" type="application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/instantiateVAppTemplate"/>
<Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/cloneVApp"/>
<Link rel="add" type="application/vnd.vmware.vcloud.cloneVAppTemplateParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/cloneVAppTemplate"/>
<Link rel="add" type="application/vnd.vmware.vcloud.cloneMediaParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/cloneMedia"/>
<Link rel="add" type="application/vnd.vmware.vcloud.captureVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/captureVApp"/>
<Link rel="add" type="application/vnd.vmware.vcloud.composeVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/composeVApp"/>
<Link rel="move" type="application/vnd.vmware.vcloud.moveMediaParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/moveMedia"/>
<Link rel="move" type="application/vnd.vmware.vcloud.moveVAppParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/moveVApp"/>
<Link rel="move" type="application/vnd.vmware.vcloud.moveVAppTemplateParams+xml" href="https://vcloud.example.com/api/v1.0/vdc/1/action/moveVAppTemplate"/>
<Description>Some Description</Description>
<AllocationModel>AllocationVApp</AllocationModel>
<StorageCapacity>
<Units>MB</Units>
<Allocated>10240</Allocated>
<Limit>102400</Limit>
<Used>101650</Used>
<Overhead>0</Overhead>
</StorageCapacity>
<ComputeCapacity>
<Cpu>
<Units>MHz</Units>
<Allocated>20000</Allocated>
<Limit>40000</Limit>
<Used>2000</Used>
<Overhead>0</Overhead>
</Cpu>
<Memory>
<Units>MB</Units>
<Allocated>1024</Allocated>
<Limit>10240</Limit>
<Used>8385</Used>
<Overhead>0</Overhead>
</Memory>
</ComputeCapacity>
<ResourceEntities>
<ResourceEntity type="application/vnd.vmware.vcloud.vApp+xml" name="vApp_1" href="https://vcloud.example.com/api/v1.0/vApp/vapp-1"/>
<ResourceEntity type="application/vnd.vmware.vcloud.vApp+xml" name="vApp_2" href="https://vcloud.example.com/api/v1.0/vApp/vapp-2"/>
<ResourceEntity type="application/vnd.vmware.vcloud.media+xml" name="media1" href="https://vcloud.example.com/api/v1.0/media/1"/>
<ResourceEntity type="application/vnd.vmware.vcloud.media+xml" name="media2" href="https://vcloud.example.com/api/v1.0/media/2"/>
</ResourceEntities>
<AvailableNetworks>
<Network type="application/vnd.vmware.vcloud.network+xml" name="network1" href="https://vcloud.example.com/api/v1.0/network/1"/>
<Network type="application/vnd.vmware.vcloud.network+xml" name="network2" href="https://vcloud.example.com/api/v1.0/network/2"/>
</AvailableNetworks>
<NicQuota>10</NicQuota>
<NetworkQuota>10</NetworkQuota>
<VmQuota>10</VmQuota>
<IsEnabled>true</IsEnabled>
</Vdc>

View File

@ -0,0 +1,13 @@
module Fog
class Connection
def initialize(url, persistent=false, params={})
end
def request(params, &block)
Excon::Response.new(
:body => File.read(File.expand_path(File.join(File.dirname(__FILE__),'..','..','data',params[:path].gsub(/^\//,'').gsub('/','_+_')))),
:status => 200,
:header => '')
end
end
end

View File

@ -0,0 +1,40 @@
require "#{File.dirname(__FILE__)}/conn_helper.rb"
require 'fog/vcloud/models/compute/networks'
Shindo.tests("Vcloud::Compute | network", ['vcloud']) do
connection = Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password')
tests("an org network") do
instance = Fog::Vcloud::Compute::Networks.new(
:connection => connection,
:href => "https://vcloud.example.com/api/v1.0/vApp/vapp-1"
).first
instance.reload
tests("#href").returns("https://vcloud.example.com/api/v1.0/network/1") { instance.href }
tests("#name").returns("Network1") { instance.name }
tests("#description").returns("Some fancy Network") { instance.description }
tests("configuration") do
tests("parent network").returns("ParentNetwork1") { instance.configuration[:ParentNetwork][:name]}
tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]}
end
end
tests("an external network") do
instance = Fog::Vcloud::Compute::Network.new(
:connection => connection,
:collection => Fog::Vcloud::Compute::Networks.new(:connection => connection),
:href => "https://vcloud.example.com/api/v1.0/admin/network/2"
)
instance.reload
tests("#href").returns("https://vcloud.example.com/api/v1.0/admin/network/2") { instance.href }
tests("#name").returns("ParentNetwork1") { instance.name }
tests("#description").returns("Internet Connection") { instance.description }
tests("configuration") do
tests("dns").returns("172.0.0.2") { instance.configuration[:IpScope][:Dns1]}
tests("allocated addresses").returns("172.0.0.144") { instance.configuration[:IpScope][:AllocatedIpAddresses][:IpAddress].first }
end
end
end

View File

@ -0,0 +1,41 @@
require "#{File.dirname(__FILE__)}/conn_helper.rb"
require 'fog/vcloud/models/compute/networks'
Shindo.tests("Vcloud::Compute | networks", ['vcloud']) do
tests("from an org perspective") do
instance = Fog::Vcloud::Compute::Networks.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/org/1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api/v1.0/network/1") { instance.first.href }
end
end
tests("from a vdc perspective") do
instance = Fog::Vcloud::Compute::Networks.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/vdc/1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api/v1.0/network/1") { instance.first.href }
end
end
tests("from a vapp perspective") do
instance = Fog::Vcloud::Compute::Networks.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/vApp/vapp-1"
)
tests("collection") do
returns(1) { instance.size }
returns("https://vcloud.example.com/api/v1.0/network/1") { instance.first.href }
end
end
end

View File

@ -0,0 +1,13 @@
require "#{File.dirname(__FILE__)}/conn_helper.rb"
Shindo.tests("Vcloud::Compute | organization", ['vcloud']) do
instance = Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password').organizations.first
instance.reload
tests("#href").returns('https://vcloud.example.com/api/v1.0/org/1'){ instance.href }
tests("#name").returns('Org1'){ instance.name }
tests("#full_name").returns('My Full Name'){ instance.full_name }
tests("#description").returns("Some fancy\n\nDescription"){ instance.description }
end

View File

@ -0,0 +1,14 @@
require "#{File.dirname(__FILE__)}/conn_helper.rb"
require 'fog/vcloud/models/compute/organizations'
Shindo.tests("Vcloud::Compute | organizations", ['vcloud']) do
instance = Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password').organizations
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api/v1.0/org/1") { instance.first.href }
end
end

View File

@ -0,0 +1,131 @@
require "#{File.dirname(__FILE__)}/conn_helper.rb"
require 'fog/vcloud/models/compute/servers'
Shindo.tests("Vcloud::Compute | server", ['vcloud']) do
instance = Fog::Vcloud::Compute::Servers.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/vApp/vapp-1"
).first
instance.reload
tests("#href").returns("https://vcloud.example.com/api/v1.0/vApp/vm-2") { instance.href }
tests("#name").returns("vm2") { instance.name }
tests("#description").returns("Some VM Description") { instance.description }
tests("#status").returns('8') { instance.status }
tests("#deployed").returns(true) { instance.deployed }
tests("#os_desc").returns("Red Hat Enterprise Linux 5 (64-bit)") { instance.os_desc }
tests("#os_type").returns("rhel5_64Guest") { instance.os_type }
tests("#computer_name").returns("vm2") { instance.computer_name }
tests("cpu count").returns(1) { instance.cpus[:count] }
tests("amount of memory").returns(512){ instance.memory[:amount] }
tests("#disks") do
tests("#size").returns(2){ instance.disks.size }
tests("#size").returns(0){ instance.disks.first[:number] }
tests("#size").returns(1600){ instance.disks.first[:size] }
end
tests("#vapp_scoped_local_id").returns("vmware_RHEL5-U5-64-small_v02") { instance.vapp_scoped_local_id }
tests("#friendly_status").returns('off') { instance.friendly_status }
tests("#on?").returns(false) { instance.on? }
tests("#off?").returns(true) { instance.off? }
#old tests
tests("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do
pending if Fog.mocking?
@svr = Vcloud.servers.create :catalog_item_uri => Vcloud::Compute::TestSupport::template, :name => 'fog_test_run', :password => 'password'
print "Waiting for server to be ready"
@svr.wait_for(1200) { print '.' ; ready? }
puts ""
@svr.ready?
end
tests("#svr.power_on()").returns(true) do
pending if Fog.mocking?
@svr.power_on
@svr.wait_for { on? }
@svr.wait_for { ready? }
@svr.on?
end
tests("#svr.description(\"testing\")").returns("testing") do
pending if Fog.mocking?
@svr.wait_for { ready? }
@svr.description = "testing"
@svr.save
@svr.wait_for { ready? }
@svr.description
end
# Power off only stops the OS, doesn't free up resources. #undeploy is for this.
tests("#svr.undeploy()").returns(true) do
pending if Fog.mocking?
@svr.undeploy
@svr.wait_for { off? }
@svr.wait_for { ready? }
@svr.off?
end
tests("#svr.memory(384)").returns(384) do
pending if Fog.mocking?
raise 'Server template memory already 384m - change to something different' if @svr.memory[:amount] == 384
@svr.wait_for { ready? }
@svr.memory = 384
@svr.save
@svr.wait_for { ready? }
# Can take a little while for the VM to know it has different ram, and not tied to a task..
(1..20).each do |i|
break if @svr.reload.memory[:amount] == '384'
sleep 1
end
@svr.reload.memory[:amount]
end
tests("#svr.add_disk(4096)").returns([2, "4096"]) do
pending if Fog.mocking?
raise 'Server template already has two disks' if @svr.disks.size == 2
@svr.wait_for { ready? }
@svr.add_disk(4096)
@svr.save
@svr.wait_for { ready? }
# Can take a little while for the VM to know it has different ram, and not tied to a task..
(1..20).each do |i|
break if @svr.reload.disks.size == 2
sleep 1
end
[
@svr.disks.size,
@svr.disks[1][:resource][:vcloud_capacity]
]
end
tests("#svr.delete_disk(1)").returns(1) do
pending if Fog.mocking?
raise "Server doesn't have two disks - did previous step fail? " if @svr.disks.size != 2
@svr.wait_for { ready? }
sleep 5 # otherwise complains about being busy
@svr.delete_disk 1
@svr.save
@svr.wait_for { ready? }
# Can take a little while for the VM to know it has different ram, and not tied to a task..
(1..20).each do |i|
break if @svr.reload.disks.size == 1
sleep 1
end
@svr.disks.size
end
tests("#svr.destroy").raises(Excon::Errors::Forbidden) do
pending if Fog.mocking?
@svr.destroy
sleep 5 # allow cleanup..
Vcloud.servers.get(@svr.href) == nil
end
end

View File

@ -1,95 +1,15 @@
require "#{File.dirname(__FILE__)}/conn_helper.rb"
require 'fog/vcloud/models/compute/servers'
Shindo.tests("Vcloud::Compute | servers", ['vcloud']) do
instance = Fog::Vcloud::Compute::Servers.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/vApp/vapp-1"
)
tests("#server.new('#{Vcloud::Compute::TestSupport::template}')").returns(true) do
pending if Fog.mocking?
@svr = Vcloud.servers.create :catalog_item_uri => Vcloud::Compute::TestSupport::template, :name => 'fog_test_run', :password => 'password'
print "Waiting for server to be ready"
@svr.wait_for(1200) { print '.' ; ready? }
puts ""
@svr.ready?
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api/v1.0/vApp/vm-2") { instance.first.href }
end
tests("#svr.power_on()").returns(true) do
pending if Fog.mocking?
@svr.power_on
@svr.wait_for { on? }
@svr.wait_for { ready? }
@svr.on?
end
tests("#svr.description(\"testing\")").returns("testing") do
pending if Fog.mocking?
@svr.wait_for { ready? }
@svr.description = "testing"
@svr.save
@svr.wait_for { ready? }
@svr.description
end
# Power off only stops the OS, doesn't free up resources. #undeploy is for this.
tests("#svr.undeploy()").returns(true) do
pending if Fog.mocking?
@svr.undeploy
@svr.wait_for { off? }
@svr.wait_for { ready? }
@svr.off?
end
tests("#svr.memory(384)").returns(384) do
pending if Fog.mocking?
raise 'Server template memory already 384m - change to something different' if @svr.memory[:amount] == 384
@svr.wait_for { ready? }
@svr.memory = 384
@svr.save
@svr.wait_for { ready? }
# Can take a little while for the VM to know it has different ram, and not tied to a task..
(1..20).each do |i|
break if @svr.reload.memory[:amount] == '384'
sleep 1
end
@svr.reload.memory[:amount]
end
tests("#svr.add_disk(4096)").returns([2, "4096"]) do
pending if Fog.mocking?
raise 'Server template already has two disks' if @svr.disks.size == 2
@svr.wait_for { ready? }
@svr.add_disk(4096)
@svr.save
@svr.wait_for { ready? }
# Can take a little while for the VM to know it has different ram, and not tied to a task..
(1..20).each do |i|
break if @svr.reload.disks.size == 2
sleep 1
end
[
@svr.disks.size,
@svr.disks[1][:resource][:vcloud_capacity]
]
end
tests("#svr.delete_disk(1)").returns(1) do
pending if Fog.mocking?
raise "Server doesn't have two disks - did previous step fail? " if @svr.disks.size != 2
@svr.wait_for { ready? }
sleep 5 # otherwise complains about being busy
@svr.delete_disk 1
@svr.save
@svr.wait_for { ready? }
# Can take a little while for the VM to know it has different ram, and not tied to a task..
(1..20).each do |i|
break if @svr.reload.disks.size == 1
sleep 1
end
@svr.disks.size
end
tests("#svr.destroy").raises(Excon::Errors::Forbidden) do
pending if Fog.mocking?
@svr.destroy
sleep 5 # allow cleanup..
Vcloud.servers.get(@svr.href) == nil
end
end

View File

@ -0,0 +1,27 @@
require "#{File.dirname(__FILE__)}/conn_helper.rb"
require 'fog/vcloud/models/compute/vapps'
require 'fog/vcloud/models/compute/vapp'
Shindo.tests("Vcloud::Compute | vapp", ['vcloud']) do
instance = Fog::Vcloud::Compute::Vapps.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/vdc/1"
).first
instance.reload
tests("#href").returns("https://vcloud.example.com/api/v1.0/vApp/vapp-1") { instance.href }
tests("#name").returns("vApp1") { instance.name }
tests("#description").returns("Some Description of a vApp") { instance.description }
tests("#status").returns('8') { instance.status }
tests("#deployed").returns(true) { instance.deployed }
tests("#children").returns(2) { instance.children.size }
tests("#servers").returns(2) { instance.servers.size }
tests("#friendly_status").returns('off') { instance.friendly_status }
tests("#on?").returns(false) { instance.on? }
tests("#off?").returns(true) { instance.off? }
end

View File

@ -0,0 +1,17 @@
require "#{File.dirname(__FILE__)}/conn_helper.rb"
require 'fog/vcloud/models/compute/vapps'
Shindo.tests("Vcloud::Compute | vapps", ['vcloud']) do
instance = Fog::Vcloud::Compute::Vapps.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/vdc/1"
)
tests("collection") do
returns(2) { instance.size }
returns("https://vcloud.example.com/api/v1.0/vApp/vapp-1") { instance.first.href }
end
end

View File

@ -0,0 +1,42 @@
require "#{File.dirname(__FILE__)}/conn_helper.rb"
require 'fog/vcloud/models/compute/vdcs'
require 'fog/vcloud/models/compute/vdc'
Shindo.tests("Vcloud::Compute | vdc", ['vcloud']) do
instance = Fog::Vcloud::Compute::Vdcs.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/org/1"
).first
instance.reload
tests("#href").returns("https://vcloud.example.com/api/v1.0/vdc/1") { instance.href }
tests("#name").returns("vDC1") { instance.name }
tests("#description").returns("Some Description") { instance.description }
tests("#network_quota").returns(10) { instance.network_quota }
tests("#nic_quota").returns(10) { instance.nic_quota }
tests("#vm_quota").returns(10) { instance.vm_quota }
tests("#is_enabled").returns(true) { instance.is_enabled }
tests("#available_networks") do
tests("#size").returns(2) { instance.available_networks.size }
end
tests("#storage_capacity") do
tests("units").returns("MB") { instance.storage_capacity[:Units] }
tests("allocated").returns("10240") { instance.storage_capacity[:Allocated] }
end
tests("#compute_capacity") do
tests("cpu") do
tests("allocated").returns("20000") { instance.compute_capacity[:Cpu][:Allocated] }
tests("units").returns("MHz") { instance.compute_capacity[:Cpu][:Units] }
end
tests("memory") do
tests("allocated").returns("1024") { instance.compute_capacity[:Memory][:Allocated] }
tests("units").returns("MB") { instance.compute_capacity[:Memory][:Units] }
end
end
end

View File

@ -0,0 +1,17 @@
require "#{File.dirname(__FILE__)}/conn_helper.rb"
require 'fog/vcloud/models/compute/vdcs'
Shindo.tests("Vcloud::Compute | vdcs", ['vcloud']) do
instance = Fog::Vcloud::Compute::Vdcs.new(
:connection => Fog::Vcloud::Compute.new(:vcloud_host => 'vcloud.example.com', :vcloud_username => 'username', :vcloud_password => 'password'),
:href => "https://vcloud.example.com/api/v1.0/org/1"
)
tests("collection") do
returns(1) { instance.size }
returns("https://vcloud.example.com/api/v1.0/vdc/1") { instance.first.href }
end
end