[Ovirt-devel] [PATCH server] allow admin to setup iptables port forwarding on server for a vm's vnc port

Mohammed Morsi mmorsi at redhat.com
Tue Jan 27 23:28:35 UTC 2009


David Lutterkort wrote:
> On Tue, 2009-01-27 at 17:32 -0500, Mohammed Morsi wrote:
>   
>> diff --git a/src/app/views/vm/_form.rhtml b/src/app/views/vm/_form.rhtml
>> index 523e81e..486798f 100644
>> --- a/src/app/views/vm/_form.rhtml
>> +++ b/src/app/views/vm/_form.rhtml
>> @@ -51,6 +51,21 @@
>>      <div class="clear_row"></div>
>>      <div class="clear_row"></div>
>>  
>> +    <div style="width: 50%; float: left;">
>> +    <%= check_box_tag_with_label "Forward vm's vnc <b>port</b> locally", "forward_vnc", 1, @vm.forward_vnc %>
>> +    </div>
>> +    <div style="width: 40%; float: left;">
>> +    <%= text_field_with_label "", "vm", "forward_vnc_port", { :style=>"width: 80px;", :size => 7, :disabled => ! @vm.forward_vnc } %>
>> +    </div>
>> +    <div style="clear:both;"></div>
>> +    <div class="clear_row"></div>
>> +    <script type="text/javascript">
>> +      $("#forward_vnc").click(function(){
>> +        $("#vm_forward_vnc_port").attr("disabled", $("#forward_vnc").is(":checked") ? "" : "disabled");
>> +      });
>> +    </script>
>> +
>> +
>>     <%= check_box_tag_with_label "Start VM Now? (pending current resource availability)", "start_now", nil if create or @vm.state == Vm::STATE_STOPPED %>
>>     <%= check_box_tag_with_label "Restart VM Now? (pending current resource availability)", "restart_now", nil if @vm.state == Vm::STATE_RUNNING %>
>>     
>
> Why does the user need to allocate the port manually ? Couldn't we do
> that internally when the VM is started and release the allocation when
> it's taken down ?
>   
This is just allowing a vm admin to set the option via the wui. I'd
think we'd want the ability not to forward the vnc for deployments when
forwarding is unecessary.

We could also simply use the vnc_port instead of adding the
forward_vnc_port field, but I also figured it would be useful if this
was administratively configurable. If this is not the case, it can be
removed easily.

Thanks for the ruby styling tips, I'll integrate your suggestions into
the server and send out another patch.

   -Mo




More information about the ovirt-devel mailing list