[Ovirt-devel] Re: [PATCH server] allow admin to setup iptables port forwarding on server for a vm's vnc port
David Lutterkort
lutter at redhat.com
Tue Feb 3 23:31:54 UTC 2009
I haven't been able to try this out, since VM starting fails for me
right now.
ACK from reading over it, with one nit:
On Tue, 2009-02-03 at 15:33 -0500, Mohammed Morsi wrote:
> diff --git a/src/app/models/vm.rb b/src/app/models/vm.rb
> index bf99e2d..b6b5457 100644
> --- a/src/app/models/vm.rb
> +++ b/src/app/models/vm.rb
> @@ -335,6 +346,18 @@ class Vm < ActiveRecord::Base
> super
> end
>
> + # find the first available vnc port
> + def self.available_forward_vnc_port
> + i = FORWARD_VNC_PORT_START
> + Vm.find(:all,
> + :conditions => "forward_vnc_port is not NULL",
> + :order => 'forward_vnc_port ASC' ).collect{ |vm|
> + return i if vm.forward_vnc_port > i
> + i = i + 1
> + }
> + return i
> + end
The 'collect' should just be an 'each', and you can replace the 'return
i' with a 'break', since you don't care about the result of the block,
only its sideeffects.
David
More information about the ovirt-devel
mailing list