opennebula-5.2.1-vncautoport.diff
opennebula-5.2.1-vncautoport/src/lcm/LifeCycleActions.cc 2017-04-20 12:04:16.417496645 -0500 | ||
---|---|---|
907 | 907 | |
908 | 908 |
const VectorAttribute * graphics = vm->get_template_attribute("GRAPHICS"); |
909 | 909 | |
910 |
if ( graphics != 0 && (graphics->vector_value("PORT", port) == 0)) |
|
910 |
if ( graphics != 0 && (graphics->vector_value("PORT") != "auto" && graphics->vector_value("PORT", port) == 0))
|
|
911 | 911 |
{ |
912 | 912 |
clpool->release_vnc_port(vm->get_cid(), port); |
913 | 913 |
} |
opennebula-5.2.1-vncautoport/src/lcm/LifeCycleStates.cc 2017-04-20 12:04:25.748497333 -0500 | ||
---|---|---|
965 | 965 | |
966 | 966 |
const VectorAttribute * graphics = vm->get_template_attribute("GRAPHICS"); |
967 | 967 | |
968 |
if ( graphics != 0 && (graphics->vector_value("PORT", port) == 0)) |
|
968 |
if ( graphics != 0 && (graphics->vector_value("PORT") != "auto" && graphics->vector_value("PORT", port) == 0))
|
|
969 | 969 |
{ |
970 | 970 |
clpool->release_vnc_port(vm->get_cid(), port); |
971 | 971 |
} |
opennebula-5.2.1-vncautoport/src/onedb/fsck.rb 2017-04-20 12:21:54.810574684 -0500 | ||
---|---|---|
812 | 812 | |
813 | 813 |
# VNC ports per cluster |
814 | 814 |
cid = vm_doc.root.at_xpath("HISTORY_RECORDS/HISTORY[last()]/CID").text.to_i rescue nil |
815 |
port = vm_doc.root.at_xpath('TEMPLATE/GRAPHICS[translate(TYPE,"vnc","VNC")="VNC"]/PORT').text.to_i rescue nil |
|
815 | ||
816 |
port = vm_doc.root.at_xpath('TEMPLATE/GRAPHICS[translate(TYPE,"vnc","VNC")="VNC"]/PORT').text rescue nil |
|
817 |
if port == "auto" |
|
818 |
port = nil |
|
819 |
else |
|
820 |
port = port.to_i rescue nil |
|
821 | ||
822 |
if port == 0 |
|
823 |
port = nil |
|
824 |
end |
|
825 |
end |
|
816 | 826 | |
817 | 827 |
if cid && port |
818 | 828 |
cluster_vnc[cid] ||= Set.new |
opennebula-5.2.1-vncautoport/src/onedb/local/4.13.85_to_4.90.0.rb 2017-04-20 12:22:05.782575493 -0500 | ||
---|---|---|
854 | 854 |
@db.fetch("SELECT * FROM vm_pool WHERE state != 6") do |row| |
855 | 855 |
doc = Nokogiri::XML(row[:body],nil,NOKOGIRI_ENCODING){|c| c.default_xml.noblanks} |
856 | 856 | |
857 |
port = doc.root.at_xpath('TEMPLATE/GRAPHICS[translate(TYPE,"vnc","VNC")="VNC"]/PORT').text.to_i rescue nil |
|
857 |
port = doc.root.at_xpath('TEMPLATE/GRAPHICS[translate(TYPE,"vnc","VNC")="VNC"]/PORT').text rescue nil |
|
858 |
if port == "auto" |
|
859 |
port = nil |
|
860 |
else |
|
861 |
port = port.to_i rescue nil |
|
862 | ||
863 |
if port == 0 |
|
864 |
port = nil |
|
865 |
end |
|
866 |
end |
|
858 | 867 |
cluster_id = doc.root.at_xpath('HISTORY_RECORDS/HISTORY[last()]/CID').text.to_i rescue nil |
859 | 868 | |
860 | 869 |
# skip if no port is defined or if it's not assigned to a cluster (not deployed yet!) |
opennebula-5.2.1-vncautoport/src/rm/RequestManagerVirtualMachine.cc 2017-04-20 12:02:27.305488600 -0500 | ||
---|---|---|
708 | 708 |
{ |
709 | 709 |
return 0; |
710 | 710 |
} |
711 |
else if (graphics->vector_value("PORT") == "auto") |
|
712 |
{ |
|
713 |
return 0; |
|
714 |
} |
|
711 | 715 |
else if (graphics->vector_value("PORT", port) == 0) |
712 | 716 |
{ |
713 | 717 |
rc = cpool->set_vnc_port(cluster_id, port); |
opennebula-5.2.1-vncautoport/src/vm/VirtualMachine.cc 2017-04-20 12:15:31.279546405 -0500 | ||
---|---|---|
1309 | 1309 | |
1310 | 1310 |
if ( !graphics->vector_value("PORT").empty() ) |
1311 | 1311 |
{ |
1312 |
unsigned int port; |
|
1312 |
if (graphics->vector_value("PORT") != "auto") { |
|
1313 |
unsigned int port; |
|
1314 |
int rc = graphics->vector_value("PORT", port); |
|
1313 | 1315 | |
1314 |
int rc = graphics->vector_value("PORT", port); |
|
1315 | ||
1316 |
if (rc == -1 || port > 65535 ) |
|
1317 |
{ |
|
1318 |
error_str = "Wrong PORT number in GRAPHICS attribute"; |
|
1319 |
return -1; |
|
1316 |
if (rc == -1 || port > 65535 ) |
|
1317 |
{ |
|
1318 |
error_str = "Wrong PORT number in GRAPHICS attribute"; |
|
1319 |
return -1; |
|
1320 |
} |
|
1320 | 1321 |
} |
1321 | 1322 |
} |
1322 | 1323 |
opennebula-5.2.1-vncautoport/src/vmm/LibVirtDriverKVM.cc 2017-04-20 12:22:36.293577743 -0500 | ||
---|---|---|
1022 | 1022 | |
1023 | 1023 |
if ( !port.empty() ) |
1024 | 1024 |
{ |
1025 |
file << " port=" << one_util::escape_xml_attr(port); |
|
1025 |
if (port == "auto") { |
|
1026 |
file << " autoport='yes'"; |
|
1027 |
} else { |
|
1028 |
file << " port=" << one_util::escape_xml_attr(port); |
|
1029 |
} |
|
1026 | 1030 |
} |
1027 | 1031 | |
1028 | 1032 |
if ( !passwd.empty() ) |
opennebula-5.2.1-vncautoport/src/vmm_mad/remotes/kvm/poll 2017-04-23 09:09:25.867408643 -0500 | ||
---|---|---|
418 | 418 | |
419 | 419 |
spice_txt = '' |
420 | 420 |
if spice |
421 |
spice_txt = %Q<GRAPHICS = [ TYPE="spice", PORT="#{spice}" ]> |
|
421 |
spice_autoport = spice.attributes['autoport'] |
|
422 | ||
423 |
if vnc_autoport == "yes" |
|
424 |
spice_txt = %Q<GRAPHICS = [ TYPE="spice", PORT="auto" ]> |
|
425 |
else |
|
426 |
spice_txt = %Q<GRAPHICS = [ TYPE="spice", PORT="#{spice}" ]> |
|
427 |
end |
|
422 | 428 |
end |
423 | 429 | |
424 | 430 |
vnc = REXML::XPath.first(doc, "/domain/devices/graphics[@type='vnc']") |
... | ... | |
426 | 432 | |
427 | 433 |
vnc_txt = '' |
428 | 434 |
if vnc |
429 |
vnc_txt = %Q<GRAPHICS = [ TYPE="vnc", PORT="#{vnc}" ]> |
|
435 |
vnc_autoport = vnc.attributes['autoport'] |
|
436 | ||
437 |
if vnc_autoport == "yes" |
|
438 |
vnc_txt = %Q<GRAPHICS = [ TYPE="vnc", PORT="auto" ]> |
|
439 |
else |
|
440 |
vnc_txt = %Q<GRAPHICS = [ TYPE="vnc", PORT="#{vnc}" ]> |
|
441 |
end |
|
430 | 442 |
end |
431 | 443 | |
432 | 444 |