Difference in the value assigned to port field for Xen, KVM, LXC

Hi, I am trying to verify the KVMRedirectionSAP. I am seeing difference in the way the port value is getting assigned. I am trying to create a guest using DefineSystem(). Here is the Details of the GraphicsRASD I am passing as part of the ResourceSetting Parameter. KVM_GraphicsResourceAllocationSettingData { InstanceID = "test_redsap_dom/graphics"; ResourceType = 24; KeyMap = "en-us"; ResourceSubType = "vnc"; Address = "127.0.0.1:5931"; }; My intention is to create a guest whose vnc port has a specific value, ex: 5931 in the above case. Though the guest is getting created, the dumpxml of the guest shows that the port value is getting assigned to -1. Hence the port part of the Address field in GraphicsRASD is set to -1. Hence the port value in the ElementName/Name is supplied as -1. PS: I have used values between 5900 - 5999 for the port field in the graphics part. Here is the Xen XML details obtained from the debug statement. <domain type="xen"> <name>test_redsap_dom</name> <on_poweroff>destroy</on_poweroff> <on_crash>destroy</on_crash> <uuid>125f39c4-e0f0-4b2d-bb84-891700639af0</uuid> <os> <type>linux</type> <kernel>/tmp/default-xen-kernel</kernel> <initrd>/tmp/default-xen-initrd</initrd> <cmdline/> </os> <currentMemory>131072</currentMemory> <memory>131072</memory> <vcpu>1</vcpu> <devices> <disk type="file" device="disk"> <source file="/tmp/default-xen-dimage"/> <target dev="xvda"/> </disk> <interface type="network"> <mac address="11:22:33:aa:bb:cc"/> <source network="cimtest-networkpool"/> </interface> <input type="mouse" bus="xen"/> <graphics type="vnc" port="5931" listen="127.0.0.1" keymap="en-us"/> </devices> </domain> But I am able to create a guest with a port of my desired value for KVM. For KVM I am able to get appropriate value for the port in the Address and the ElementName/Name field of the GraphicsRASD/KVMRedirectionSAP. Here is the XML used for creating KVM guest. <domain type="kvm"> <name>test_redsap_dom</name> <on_poweroff>destroy</on_poweroff> <on_crash>destroy</on_crash> <uuid>c1c5c50b-52ce-4ba3-868e-dee42708063a</uuid> <os> <type>hvm</type> <boot dev="hd"/> </os> <currentMemory>131072</currentMemory> <memory>131072</memory> <vcpu>1</vcpu> <devices> <disk type="file" device="disk"> <source file="/tmp/default-kvm-dimage"/> <target dev="hda"/> </disk> <interface type="network"> <mac address="11:22:33:aa:bb:cc"/> <source network="cimtest-networkpool"/> </interface> <input type="mouse" bus="ps2"/> <graphics type="vnc" port="5948" listen="127.0.0.1" keymap="en-us"/> </devices> </domain> In case of LXC I am able to assign port value of choice and able to get the desired value in the Address and the ElementName/Name fields for the defined guest. But the problem with the LXC is that value of the rport in the ElementName/Name and Address is getting set to -1 even when guest is started. Also, though the virsh shows the guest as running the EnabledState value for Xen and LXC guest is still set to 3 instead of setting a value of 6. LXC: <domain type='lxc'> <name>test_redsap_dom</name> <uuid>05e67d5e-7702-46c4-a90b-2f416001f95b</uuid> <memory>131072</memory> <currentMemory>131072</currentMemory> <vcpu>0</vcpu> <os> <type arch='x86_64'>exe</type> <init>/tmp/cimtest_lxc_init</init> </os> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>destroy</on_crash> <devices> <filesystem type='mount'> <source dir='/tmp/lxc_files'/> <target dir='/tmp'/> </filesystem> <console type='pty' tty='/dev/pts/3'> <source path='/dev/pts/3'/> <target port='0'/> </console> <input type='mouse' bus='xen'/> <graphics type='vnc' port='5914' autoport='no' listen='127.0.0.1' keymap='en-us'/> </devices> </domain> Please let me know if there is something which I have missed. -- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com

