server/lib/deltacloud/drivers/opennebula/occi_client.rb
######################################################################
# Puts a new Compute representation in order to change its state
# :xmlfile Compute OCCI xml representation
######################################################################
Puts a new Compute representation in order to change its state
:xmlfile Compute OCCI xml representation
Puts a new Compute representation in order to change its state : xmlfile Compute OCCI xml representation
def put_vm(xmlfile)
            xml=File.read(xmlfile)
            vm_info=REXML::Document.new(xml).root.elements
            url = URI.parse(@endpoint+'/compute/' + vm_info['ID'].text)
            req = Net::HTTP::Put.new(url.path)
            req.body = xml
            req.basic_auth @occiauth[0], @occiauth[1]
            res = CloudClient::http_start(url) do |http|
                http.request(req)
            end
            if CloudClient::is_error?(res)
                return res
            else
                return res.body
            end
        end
def put_vm ( xmlfile ) xml = File . read ( xmlfile ) vm_info = REXML :: Document . new ( xml ) . root . elements url = URI . parse ( @endpoint + '/compute/' + vm_info [ 'ID' ] . text ) req = Net :: HTTP :: Put . new ( url . path ) req . body = xml req . basic_auth @occiauth [ 0 ] , @occiauth [ 1 ] res = CloudClient :: http_start ( url ) do | http | http . request ( req ) end if CloudClient :: is_error? ( res ) return res else return res . body end end
Puts a new Compute representation in order to change its state
:xmlfile Compute OCCI xml representation
Puts a new Compute representation in order to change its state : xmlfile Compute OCCI xml representation
xmlfile