module Fog
module Terremark
module Shared
module Real
include Common
def configure_vapp(vapp_id, vapp_name, options = {})
items = ""
vapp_uri = [@host, @path, "vApp", vapp_id.to_s].join("/")
if options['vcpus']
vcpu_item = <<-DATA
- 13#{options['vcpus']}
DATA
items << vcpu_item
end
if options['memory']
memory_item = <<-DATA
- 2438#{options['memory']}
DATA
items << memory_item
end
#Default root disk
virtual_disk_item = <<-DATA
-
0 10485769171048576
DATA
items << virtual_disk_item
#Additional disks
if options['virtual_disks']
for disk in options['virtual_disks']
actual_size = disk.to_i * 1024 * 1024
virtual_disk_item = <<-DATA
-
-1#{actual_size}917#{actual_size}
DATA
items << virtual_disk_item
end
end
data = <<-DATA
Virtual Hardware#{items}
DATA
request(
:body => data,
:expects => 202,
:headers => { 'Content-Type' => 'application/vnd.vmware.vCloud.vApp+xml' },
:method => 'PUT',
:path => "vapp/#{vapp_id}"
)
end
end
end
end
end