Deepti B Kalakeri wrote:
Hi,
I am trying to verify the KVMRedirectionSAP. I am seeing difference in the way the port value is getting assigned. I am trying to create a guest using DefineSystem(). Here is the Details of the GraphicsRASD I am passing as part of the ResourceSetting Parameter.
KVM_GraphicsResourceAllocationSettingData { InstanceID = "test_redsap_dom/graphics"; ResourceType = 24; KeyMap = "en-us"; ResourceSubType = "vnc"; Address = "127.0.0.1:5931"; };
My intention is to create a guest whose vnc port has a specific value, ex: 5931 in the above case. Though the guest is getting created, the dumpxml of the guest shows that the port value is getting assigned to -1. Hence the port part of the Address field in GraphicsRASD is set to -1. Hence the port value in the ElementName/Name is supplied as -1.
Hi Deepti, I'm not clear which virt type you are seeing this issue on. Is this with LXC only? I wasn't able to reproduce this use. See below for the steps I followed. Let me know if these steps don't work for you.
Also, though the virsh shows the guest as running the EnabledState value for Xen and LXC guest is still set to 3 instead of setting a value of 6.
The EnabledState of the KVMRedirectionSAP changes whenever the connection is available. In this case, you'll need to be running a VNC server on your guest in order for the EnabledState to active/available. Otherwise, the KVMRedirectionSAP is offline. =================================== Steps to define an LXC guest with vnc graphics console: 1) Open file and define XML with the following: <?xml version="1.0" encoding="UTF-8"?> <CIM CIMVERSION="2.0" DTDVERSION="2.0"> <MESSAGE ID="5" PROTOCOLVERSION="1.0"> <SIMPLEREQ> <METHODCALL NAME="DefineSystem"> <LOCALINSTANCEPATH> <LOCALNAMESPACEPATH> <NAMESPACE NAME="root"/><NAMESPACE NAME="virt"/> </LOCALNAMESPACEPATH> <INSTANCENAME CLASSNAME="LXC_VirtualSystemManagementService"> <KEYBINDING NAME="CreationClassName"> <KEYVALUE VALUETYPE="string">LXC_VirtualSystemManagementService</KEYVALUE> </KEYBINDING> <KEYBINDING NAME="SystemName"> <KEYVALUE VALUETYPE="string">hostname</KEYVALUE> </KEYBINDING> </INSTANCENAME> </LOCALINSTANCEPATH> <PARAMVALUE NAME="SystemSettings" PARAMTYPE="string"> <VALUE> instance of LXC_VirtualSystemSettingData { CreationClassName = "LXC_VirtualSystemSettingData"; VirtualSystemIdentifier = "test"; ElementName = "test"; VirtualSystemType = "LXC"; AutomaticShutdownAction = 2; AutomaticRecoveryAction = 3; BootDevice = "hd"; }; </VALUE> </PARAMVALUE> <PARAMVALUE NAME="ResourceSettings" PARAMTYPE="string"> <VALUE.ARRAY> <VALUE> instance of LXC_GraphicsResourceAllocationSettingData { InstanceID = "test/graphics"; ResourceType = 24; KeyMap = "en-us"; ResourceSubType = "vnc"; Address = "127.0.0.1:5931"; }; </VALUE> </VALUE.ARRAY> </PARAMVALUE> </METHODCALL> </SIMPLEREQ> </MESSAGE> </CIM> 2) Check the defined guest: $ virsh -c lxc:///system dumpxml test <domain type='lxc'> <name>test</name> <uuid>46c027c3-d143-4b37-97c3-ac86c9c3bca6</uuid> <memory>0</memory> <currentMemory>0</currentMemory> <vcpu>0</vcpu> <os> <type arch='x86_64'>exe</type> <init>/bin/false</init> </os> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <console type='pty'> <target port='0'/> </console> <input type='mouse' bus='xen'/> <graphics type='vnc' port='5931' autoport='no' listen='127.0.0.1' keymap='en-us'/> </devices> </domain> -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com

