[Ovirt-devel] [PATCH server] fixed static ip address of management port in taskomatic vnc module

Mohammed Morsi mmorsi at redhat.com
Fri Mar 6 01:30:33 UTC 2009


---
 src/task-omatic/vnc.rb |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/task-omatic/vnc.rb b/src/task-omatic/vnc.rb
index 0fd3afd..b0a800a 100644
--- a/src/task-omatic/vnc.rb
+++ b/src/task-omatic/vnc.rb
@@ -27,11 +27,6 @@ class VmVnc
 
     VNC_DEBUG = false
 
-    # FIXME can this be retreived in any way
-    # since machine will have both external
-    # and internal network interface
-    LOCAL_IP = '192.168.50.2'
-
     def self.debug(msg)
       puts "\n" + msg + "\n" if VNC_DEBUG
     end
@@ -81,8 +76,10 @@ class VmVnc
     def self.get_nat_rules(vm)
       ip = find_host_ip(vm.host.hostname)
 
+      server,port = get_srv('ovirt', 'tcp')
+      local_ip = find_host_ip(server)
       return " -p tcp --dport " + vm.forward_vnc_port.to_s + " -j DNAT --to " + ip + ":" + vm.vnc_port.to_s,
-             " -d " + ip + " -p tcp --dport " + vm.vnc_port.to_s + " -j SNAT --to " + LOCAL_IP
+             " -d " + ip + " -p tcp --dport " + vm.vnc_port.to_s + " -j SNAT --to " + local_ip
     end
 
     def self.run_command(cmd)
-- 
1.6.0.6




More information about the ovirt-devel mailing list