feature #1977: Fix pciBridge

This commit is contained in:
Ruben S. Montero committed 2013-07-04 01:24:36 +02:00
1 parent 9c75891fe9
commit ac67df2441
3 files changed
+18 -17

No files matched your search

+1 -1
View File
@@ -171,7 +171,7 @@ int LibVirtDriver::deployment_description_vmware(
if ( !guestOS.empty() )
{
metadata << "<guestOS>" << guestOS << "</guestOS>" << endl;
metadata << "<guestos>" << guestOS << "</guestos>" << endl;
}
// Start writing to the file with the info we got
+7 -6
View File
@@ -153,14 +153,15 @@ class VIVm
# Set or removes a pciBridge from VM
########################################################################
def set_pcibridge(pciBridge)
num = pciBridge.to_i
return if (pciBridge.nil? || pciBridge.empty? )
return if (num == 0)
if pciBridge.downcase == "yes"
spec = [ :key => "pciBridge0.present", :value => "TRUE" ]
else
spec = [ :key => "pciBridge0.present", :value => "FALSE" ]
end
spec = []
num.times { |i|
spec << { :key => "pciBridge#{i}.present", :value => "TRUE" }
}
vmspec = RbVmomi::VIM.VirtualMachineConfigSpec(:extraConfig => spec)
+10 -10
View File
@@ -30,7 +30,6 @@ require "scripts_common"
require 'yaml'
require "CommandManager"
require 'rexml/document'
include REXML
class VMwareDriver
# -------------------------------------------------------------------------#
@@ -390,24 +389,24 @@ class VMwareDriver
end
def handle_metadata(dfile, deploy_id)
dfile_hash = Document.new(File.open(dfile).read)
dfile_hash = REXML::Document.new(File.open(dfile).read)
# Check for the known elements in metadata
guestOS = XPath.first(dfile_hash, "/domain/metadata/guestOS")
pciBridge = XPath.first(dfile_hash, "/domain/metadata/pciBridge")
guestos = REXML::XPath.first(dfile_hash, "/domain/metadata/guestos")
pcibridge = REXML::XPath.first(dfile_hash, "/domain/metadata/pcibridge")
if (guestOS || pciBridge)
if (guestos || pcibridge)
VIDriver::initialize(@host, false)
vivm = VIDriver::VIVm.new(deploy_id, nil)
vivm.set_guestos(guestOS.text) if guestOS
vivm.set_guestos(guestos.text) if guestos
vivm.set_pcibridge(pciBridge.text) if pciBridge
vivm.set_pcibridge(pcibridge.text) if pcibridge
end
# Append the raw datavmx to vmx file
metadata = XPath.first(dfile_hash, "/domain/metadata/datavmx")
metadata = REXML::XPath.first(dfile_hash, "/domain/metadata/datavmx")
return if metadata.nil?
return if metadata.text.nil?
@@ -416,10 +415,11 @@ class VMwareDriver
metadata = metadata.text
# Get the ds_id for system_ds from the first disk
source = XPath.first(dfile_hash, "/domain//disk/source").attributes['file']
disk = REXML::XPath.first(dfile_hash, "/domain//disk/source")
source = disk.attributes['file']
ds_id = source.match(/^\[(.*)\](.*)/)[1]
name = XPath.first(dfile_hash, "/domain/name").text
name = REXML::XPath.first(dfile_hash, "/domain/name").text
vm_id = name.match(/^one-(.*)/)[1]
# Reconstruct path to vmx & add metadata