Kaitlin Rupert wrote:
Deepti B Kalakeri wrote:
Hi,
I am trying to verify the KVMRedirectionSAP. I am seeing difference in the way the port value is getting assigned. I am trying to create a guest using DefineSystem(). Here is the Details of the GraphicsRASD I am passing as part of the ResourceSetting Parameter.
KVM_GraphicsResourceAllocationSettingData { InstanceID = "test_redsap_dom/graphics"; ResourceType = 24; KeyMap = "en-us"; ResourceSubType = "vnc"; Address = "127.0.0.1:5931"; };
My intention is to create a guest whose vnc port has a specific value, ex: 5931 in the above case. Though the guest is getting created, the dumpxml of the guest shows that the port value is getting assigned to -1. Hence the port part of the Address field in GraphicsRASD is set to -1. Hence the port value in the ElementName/Name is supplied as -1.
Hi Deepti,
I'm not clear which virt type you are seeing this issue on. Is this with LXC only? Nopes this is not LXC only issue. I am seeing different problems for different virt types.
For Xen & LXC: Though the virsh shows the guest as running the EnabledState value for Xen and LXC guest is still set to 3 instead of setting a value of 6. For Xen: I am not able to create a guest of desired port num for Graphics information. And the KVMRedirectionSAP's ElementName/Name is set to -1. For KVM: I am able to create a guest of desired port num for Graphics information. And the KVMRedirectionSAP's ElementName/Name is set to the portnum supplied to the graphics tag. Also, the EnabledState value is set appropriately. For ex: when the guest is running but the vnc session not in active use, it is getting set to 6 [PS: I did not find the vncserver running on the host].
I wasn't able to reproduce this use. See below for the steps I followed. Let me know if these steps don't work for you.
Also, though the virsh shows the guest as running the EnabledState value for Xen and LXC guest is still set to 3 instead of setting a value of 6.
The EnabledState of the KVMRedirectionSAP changes whenever the connection is available. In this case, you'll need to be running a VNC server on your guest in order for the EnabledState to active/available. Otherwise, the KVMRedirectionSAP is offline. What steps will you follow to verify the EnabledState in the available state value ?
===================================
Steps to define an LXC guest with vnc graphics console:
1) Open file and define XML with the following:
<?xml version="1.0" encoding="UTF-8"?> <CIM CIMVERSION="2.0" DTDVERSION="2.0"> <MESSAGE ID="5" PROTOCOLVERSION="1.0"> <SIMPLEREQ> <METHODCALL NAME="DefineSystem"> <LOCALINSTANCEPATH> <LOCALNAMESPACEPATH> <NAMESPACE NAME="root"/><NAMESPACE NAME="virt"/> </LOCALNAMESPACEPATH> <INSTANCENAME CLASSNAME="LXC_VirtualSystemManagementService"> <KEYBINDING NAME="CreationClassName"> <KEYVALUE VALUETYPE="string">LXC_VirtualSystemManagementService</KEYVALUE> </KEYBINDING> <KEYBINDING NAME="SystemName"> <KEYVALUE VALUETYPE="string">hostname</KEYVALUE> </KEYBINDING> </INSTANCENAME> </LOCALINSTANCEPATH> <PARAMVALUE NAME="SystemSettings" PARAMTYPE="string"> <VALUE> instance of LXC_VirtualSystemSettingData { CreationClassName = "LXC_VirtualSystemSettingData"; VirtualSystemIdentifier = "test"; ElementName = "test"; VirtualSystemType = "LXC"; AutomaticShutdownAction = 2; AutomaticRecoveryAction = 3; BootDevice = "hd"; }; </VALUE> </PARAMVALUE> <PARAMVALUE NAME="ResourceSettings" PARAMTYPE="string"> <VALUE.ARRAY> <VALUE> instance of LXC_GraphicsResourceAllocationSettingData { InstanceID = "test/graphics"; ResourceType = 24; KeyMap = "en-us"; ResourceSubType = "vnc"; Address = "127.0.0.1:5931"; }; </VALUE> </VALUE.ARRAY> </PARAMVALUE>
</METHODCALL> </SIMPLEREQ> </MESSAGE> </CIM> With what command did you execute the above XML.
2) Check the defined guest:
$ virsh -c lxc:///system dumpxml test
<domain type='lxc'> <name>test</name> <uuid>46c027c3-d143-4b37-97c3-ac86c9c3bca6</uuid> <memory>0</memory> <currentMemory>0</currentMemory> <vcpu>0</vcpu> <os> <type arch='x86_64'>exe</type> <init>/bin/false</init> </os> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <console type='pty'> <target port='0'/> </console> <input type='mouse' bus='xen'/> <graphics type='vnc' port='5931' autoport='no' listen='127.0.0.1' keymap='en-us'/> </devices> </domain>
-- Thanks and Regards, Deepti B. Kalakeri IBM Linux Technology Center deeptik@linux.vnet.ibm.com

Nopes this is not LXC only issue. I am seeing different problems for different virt types.
For Xen & LXC: Though the virsh shows the guest as running the EnabledState value for Xen and LXC guest is still set to 3 instead of setting a value of 6.
I wouldn't worry about LXC for now.
For Xen: I am not able to create a guest of desired port num for Graphics information. And the KVMRedirectionSAP's ElementName/Name is set to -1.
-1 isn't a valid port, so when the guest is created, the VNC won't listen on -1. So you won't see the EnabledState as 6. What XML are you using to define your Xen guest? I was about to define a guest with a port: localhost:5988/root/virt:Xen_KVMRedirectionSAP.CreationClassName="Xen_KVMRedirectionSAP",Name="5900:0",SystemCreationClassName="Xen_ComputerSystem",SystemName="rstest_domain" I have a RHEL 5.2 with an older version of libvirt - I can't seem to define a Xen guest with a specific port number. But when the guest is started, an appropriate port is assigned. It might worth trying with an updated version of libvirt. Either way, this behavior is with libvirt itself, not something within the provider.
===================================
Steps to define an LXC guest with vnc graphics console:
1) Open file and define XML with the following:
With what command did you execute the above XML.
wbemexec (Pegasus) or wbemcat (sfcb)
2) Check the defined guest:
$ virsh -c lxc:///system dumpxml test
-- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Deepti B Kalakeri
-
Kaitlin Rupert