diff --git a/lib/fog/vcloud/models/compute/catalog_items.rb b/lib/fog/vcloud/models/compute/catalog_items.rb index 0d38163de..482dd4833 100644 --- a/lib/fog/vcloud/models/compute/catalog_items.rb +++ b/lib/fog/vcloud/models/compute/catalog_items.rb @@ -10,8 +10,12 @@ module Fog attribute :href, :aliases => :Href def all - data = connection.get_catalog(href).body[:CatalogItems][:CatalogItem] - load(data) + catalog_item_info = connection.get_catalog_item(self.href) + items = connection.get_catalog_item(self.href).body[:CatalogItems] + if items.size > 0 + data = items[:CatalogItem] + load(data) + end end def get(uri) diff --git a/lib/fog/vcloud/requests/compute/configure_vm_memory.rb b/lib/fog/vcloud/requests/compute/configure_vm_memory.rb index 498728627..299898e76 100644 --- a/lib/fog/vcloud/requests/compute/configure_vm_memory.rb +++ b/lib/fog/vcloud/requests/compute/configure_vm_memory.rb @@ -9,18 +9,17 @@ module Fog edit_uri = edit_uri.kind_of?(Array) ? edit_uri.flatten[1][:href] : edit_uri[:Link][:href] body = <<EOF -<?xml version="1.0" encoding="UTF-8"?> -<Item xmlns="http://www.vmware.com/vcloud/v1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vcloud="http://www.vmware.com/vcloud/v1" vcloud:href="https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-329805878/virtualHardwareSection/memory" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="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://vcd01.esx.dev.int.realestate.com.au/api/v1.0/schema/master.xsd"> - <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> - <rasd:Description>Memory Size</rasd:Description> - <rasd:ElementName>#{vm_data[:'rasd:VirtualQuantity']} MB of memory</rasd:ElementName> - <rasd:InstanceID>5</rasd:InstanceID> - <rasd:Reservation>0</rasd:Reservation> - <rasd:ResourceType>4</rasd:ResourceType> - <rasd:VirtualQuantity>#{vm_data[:'rasd:VirtualQuantity']}</rasd:VirtualQuantity> - <rasd:Weight>5120</rasd:Weight> - <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="https://vcd01.esx.dev.int.realestate.com.au/api/v1.0/vApp/vm-329805878/virtualHardwareSection/memory"/> -</Item> + <Item xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vcloud="http://www.vmware.com/vcloud/v1.5" vcloud:href="#{edit_uri}" vcloud:type="application/vnd.vmware.vcloud.rasdItem+xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/v1.5 http://#{@host}/api/v1.5/schema/master.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"> + <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits> + <rasd:Description>Memory Size</rasd:Description> + <rasd:ElementName>#{vm_data[:'rasd:VirtualQuantity']} MB of memory</rasd:ElementName> + <rasd:InstanceID>5</rasd:InstanceID> + <rasd:Reservation>0</rasd:Reservation> + <rasd:ResourceType>4</rasd:ResourceType> + <rasd:VirtualQuantity>#{vm_data[:'rasd:VirtualQuantity']}</rasd:VirtualQuantity> + <rasd:Weight>0</rasd:Weight> + <Link rel="edit" type="application/vnd.vmware.vcloud.rasdItem+xml" href="#{edit_uri}"/> + </Item> EOF request( diff --git a/lib/fog/vcloud/requests/compute/undeploy.rb b/lib/fog/vcloud/requests/compute/undeploy.rb index 266b30d54..68729b91d 100644 --- a/lib/fog/vcloud/requests/compute/undeploy.rb +++ b/lib/fog/vcloud/requests/compute/undeploy.rb @@ -6,8 +6,16 @@ module Fog # builder = Builder::XmlMarkup.new # builder.UndeployVAppParams(:xmlns => 'http://www.vmware.com/vcloud/v1', # :saveState => save_state) {} - builder = "<UndeployVAppParams saveState=\"#{save_state.to_s}\" xmlns=\"http://www.vmware.com/vcloud/v1\"/>" + builder = if version =='1.0' + "<UndeployVAppParams saveState=\"#{save_state.to_s}\" xmlns=\"http://www.vmware.com/vcloud/v1\"/>" + else + <<EOF + <UndeployVAppParams xmlns="http://www.vmware.com/vcloud/v1.5"> + <UndeployPowerAction>shutdown</UndeployPowerAction> + </UndeployVAppParams> +EOF + end request( :body => builder, :expects => 202,