mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
1.Fix Catalog Listing for vCD 1.5
2.Construct Valid XML to memory configuration 3.Fix Undeploy vCD 1.5
This commit is contained in:
parent
15592c06de
commit
abd3b0b0b1
3 changed files with 26 additions and 15 deletions
|
@ -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)
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue