Daniel P. Berrange wrote:
In the <graphics> element for VNC we have a 'port'
attribute. For a running
VM this contains the actual port number. For an inactive VM it contains
the pre-allocated fixed port number, or -1 to indicate that a automatically
allocated port should be used.
There is an obvious flaw here - if the VM is running it is impossible to
tell if its port was fixed or automatically allocated.
Oh, there are some other places where something simliar happens. For
example the network interface target device name, which also can be
either auto-allocated or hardcoded.
IMHO it is a fundamental design flaw that dumpxml gives different
results depending on whenever the domain is running or not. Hard to fix
by now though :-(
If you change the domain config using dumpxml/edit/define while the
domain is running you change the current auto-assigned values into
hardcoded config items as (unwanted) side effect. You can easily end up
with two domains being configured with tap device vnet0 and/or vnc port
5900 without noticing. And then you wounder why trying to start both
domains at the same time doesn't fly ...
So I introduce an extra attribute autoport='no|yes' to
provide this
data. For compatability we still use port='-1' when the VM is not running
Yep, that should band-aid at least the vnc port case.
cheers,
Gerd
--
http://kraxel.fedorapeople.org/xenner/