[Ovirt-devel] [PATCH] Add vnc port to database.

Chris Lalancette clalance at redhat.com
Fri Jun 13 06:54:02 UTC 2008


Ian Main wrote:
> diff --git a/wui/src/task-omatic/task_vm.rb b/wui/src/task-omatic/task_vm.rb
> index 3c81453..e3f1b51 100644
> --- a/wui/src/task-omatic/task_vm.rb
> +++ b/wui/src/task-omatic/task_vm.rb
> @@ -319,6 +319,13 @@ def start_vm(task)
>      conn = Libvirt::open("qemu+tcp://" + host.hostname + "/system")
>      dom = conn.define_domain_xml(xml.to_s)
>      dom.create
> +
> +    doc = REXML::Document.new(dom.xml_desc)
> +    attrib = REXML::XPath.match(doc, "//graphics/@port")
> +    if not attrib.empty?:
> +      vm.vnc_port = attrib.to_s.to_i
> +    end
> +

Although I realize not well tested nowadays, I think we need to have this
similar code in the restore_vm case.  That is, once we restore the VM, then we
need to fill in the vnc_port attribute again.  The reason is that on a restore,
libvirt "re-creates" the domain sort of like it is being started for the first
time.  So if you were to do: start_vm 1 ; suspend_vm 1 ; start_vm 2 ; resume_vm
1, I'm pretty sure 1 would now have a different VNC port than it originally did.

On the opposite end of that, we need to clear this vnc_port out in both
shutdown_vm and save_vm.

Otherwise, the logic looks sane.

Chris Lalancette




More information about the ovirt-devel mailing list