From cvincent at linux.vnet.ibm.com Tue Jul 5 16:20:36 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Tue, 05 Jul 2011 12:20:36 -0400 Subject: [Libvirt-cim] [PATCH] [TEST] Fix exception in tests In-Reply-To: <6397c0670c35acc78ac1.1309289961@etrunko-t410.br.ibm.com> References: <6397c0670c35acc78ac1.1309289961@etrunko-t410.br.ibm.com> Message-ID: <4E1339D4.7010600@linux.vnet.ibm.com> +1. Here's my results: -------------------------------------------------------------------- Memory - 01_memory.py: PASS -------------------------------------------------------------------- SettingsDefineCapabilities - 01_forward.py: PASS -------------------------------------------------------------------- VirtualSystemManagementService - 28_definesystem_with_vsi_profile.py: XFAIL ERROR - Got CIM error CIM_ERR_FAILED: Unable to start domain: internal error interface eth1 does not exist with return code 1 ERROR - Unable to start VM *** Is VSI support available on this host? *** InvokeMethod(RequestStateChange): CIM_ERR_FAILED: Unable to start domain: internal error interface eth1 does not exist -------------------------------------------------------------------- The failure appears unrelated to your patch. Pushed. On 06/28/2011 03:39 PM, Eduardo Lima (Etrunko) wrote: > # HG changeset patch > # User Eduardo Lima (Etrunko) > # Date 1309289907 10800 > # Node ID 6397c0670c35acc78ac13d737b408bb90e30632e > # Parent 3c218fe48bb7b9d89549dcca213dd7e0b60035af > [TEST] Fix exception in tests > > -------------------------------------------------------------------- > Memory - 01_memory.py: FAIL > ERROR - Got CIM error CIM_ERR_FAILED: Failed to define domain: operation virDomainDefineXML forbidden for read only access with return code 1 > Traceback (most recent call last): > File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try > rc = f() > File "01_memory.py", line 66, in main > capacity = dev.ConsumableBlocks * dev.BlockSize / 1024 > AttributeError: 'NoneType' object has no attribute 'ConsumableBlocks' > > -------------------------------------------------------------------- > SettingsDefineCapabilities - 01_forward.py: FAIL > ERROR - [dpool, mpool, ppool, npool] None > ERROR - TypeError : 'int' object is not iterable > Traceback (most recent call last): > File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try > rc = f() > File "01_forward.py", line 204, in main > status, pool = get_pool_details(virt, server) > TypeError: 'int' object is not iterable > > -------------------------------------------------------------------- > VirtualSystemManagementService - 28_definesystem_with_vsi_profile.py: FAIL > ERROR - Exception: 'NoneType' object has no attribute 'InstanceID' > ERROR - Unable to get template RASDs for vsi_guest > ERROR - UnboundLocalError : local variable 'cxml' referenced before assignment > Traceback (most recent call last): > File "/home/etrunko/projects/virt/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", line 140, in do_try > rc = f() > File "28_definesystem_with_vsi_profile.py", line 211, in main > cxml.cim_destroy(server) > UnboundLocalError: local variable 'cxml' referenced before assignment > > Signed-off-by: Eduardo Lima (Etrunko) > > diff --git a/suites/libvirt-cim/cimtest/Memory/01_memory.py b/suites/libvirt-cim/cimtest/Memory/01_memory.py > --- a/suites/libvirt-cim/cimtest/Memory/01_memory.py > +++ b/suites/libvirt-cim/cimtest/Memory/01_memory.py > @@ -59,15 +59,16 @@ > if dev is None: > logger.error("GetInstance() returned None") > status = 1 > - elif dev.ConsumableBlocks> dev.NumberOfBlocks: > - logger.error("ConsumableBlocks should not be larger than NumberOfBlocks") > - status = 1 > + else: > + if dev.ConsumableBlocks> dev.NumberOfBlocks: > + logger.error("ConsumableBlocks should not be larger than NumberOfBlocks") > + status = 1 > > - capacity = dev.ConsumableBlocks * dev.BlockSize / 1024 > + capacity = dev.ConsumableBlocks * dev.BlockSize / 1024 > > - if capacity != alloc_mem: > - logger.error("Capacity should be %i MB instead of %i MB", alloc_mem, capacity) > - status = 1 > + if capacity != alloc_mem: > + logger.error("Capacity should be %i MB instead of %i MB", alloc_mem, capacity) > + status = 1 > > if status == 0: > logger.info("Checked memory capacity: %s MB", capacity) > diff --git a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py > --- a/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py > +++ b/suites/libvirt-cim/cimtest/SettingsDefineCapabilities/01_forward.py > @@ -142,7 +142,7 @@ > if dpool.InstanceID == None or mpool.InstanceID == None \ > or npool.InstanceID == None or ppool.InstanceID == None: > logger.error("Get pool None") > - return FAIL > + return FAIL, None > else: > pool_set = [dpool, mpool, ppool, npool] > except Exception, detail: > diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py > --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py > +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py > @@ -175,6 +175,7 @@ > > nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData') > status = FAIL > + cxml = None > > try: > rasd_list = get_rasd_list(server, virt, vsi_defaults, nrasd_cn) > @@ -208,8 +209,9 @@ > except Exception, details: > logger.error(details) > > - cxml.cim_destroy(server) > - cxml.undefine(server) > + if cxml is not None: > + cxml.cim_destroy(server) > + cxml.undefine(server) > > return status > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From eblima at linux.vnet.ibm.com Tue Jul 5 18:52:54 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Tue, 05 Jul 2011 15:52:54 -0300 Subject: [Libvirt-cim] [PATCH] libvirt-cim.spec: Use %config(noreplace) for libvirt-cim.conf Message-ID: # HG changeset patch # User Eduardo Lima (Etrunko) # Date 1309891951 10800 # Node ID cd4aec302d94b587ede84e68356998c01188f265 # Parent 20138a9d4f2b4780664545e412cab7a4c26d7503 libvirt-cim.spec: Use %config(noreplace) for libvirt-cim.conf This way we avoid overwriting eventual changes to the config file introduced manually. Reference: - http://www-uxsup.csx.cam.ac.uk/~jw35/docs/rpm_config.html Signed-off-by: Eduardo Lima (Etrunko) diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in --- a/libvirt-cim.spec.in +++ b/libvirt-cim.spec.in @@ -136,7 +136,7 @@ %{_datadir}/libvirt-cim/*.registration %{_datadir}/libvirt-cim/cim_schema_*-MOFs.zip %{_sysconfdir}/ld.so.conf.d/libvirt-cim.conf -%{_sysconfdir}/libvirt-cim.conf +%config(noreplace) %{_sysconfdir}/libvirt-cim.conf %changelog * Wed Oct 28 2009 Richard Maciel - 0.1-1 From cvincent at linux.vnet.ibm.com Wed Jul 6 15:14:57 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 06 Jul 2011 11:14:57 -0400 Subject: [Libvirt-cim] [PATCH 1 of 1] [TEST] Don't send commands via ssh for localhost In-Reply-To: References: Message-ID: <4E147BF1.8090004@linux.vnet.ibm.com> Awesome. +1. Pushed. On 06/30/2011 12:04 PM, Eduardo Lima (Etrunko) wrote: > # HG changeset patch > # User Eduardo Lima (Etrunko) > # Date 1306519808 10800 > # Node ID fcce3eb554659cd76e020f3cb852c352e6a02218 > # Parent 6397c0670c35acc78ac13d737b408bb90e30632e > [TEST] Don't send commands via ssh for localhost > > Also changes python strings format in many other files. Some commands > required double quotes to work properly when executed locally. > > Signed-off-by: Eduardo Lima (Etrunko) > > diff --git a/lib/VirtLib/live.py b/lib/VirtLib/live.py > --- a/lib/VirtLib/live.py > +++ b/lib/VirtLib/live.py > @@ -30,7 +30,7 @@ > """Return a list of the available bridges in the running dom0. > """ > > - cmd = "brctl show | grep -v 'bridge name' | awk '/^[^\t]/ { print \$1 }'" > + cmd = 'brctl show | grep -v "bridge name" | awk "/^[^\\t]/ { print \$1 }"' > > rc, out = utils.run_remote(ip, cmd) > if rc != 0: > @@ -39,8 +39,8 @@ > return out.splitlines() > > def exclude_vir_bridge(ip): > - cmd = "brctl show | grep -v 'bridge name' | grep -v vir | \ > - grep -v vif | awk '/^[^\t]/ { print \$1 }'" > + cmd = 'brctl show | grep -v "bridge name" | grep -v vir | \ > + grep -v vif | awk "/^[^\\t]/ { print \$1 }"' > rc, out = utils.run_remote(ip, cmd) > if rc != 0: > return [] > @@ -51,7 +51,7 @@ > """Return a list of the available virtual bridges in the running dom0. > """ > > - cmd = "brctl show | grep -v 'bridge name' | grep -v peth | awk '/^[^\t]/ { print \$1 }'" > + cmd = 'brctl show | grep -v "bridge name" | grep -v peth | awk "/^[^\\t]/ { print \$1 }"' > > rc, out = utils.run_remote(ip, cmd) > if rc != 0: > @@ -78,14 +78,14 @@ > """ > > xm_ret, mfm = utils.run_remote(server, > - "xm info | awk -F ': ' '/max_free_memory/ {print \$2}'") > + 'xm info | awk -F ": " "/max_free_memory/ {print \$2}"') > if xm_ret != 0: > return None > > return int(mfm) > > def fv_cap(server): > - cmd = "egrep flags /proc/cpuinfo | uniq | egrep 'vmx|svm'" > + cmd = 'egrep flags /proc/cpuinfo | uniq | egrep "vmx|svm"' > ret, out = utils.run_remote(server, cmd) > return ret == 0 > > diff --git a/lib/VirtLib/utils.py b/lib/VirtLib/utils.py > --- a/lib/VirtLib/utils.py > +++ b/lib/VirtLib/utils.py > @@ -31,15 +31,24 @@ > SSH_KEY = os.path.join(root_dot_ssh, 'id_rsa') > AUTHED_KEYS = os.path.join(root_dot_ssh, 'authorized_keys') > > +localhost = ["0.0.0.0", "127.0.0.1", "localhost"] > + > def run_remote(ip, cmd): > > - cmd = 'ssh %s -i %s root@%s "%s"' % (SSH_PARMS, SSH_KEY, ip, cmd) > + if ip not in localhost: > + cmd = "ssh %s -i %s root@%s '%s'" % (SSH_PARMS, SSH_KEY, ip, cmd) > return commands.getstatusoutput(cmd) > > def copy_remote(ip, local, remote='/tmp'): > > - cmd = 'scp -r %s -i %s %s root@%s:%s' % (SSH_PARMS, > - SSH_KEY, local, ip, remote) > + if ip not in localhost: > + cmd = 'scp -r %s -i %s %s root@%s:%s' % (SSH_PARMS, > + SSH_KEY, local, ip, remote) > + else: > + if local == remote: > + return (0, "") > + cmd = 'cp -r %s %s' % (local, remote) > + > return commands.getstatusoutput(cmd) > > def setup_ssh_key(): > diff --git a/suites/libvirt-cim/lib/XenKvmLib/common_util.py b/suites/libvirt-cim/lib/XenKvmLib/common_util.py > --- a/suites/libvirt-cim/lib/XenKvmLib/common_util.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/common_util.py > @@ -243,7 +243,7 @@ > rc, out = utils.run_remote(ip, cmd) > > if rc == 0 : > - cmd = "%s | awk '{ print \$8 }' | uniq" % cmd > + cmd = '%s | awk "{ print \$8 }" | uniq' % cmd > rc, out = utils.run_remote(ip, cmd) > > return rc, out > @@ -252,7 +252,7 @@ > cmd = "virsh -c %s list --all 2>/dev/null" % virt2uri(virt) > ret, out = utils.run_remote(ip, cmd) > if ret != 0: > - return "This libvirt install does not support %s" % virt > + return "The libvirt install on '%s' does not support %s" % (ip, virt) > > cmd = "virsh -c %s version 2>/dev/null" % virt2uri(virt) > ret, out = utils.run_remote(ip, cmd) > @@ -491,7 +491,7 @@ > > > def get_nfs_bin(server): > - cmd = "cat /etc/issue | grep -v ^$ | egrep 'Red Hat|Fedora'" > + cmd = 'cat /etc/issue | grep -v ^$ | egrep "Red Hat|Fedora"' > rc, out = utils.run_remote(server, cmd) > if rc != 0: > #SLES > diff --git a/suites/libvirt-cim/lib/XenKvmLib/const.py b/suites/libvirt-cim/lib/XenKvmLib/const.py > --- a/suites/libvirt-cim/lib/XenKvmLib/const.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/const.py > @@ -166,7 +166,7 @@ > # This is a sloppy mechanism for detecting a distro defined revision value > distro = None > > - cmd = "cat /etc/issue | grep 'SUSE Linux Enterprise Server 11'" > + cmd = 'cat /etc/issue | grep "SUSE Linux Enterprise Server 11"' > rc, out = run_remote(ip, cmd) > if rc == 0: > distro = "sles11" > diff --git a/suites/libvirt-cim/lib/XenKvmLib/pool.py b/suites/libvirt-cim/lib/XenKvmLib/pool.py > --- a/suites/libvirt-cim/lib/XenKvmLib/pool.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/pool.py > @@ -107,7 +107,7 @@ > > def enum_volumes(virt, server, pooln=default_pool_name): > volume = 0 > - cmd = "virsh -c %s vol-list %s 2>/dev/null | sed -e '1,2 d' -e '$ d'" % \ > + cmd = 'virsh -c %s vol-list %s 2>/dev/null | sed -e "1,2 d" -e "$ d"' % \ > (virt2uri(virt), pooln) > ret, out = run_remote(server ,cmd) > if ret != 0: > diff --git a/suites/libvirt-cim/lib/XenKvmLib/reporting.py b/suites/libvirt-cim/lib/XenKvmLib/reporting.py > --- a/suites/libvirt-cim/lib/XenKvmLib/reporting.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/reporting.py > @@ -87,7 +87,7 @@ > > > def get_env_data(ip, virt): > - distro = get_cmd_val("cat /etc/issue | sed '/^$/d' | awk 'NR<=1'", ip) > + distro = get_cmd_val('cat /etc/issue | sed "/^$/d" | awk "NR<=1"', ip) > if 'SUSE' in distro: > distro = (distro.split('-'))[0].split('to')[1] > > diff --git a/suites/libvirt-cim/lib/XenKvmLib/test_doms.py b/suites/libvirt-cim/lib/XenKvmLib/test_doms.py > --- a/suites/libvirt-cim/lib/XenKvmLib/test_doms.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/test_doms.py > @@ -67,7 +67,7 @@ > def virdomid_list(server, virt="Xen"): > """Get a list of domid from virsh""" > > - cmd = "virsh -c %s list 2>/dev/null | sed '1,2 d; /^$/d'" % \ > + cmd = 'virsh -c %s list 2>/dev/null | sed "1,2 d; /^$/d"' % \ > virt2uri(virt) > ret, out = utils.run_remote(server, cmd) > if ret != 0: > @@ -108,7 +108,7 @@ > > def viruuid(name, server, virt="Xen"): > """Return domain uuid given domid or domname""" > - cmd = "virsh -c %s domuuid %s 2>/dev/null | sed '/^$/d'" % \ > + cmd = 'virsh -c %s domuuid %s 2>/dev/null | sed "/^$/d"' % \ > (virt2uri(virt), name) > ret, out = utils.run_remote(server, cmd) > if ret == 0: > @@ -119,7 +119,7 @@ > def destroy_and_undefine_domain(name, server, virt="Xen"): > """Destroy and undefine a domain. > name could be domid or domname""" > - cmd = "virsh -c %s 'destroy %s ; undefine %s' 2>/dev/null" % \ > + cmd = 'virsh -c %s "destroy %s ; undefine %s" 2>/dev/null' % \ > (virt2uri(virt), name, name) > utils.run_remote(server, cmd) > > @@ -164,7 +164,7 @@ > """ > Get the vcpu lists. The input is either the domid or domname. > """ > - cmd = "virsh -c %s vcpuinfo %s 2>/dev/null | grep '^$' | wc -l" % \ > + cmd = 'virsh -c %s vcpuinfo %s 2>/dev/null | grep "^$" | wc -l' % \ > (virt2uri(virt), name_id) > ret, out = utils.run_remote(server, cmd) > > diff --git a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py > --- a/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py > +++ b/suites/libvirt-cim/lib/XenKvmLib/xm_virt_util.py > @@ -50,7 +50,7 @@ > specified bridge. > """ > > - cmd = "brctl show %s | grep 'vif' | grep -v vif0.*" % bridge > + cmd = 'brctl show %s | grep "vif" | grep -v vif0.*' % bridge > > rc, out = utils.run_remote(ip, cmd) > if rc != 0: > @@ -71,7 +71,7 @@ > """Returns the list of disk of the specified VS > """ > > - guest_cmd = "cat /proc/partitions | awk '/^ /{ print $4 } ' " > + guest_cmd = 'cat /proc/partitions | awk "/^ /{ print $4 } " ' > rc, out = run_remote_guest(ip, vs_name, guest_cmd) > > if rc != 0: > @@ -86,7 +86,7 @@ > """ > > xm_ret, mfm = utils.run_remote(server, > - "xm info | awk -F ': ' '/max_free_memory/ {print \$2}'") > + 'xm info | awk -F ": " "/max_free_memory/ {print \$2}"') > if xm_ret != 0: > return None > > @@ -108,7 +108,7 @@ > if virt == "XenFV": > virt = "Xen" > > - cmd = "virsh -c %s list --all 2>/dev/null | sed -e '1,2 d' -e '$ d'" % \ > + cmd = 'virsh -c %s list --all 2>/dev/null | sed -e "1,2 d" -e "$ d"' % \ > virt2uri(virt) > ret, out = utils.run_remote(server, cmd) > > @@ -128,7 +128,7 @@ > if virt == "XenFV": > virt = "Xen" > > - cmd = "virsh -c %s list 2>/dev/null | sed -e '1,2 d' -e '$ d'" % \ > + cmd = 'virsh -c %s list 2>/dev/null | sed -e "1,2 d" -e "$ d"' % \ > virt2uri(virt) > ret, out = utils.run_remote(server, cmd) > > @@ -162,7 +162,7 @@ > if fv_cap(server) and gtype == 1: > bootloader = "/usr/lib/xen/boot/hvmloader" > else: > - cmd = "cat /etc/issue | grep -v ^$ | egrep 'Red Hat|Fedora'" > + cmd = 'cat /etc/issue | grep -v ^$ | egrep "Red Hat|Fedora"' > ret, out = utils.run_remote(server,cmd) > if ret != 0: > # For SLES > @@ -175,7 +175,7 @@ > def net_list(server, virt="Xen"): > """Function to list active network""" > names = [] > - cmd = "virsh -c %s net-list 2>/dev/null | sed -e '1,2 d' -e '$ d'" % \ > + cmd = 'virsh -c %s net-list 2>/dev/null | sed -e "1,2 d" -e "$ d"' % \ > virt2uri(virt) > ret, out = utils.run_remote(server, cmd) > > @@ -192,8 +192,8 @@ > def get_bridge_from_network_xml(network, server, virt="Xen"): > """Function returns bridge name for a given virtual network""" > > - cmd = "virsh -c %s net-dumpxml %s 2>/dev/null | \ > - awk '/bridge name/ { print $2 }'" % (virt2uri(virt), network) > + cmd = 'virsh -c %s net-dumpxml %s 2>/dev/null | \ > + awk "/bridge name/ { print $2 }"' % (virt2uri(virt), network) > ret, out = utils.run_remote(server, cmd) > > if ret != 0: > @@ -233,7 +233,7 @@ > def diskpool_list(server, virt="KVM"): > """Function to list active DiskPool list""" > names = [] > - cmd = "virsh -c %s pool-list 2>/dev/null | sed -e '1,2 d' -e '$ d'" % \ > + cmd = 'virsh -c %s pool-list 2>/dev/null | sed -e "1,2 d" -e "$ d"' % \ > virt2uri(virt) > ret, out = utils.run_remote(server, cmd) > > @@ -251,7 +251,7 @@ > def vol_list(server, virt="KVM", pool_name=None): > """ Function to list the volumes of a pool""" > > - cmd = "virsh -c %s vol-list %s 2>/dev/null | sed -e '1,2 d' -e '$ d'" \ > + cmd = 'virsh -c %s vol-list %s 2>/dev/null | sed -e "1,2 d" -e "$ d"' \ > % (virt2uri(virt), pool_name) > ret, out = utils.run_remote(server, cmd) > if ret != 0: > @@ -283,14 +283,14 @@ > cmd = "virsh -c %s version 2>/dev/null" %virt2uri(virt) > ret, out = utils.run_remote(server, cmd) > if ret == 0: > - cmd = "virsh -c %s version 2>/dev/null | grep ^Running | \ > - cut -d ' ' -f 3,4" % virt2uri(virt) > + cmd = 'virsh -c %s version 2>/dev/null | grep ^Running | \ > + cut -d " " -f 3,4' % virt2uri(virt) > > # This is a workaround work for F10. > # The version option does not seem to work on F10. > if ret != 0 and virt == 'KVM': > - cmd = "qemu-kvm --help | grep -i version | tr -s [:space:] |" \ > - " cut -d ' ' -f 1,5" > + cmd = 'qemu-kvm --help | grep -i version | tr -s [:space:] |' \ > + ' cut -d " " -f 1,5' > > ret, out = utils.run_remote(server, cmd) > if ret == 0: > @@ -362,7 +362,7 @@ > """Returns the number of processors of the specified VS > """ > > - guest_cmd = "grep '^$' /proc/cpuinfo | wc -l" > + guest_cmd = 'grep "^$" /proc/cpuinfo | wc -l' > > rc, out = run_remote_guest(ip, vs_name, guest_cmd) > if rc != 0: > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Wed Jul 6 17:05:40 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 06 Jul 2011 13:05:40 -0400 Subject: [Libvirt-cim] [PATCH] Minor fix for MemoryPool.AllocationUnits Message-ID: # HG changeset patch # User Chip Vincent # Date 1309971496 14400 # Node ID a0dd50c2e523174794974dd1666e8fd611673d3a # Parent 20138a9d4f2b4780664545e412cab7a4c26d7503 Minor fix for MemoryPool.AllocationUnits The property value from AllocationUnits in the MemoryPool shows "bytes*210". The correct value should be "bytes*2^10". This fix is essential for clients to properly convert/calculate. Reference: DSP1045 - MemoryResourceAllocationProfile (ch.7.1 AllocationUnits) Signed-off-by: Chip Vincent diff --git a/src/Virt_DevicePool.c b/src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c +++ b/src/Virt_DevicePool.c @@ -797,7 +797,7 @@ mempool_set_total(inst, conn); mempool_set_consumed(inst, conn); - set_params(inst, CIM_RES_TYPE_MEM, id, "byte*210", NULL, true); + set_params(inst, CIM_RES_TYPE_MEM, id, "byte*2^10", NULL, true); inst_list_add(list, inst); From eblima at linux.vnet.ibm.com Wed Jul 6 17:12:35 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Wed, 06 Jul 2011 14:12:35 -0300 Subject: [Libvirt-cim] [PATCH] Minor fix for MemoryPool.AllocationUnits In-Reply-To: References: Message-ID: <4E149783.10304@linux.vnet.ibm.com> On 07/06/2011 02:05 PM, Chip Vincent wrote: > # HG changeset patch > # User Chip Vincent > # Date 1309971496 14400 > # Node ID a0dd50c2e523174794974dd1666e8fd611673d3a > # Parent 20138a9d4f2b4780664545e412cab7a4c26d7503 > Minor fix for MemoryPool.AllocationUnits > > The property value from AllocationUnits in the MemoryPool shows "bytes*210". > The correct value should be "bytes*2^10". This fix is essential for clients > to properly convert/calculate. > > Reference: DSP1045 - MemoryResourceAllocationProfile (ch.7.1 AllocationUnits) > > Signed-off-by: Chip Vincent > > diff --git a/src/Virt_DevicePool.c b/src/Virt_DevicePool.c > --- a/src/Virt_DevicePool.c > +++ b/src/Virt_DevicePool.c > @@ -797,7 +797,7 @@ > mempool_set_total(inst, conn); > mempool_set_consumed(inst, conn); > > - set_params(inst, CIM_RES_TYPE_MEM, id, "byte*210", NULL, true); > + set_params(inst, CIM_RES_TYPE_MEM, id, "byte*2^10", NULL, true); Problem with deadkeys? +1 -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From cvincent at linux.vnet.ibm.com Wed Jul 6 17:30:35 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 06 Jul 2011 13:30:35 -0400 Subject: [Libvirt-cim] [PATCH] Minor fix for MemoryPool.AllocationUnits In-Reply-To: <4E149783.10304@linux.vnet.ibm.com> References: <4E149783.10304@linux.vnet.ibm.com> Message-ID: <4E149BBB.9070000@linux.vnet.ibm.com> :) Thanks. Pushed. On 07/06/2011 01:12 PM, Eduardo Lima (Etrunko) wrote: > On 07/06/2011 02:05 PM, Chip Vincent wrote: >> # HG changeset patch >> # User Chip Vincent >> # Date 1309971496 14400 >> # Node ID a0dd50c2e523174794974dd1666e8fd611673d3a >> # Parent 20138a9d4f2b4780664545e412cab7a4c26d7503 >> Minor fix for MemoryPool.AllocationUnits >> >> The property value from AllocationUnits in the MemoryPool shows >> "bytes*210". >> The correct value should be "bytes*2^10". This fix is essential for >> clients >> to properly convert/calculate. >> >> Reference: DSP1045 - MemoryResourceAllocationProfile (ch.7.1 >> AllocationUnits) >> >> Signed-off-by: Chip Vincent >> >> diff --git a/src/Virt_DevicePool.c b/src/Virt_DevicePool.c >> --- a/src/Virt_DevicePool.c >> +++ b/src/Virt_DevicePool.c >> @@ -797,7 +797,7 @@ >> mempool_set_total(inst, conn); >> mempool_set_consumed(inst, conn); >> >> - set_params(inst, CIM_RES_TYPE_MEM, id, "byte*210", NULL, true); >> + set_params(inst, CIM_RES_TYPE_MEM, id, "byte*2^10", NULL, true); > > Problem with deadkeys? > > +1 > -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From veillard at redhat.com Thu Jul 7 01:07:50 2011 From: veillard at redhat.com (Daniel Veillard) Date: Thu, 7 Jul 2011 09:07:50 +0800 Subject: [Libvirt-cim] [PATCH] libvirt-cim.spec: Use %config(noreplace) for libvirt-cim.conf In-Reply-To: References: Message-ID: <20110707010750.GB3871@redhat.com> On Tue, Jul 05, 2011 at 03:52:54PM -0300, Eduardo Lima (Etrunko) wrote: > # HG changeset patch > # User Eduardo Lima (Etrunko) > # Date 1309891951 10800 > # Node ID cd4aec302d94b587ede84e68356998c01188f265 > # Parent 20138a9d4f2b4780664545e412cab7a4c26d7503 > libvirt-cim.spec: Use %config(noreplace) for libvirt-cim.conf > > This way we avoid overwriting eventual changes to the config file > introduced manually. > > Reference: > - http://www-uxsup.csx.cam.ac.uk/~jw35/docs/rpm_config.html > > Signed-off-by: Eduardo Lima (Etrunko) > > diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in > --- a/libvirt-cim.spec.in > +++ b/libvirt-cim.spec.in > @@ -136,7 +136,7 @@ > %{_datadir}/libvirt-cim/*.registration > %{_datadir}/libvirt-cim/cim_schema_*-MOFs.zip > %{_sysconfdir}/ld.so.conf.d/libvirt-cim.conf > -%{_sysconfdir}/libvirt-cim.conf > +%config(noreplace) %{_sysconfdir}/libvirt-cim.conf > > %changelog > * Wed Oct 28 2009 Richard Maciel - 0.1-1 Definitely, having edited config files cleaned up on updates is really nasty, ACK, +1 Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ From cvincent at linux.vnet.ibm.com Thu Jul 7 01:57:07 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 06 Jul 2011 21:57:07 -0400 Subject: [Libvirt-cim] [PATCH] libvirt-cim.spec: Use %config(noreplace) for libvirt-cim.conf In-Reply-To: <20110707010750.GB3871@redhat.com> References: <20110707010750.GB3871@redhat.com> Message-ID: <4E151273.9040907@linux.vnet.ibm.com> Pushed. On 07/06/2011 09:07 PM, Daniel Veillard wrote: > On Tue, Jul 05, 2011 at 03:52:54PM -0300, Eduardo Lima (Etrunko) wrote: >> # HG changeset patch >> # User Eduardo Lima (Etrunko) >> # Date 1309891951 10800 >> # Node ID cd4aec302d94b587ede84e68356998c01188f265 >> # Parent 20138a9d4f2b4780664545e412cab7a4c26d7503 >> libvirt-cim.spec: Use %config(noreplace) for libvirt-cim.conf >> >> This way we avoid overwriting eventual changes to the config file >> introduced manually. >> >> Reference: >> - http://www-uxsup.csx.cam.ac.uk/~jw35/docs/rpm_config.html >> >> Signed-off-by: Eduardo Lima (Etrunko) >> >> diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in >> --- a/libvirt-cim.spec.in >> +++ b/libvirt-cim.spec.in >> @@ -136,7 +136,7 @@ >> %{_datadir}/libvirt-cim/*.registration >> %{_datadir}/libvirt-cim/cim_schema_*-MOFs.zip >> %{_sysconfdir}/ld.so.conf.d/libvirt-cim.conf >> -%{_sysconfdir}/libvirt-cim.conf >> +%config(noreplace) %{_sysconfdir}/libvirt-cim.conf >> >> %changelog >> * Wed Oct 28 2009 Richard Maciel - 0.1-1 > > Definitely, having edited config files cleaned up on updates is > really nasty, ACK, +1 > > Daniel > -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From eblima at linux.vnet.ibm.com Fri Jul 8 18:26:12 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Fri, 08 Jul 2011 15:26:12 -0300 Subject: [Libvirt-cim] [PATCH] Make libconfig requirement optional Message-ID: <2823d4e157125fc47668.1310149572@etrunko-t410.br.ibm.com> # HG changeset patch # User Eduardo Lima (Etrunko) # Date 1310149559 10800 # Node ID 2823d4e157125fc47668a9f0d6ef2f52e52169ce # Parent 395f2d684c1046455462db7e4e87d30e7aae0feb Make libconfig requirement optional libconfig is a required to build libvirt-cim since r1104, but the package is not included in RHEL 5, which we still support. This patch enables libvirt-cim to be built even if libconfig is not found. Note that it will not be possible for users of that distro to configure libvirt-cim to operate in read-only mode. Signed-off-by: Eduardo Lima (Etrunko) diff --git a/acinclude.m4 b/acinclude.m4 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -272,7 +272,11 @@ AC_DEFUN([CHECK_LIBCONFIG], [ - PKG_CHECK_MODULES([LIBCONFIG], [libconfig]) + PKG_CHECK_MODULES([LIBCONFIG], [libconfig], + [LIBCONFIG_FOUND=yes], [LIBCONFIG_FOUND=no]) + if test "$LIBCONFIG_FOUND" = "yes" ; then + AC_DEFINE(HAVE_LIBCONFIG, 1, [Define if libconfig development files were found]) + fi AC_SUBST([LIBCONFIG_CFLAGS]) AC_SUBST([LIBCONFIG_LIBS]) CPPFLAGS="$CPPFLAGS $LIBCONFIG_CFLAGS" diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in --- a/libvirt-cim.spec.in +++ b/libvirt-cim.spec.in @@ -22,11 +22,11 @@ BuildRequires: e2fsprogs-devel %else BuildRequires: libuuid-devel +BuildRequires: libconfig-devel %endif BuildRequires: libxml2-devel BuildRequires: libcmpiutil-devel -BuildRequires: libconfig-devel BuildConflicts: sblim-cmpi-devel %description diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c --- a/libxkutil/misc_util.c +++ b/libxkutil/misc_util.c @@ -20,6 +20,8 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include #include @@ -35,12 +37,14 @@ #include #include + +#ifdef HAVE_LIBCONFIG #include +#endif #include "misc_util.h" #include "cs_util.h" -#include "config.h" #define URI_ENV "HYPURI" @@ -58,8 +62,11 @@ static int is_read_only(void) { + int readonly = 0; + +#ifdef HAVE_LIBCONFIG config_t conf; - int ret, readonly = 0; + int ret; const char *readonly_str = "readonly"; config_init(&conf); @@ -82,6 +89,7 @@ LIBVIRTCIM_CONF, readonly); out: config_destroy(&conf); +#endif /* Default value is 0 (false) */ return readonly; From eblima at linux.vnet.ibm.com Tue Jul 12 19:02:33 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Tue, 12 Jul 2011 16:02:33 -0300 Subject: [Libvirt-cim] [PATCH] [TEST] Update .hgignore Message-ID: <021243e63a3b9e0b7096.1310497353@etrunko-t410.br.ibm.com> # HG changeset patch # User Eduardo Lima (Etrunko) # Date 1310497347 10800 # Node ID 021243e63a3b9e0b709618886b63a66d6ab5adc3 # Parent 26f6e541a714d5a915e4149554e057ba7ac328d1 [TEST] Update .hgignore Signed-off-by: Eduardo Lima (Etrunko) diff --git a/.hgignore b/.hgignore --- a/.hgignore +++ b/.hgignore @@ -1,1 +1,4 @@ .*.pyc +.*.log +.*~ +run_report.txt From xiawenc at linux.vnet.ibm.com Thu Jul 14 06:32:34 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Thu, 14 Jul 2011 14:32:34 +0800 Subject: [Libvirt-cim] [PATCH] Add SDL graphic device support Message-ID: <4E1E8D82.8080802@linux.vnet.ibm.com> # HG changeset patch # User Wayne Xia # Date 1310271518 -28800 # Node ID ec5e5be04391afa9bab3b4a59bc5596a68a9f175 # Parent 395f2d684c1046455462db7e4e87d30e7aae0feb Add SDL graphic device support the options are described in ResourceAllocationSettingData.mof Signed-off-by: Wayne Xia diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Tue Jul 05 15:52:31 2011 -0300 +++ b/libxkutil/device_parsing.c Sun Jul 10 12:18:38 2011 +0800 @@ -90,11 +90,16 @@ static void cleanup_graphics_device(struct graphics_device *dev) { - free(dev->type); - free(dev->port); - free(dev->host); - free(dev->keymap); - free(dev->passwd); + if (dev->type !=NULL) + free(dev->type); + if (dev->port !=NULL) + free(dev->port); + if (dev->host !=NULL) + free(dev->host); + if (dev->keymap !=NULL) + free(dev->keymap); + if (dev->passwd !=NULL) + free(dev->passwd); } static void cleanup_input_device(struct input_device *dev) @@ -529,6 +534,13 @@ if (gdev->port == NULL || gdev->host == NULL) goto err; } + else if (STREQC(gdev->type, "sdl")) { + SDL_display(gdev) = get_attr_value(node, "display"); + SDL_xauth(gdev) = get_attr_value(node, "xauth"); + SDL_fullscreen(gdev) = get_attr_value(node, "fullscreen"); + gdev->passwd = NULL; + } + else if (STREQC(gdev->type, "pty")) { if (node->name == NULL) goto err; diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Tue Jul 05 15:52:31 2011 -0300 +++ b/libxkutil/device_parsing.h Sun Jul 10 12:18:38 2011 +0800 @@ -83,6 +83,9 @@ char *path; }; +#define SDL_display(dev) (dev->port) +#define SDL_xauth(dev) (dev->host) +#define SDL_fullscreen(dev) (dev->keymap) struct graphics_device { char *type; char *port; diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Tue Jul 05 15:52:31 2011 -0300 +++ b/libxkutil/xmlgen.c Sun Jul 10 12:18:38 2011 +0800 @@ -421,8 +421,21 @@ xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); - if (STREQC(dev->type, "sdl")) - return NULL; + if (STREQC(dev->type, "sdl")) { + if (SDL_display(dev)) { + xmlNewProp(tmp, BAD_CAST "display", + BAD_CAST SDL_display(dev)); + } + if (SDL_xauth(dev)) { + xmlNewProp(tmp, BAD_CAST "xauth", + BAD_CAST SDL_xauth(dev)); + } + if (SDL_fullscreen(dev)) { + xmlNewProp(tmp, BAD_CAST "fullscreen", + BAD_CAST SDL_fullscreen(dev)); + } + return NULL; + } if (dev->port) { xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); diff -r 395f2d684c10 -r ec5e5be04391 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Tue Jul 05 15:52:31 2011 -0300 +++ b/schema/ResourceAllocationSettingData.mof Sun Jul 10 12:18:38 2011 +0800 @@ -219,7 +219,9 @@ [Description ("If ResourceSubType is 'vnc', this is a VNC Address. " "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If ResourceSubType " "is 'console', this is a character device path in " - "path:port format (e.g., '/dev/pts/3:0'\)")] + "path:port format (e.g., '/dev/pts/3:0'\)." + "if ResourceSubType is 'sdl', this is a combination of its params as " + "xauth:display (e.g., '/root/.Xauthority::0'\)")] string Address; [Description ("Keyboard keymapping")] @@ -228,7 +230,8 @@ [Description ("VNC password")] string Password; - [Description ("Is IPv6 only addressing is to be used")] + [Description ("Is IPv6 only addressing is to be used." + "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")] boolean IsIPv6Only; }; diff -r 395f2d684c10 -r ec5e5be04391 src/Virt_RASD.c --- a/src/Virt_RASD.c Tue Jul 05 15:52:31 2011 -0300 +++ b/src/Virt_RASD.c Sun Jul 10 12:18:38 2011 +0800 @@ -416,12 +416,14 @@ virDomainPtr dom = NULL; struct infostore_ctx *infostore = NULL; bool has_passwd = false; - + const struct graphics_device *gdev = &dev->dev.graphics; + CMSetProperty(inst, "ResourceSubType", (CMPIValue *)dev->dev.graphics.type, CMPI_chars); - if (STREQC(dev->dev.graphics.type, "sdl")) - rc = asprintf(&addr_str, "%s", dev->dev.graphics.type); + if (STREQC(dev->dev.graphics.type, "sdl")) { + rc = asprintf(&addr_str, "%s:%s", SDL_xauth(gdev), SDL_display(gdev)); + } else { rc = asprintf(&addr_str, "%s:%s", diff -r 395f2d684c10 -r ec5e5be04391 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Tue Jul 05 15:52:31 2011 -0300 +++ b/src/Virt_VirtualSystemManagementService.c Sun Jul 10 12:18:38 2011 +0800 @@ -1059,6 +1059,52 @@ return ret; } +static int parse_sdl_address(const char *id, + char **display, + char **xauth) +{ + int ret; + char *tmp_display = NULL; + char *tmp_xauth = NULL; + + CU_DEBUG("Entering parse_sdl_address, address is %s", id); + + ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display); + + if (ret <= 0) { + ret = sscanf(id, ":%as", &tmp_display); + if (ret <= 0) { + if (STREQC(id, ":")) { + /* do nothing, it is empty */ + } + else { + ret = 0; + goto out; + } + } + } + + if (display) { + if (tmp_display == NULL) + *display = NULL; + else + *display = strdup(tmp_display); + } + if (xauth) { + if (tmp_xauth == NULL) + *xauth = NULL; + else + *xauth = strdup(tmp_xauth); + } + ret = 1; + + out: + CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s", + *display, *xauth); + + return ret; +} + static int parse_vnc_address(const char *id, char **ip, char **port) @@ -1103,6 +1149,7 @@ const char *msg = NULL; bool ipv6 = false; int ret; + struct graphics_device *gdev = &dev->dev.graphics; if (cu_get_str_prop(inst, "ResourceSubType", &val) != CMPI_RC_OK) { msg = "GraphicsRASD ResourceSubType field not valid"; @@ -1162,6 +1209,30 @@ msg = "GraphicsRASD field Address not valid"; goto out; } + } + else if (STREQC(dev->dev.graphics.type, "sdl")) { + if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) { + CU_DEBUG("sdl graphics Address empty, using default"); + SDL_display(gdev) = NULL; + SDL_xauth(gdev) = NULL; + } + else { + ret = parse_sdl_address(val, + &SDL_display(gdev), + &SDL_xauth(gdev)); + if (ret != 1) { + msg = "GraphicsRASD sdl Address not valid"; + goto out; + } + } + SDL_fullscreen(gdev) = NULL; + if (cu_get_bool_prop(inst, "IsIPV6Only", &ipv6) == + CMPI_RC_OK) { + if (ipv6) + SDL_fullscreen(gdev) = strdup("yes"); + else + SDL_fullscreen(gdev) = strdup("no"); + } } else { CU_DEBUG("Unsupported graphics type %s", dev->dev.graphics.type); @@ -1172,6 +1243,9 @@ free(dev->id); if (STREQC(dev->dev.graphics.type, "vnc")) ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); + else if (STREQC(dev->dev.graphics.type, "sdl")) + ret = asprintf(&dev->id, "%s:%s:%s", + dev->dev.graphics.type, SDL_xauth(gdev), SDL_display(gdev)); else ret = asprintf(&dev->id, "%s:%s", dev->dev.graphics.type, dev->dev.graphics.port); @@ -1493,7 +1567,6 @@ "Failed to lookup resulting system"); goto out; } - out: virDomainFree(dom); virConnectClose(conn); From eblima at linux.vnet.ibm.com Fri Jul 15 15:14:13 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Fri, 15 Jul 2011 12:14:13 -0300 Subject: [Libvirt-cim] [PATCH] Add SDL graphic device support In-Reply-To: <4E1E8D82.8080802@linux.vnet.ibm.com> References: <4E1E8D82.8080802@linux.vnet.ibm.com> Message-ID: <4E205945.8070209@linux.vnet.ibm.com> On 07/14/2011 03:32 AM, Wayne Xia wrote: > # HG changeset patch > # User Wayne Xia > # Date 1310271518 -28800 > # Node ID ec5e5be04391afa9bab3b4a59bc5596a68a9f175 > # Parent 395f2d684c1046455462db7e4e87d30e7aae0feb > Add SDL graphic device support > > the options are described in ResourceAllocationSettingData.mof > Thanks for the patch! Please provide the description also in the commit message. It is also important to explain how your patch works and maybe the reasons of why you decided to do things this way. See below. > Signed-off-by: Wayne Xia > > diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Tue Jul 05 15:52:31 2011 -0300 > +++ b/libxkutil/device_parsing.c Sun Jul 10 12:18:38 2011 +0800 > @@ -90,11 +90,16 @@ > > static void cleanup_graphics_device(struct graphics_device *dev) > { > - free(dev->type); > - free(dev->port); > - free(dev->host); > - free(dev->keymap); > - free(dev->passwd); > + if (dev->type !=NULL) > + free(dev->type); > + if (dev->port !=NULL) > + free(dev->port); > + if (dev->host !=NULL) > + free(dev->host); > + if (dev->keymap !=NULL) > + free(dev->keymap); > + if (dev->passwd !=NULL) > + free(dev->passwd); > } > I am not sure if those checks are really necessary. Isn't free(NULL) handled by glibc? One thing that could definitely cause a crash is having the dev pointer assigned to NULL. > static void cleanup_input_device(struct input_device *dev) > @@ -529,6 +534,13 @@ > if (gdev->port == NULL || gdev->host == NULL) > goto err; > } > + else if (STREQC(gdev->type, "sdl")) { > + SDL_display(gdev) = get_attr_value(node, "display"); > + SDL_xauth(gdev) = get_attr_value(node, "xauth"); > + SDL_fullscreen(gdev) = get_attr_value(node, "fullscreen"); > + gdev->passwd = NULL; > + } > + > else if (STREQC(gdev->type, "pty")) { > if (node->name == NULL) > goto err; > diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/device_parsing.h > --- a/libxkutil/device_parsing.h Tue Jul 05 15:52:31 2011 -0300 > +++ b/libxkutil/device_parsing.h Sun Jul 10 12:18:38 2011 +0800 > @@ -83,6 +83,9 @@ > char *path; > }; > > +#define SDL_display(dev) (dev->port) > +#define SDL_xauth(dev) (dev->host) > +#define SDL_fullscreen(dev) (dev->keymap) You see, this is a decision you should have explained in the commit message. Anyway, I really don't like the idea of reusing the struct fields for another completely different purpose. Imagine when another type of graphic device lands. Wouldn't it be better to describe each graphic device as union? Code will look a lot more cleaner, less error prone and easier to maintain. > struct graphics_device { > char *type; > char *port; > diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/xmlgen.c > --- a/libxkutil/xmlgen.c Tue Jul 05 15:52:31 2011 -0300 > +++ b/libxkutil/xmlgen.c Sun Jul 10 12:18:38 2011 +0800 > @@ -421,8 +421,21 @@ > > xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); > > - if (STREQC(dev->type, "sdl")) > - return NULL; > + if (STREQC(dev->type, "sdl")) { > + if (SDL_display(dev)) { > + xmlNewProp(tmp, BAD_CAST "display", > + BAD_CAST SDL_display(dev)); > + } > + if (SDL_xauth(dev)) { > + xmlNewProp(tmp, BAD_CAST "xauth", > + BAD_CAST SDL_xauth(dev)); > + } > + if (SDL_fullscreen(dev)) { > + xmlNewProp(tmp, BAD_CAST "fullscreen", > + BAD_CAST SDL_fullscreen(dev)); > + } > + return NULL; > + } > > if (dev->port) { > xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); > diff -r 395f2d684c10 -r ec5e5be04391 > schema/ResourceAllocationSettingData.mof > --- a/schema/ResourceAllocationSettingData.mof Tue Jul 05 15:52:31 2011 > -0300 > +++ b/schema/ResourceAllocationSettingData.mof Sun Jul 10 12:18:38 2011 > +0800 What is this change from 0300 to 0800?? > @@ -219,7 +219,9 @@ > [Description ("If ResourceSubType is 'vnc', this is a VNC Address. " > "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If > ResourceSubType " > "is 'console', this is a character device path in " > - "path:port format (e.g., '/dev/pts/3:0'\)")] > + "path:port format (e.g., '/dev/pts/3:0'\)." > + "if ResourceSubType is 'sdl', this is a combination of its > params as " > + "xauth:display (e.g., '/root/.Xauthority::0'\)")] > string Address; > > [Description ("Keyboard keymapping")] > @@ -228,7 +230,8 @@ > [Description ("VNC password")] > string Password; > > - [Description ("Is IPv6 only addressing is to be used")] > + [Description ("Is IPv6 only addressing is to be used." > + "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")] > boolean IsIPv6Only; > }; > > diff -r 395f2d684c10 -r ec5e5be04391 src/Virt_RASD.c > --- a/src/Virt_RASD.c Tue Jul 05 15:52:31 2011 -0300 > +++ b/src/Virt_RASD.c Sun Jul 10 12:18:38 2011 +0800 > @@ -416,12 +416,14 @@ > virDomainPtr dom = NULL; > struct infostore_ctx *infostore = NULL; > bool has_passwd = false; > - > + const struct graphics_device *gdev = &dev->dev.graphics; > + > CMSetProperty(inst, "ResourceSubType", > (CMPIValue *)dev->dev.graphics.type, CMPI_chars); > > - if (STREQC(dev->dev.graphics.type, "sdl")) > - rc = asprintf(&addr_str, "%s", dev->dev.graphics.type); > + if (STREQC(dev->dev.graphics.type, "sdl")) { > + rc = asprintf(&addr_str, "%s:%s", SDL_xauth(gdev), > SDL_display(gdev)); > + } > else { > rc = asprintf(&addr_str, > "%s:%s", > diff -r 395f2d684c10 -r ec5e5be04391 > src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c Tue Jul 05 15:52:31 2011 > -0300 > +++ b/src/Virt_VirtualSystemManagementService.c Sun Jul 10 12:18:38 2011 > +0800 Another one... > @@ -1059,6 +1059,52 @@ > return ret; > } > > +static int parse_sdl_address(const char *id, > + char **display, > + char **xauth) > +{ > + int ret; > + char *tmp_display = NULL; > + char *tmp_xauth = NULL; > + > + CU_DEBUG("Entering parse_sdl_address, address is %s", id); > + > + ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display); > + > + if (ret <= 0) { > + ret = sscanf(id, ":%as", &tmp_display); > + if (ret <= 0) { > + if (STREQC(id, ":")) { > + /* do nothing, it is empty */ > + } > + else { > + ret = 0; > + goto out; > + } > + } > + } > + > + if (display) { > + if (tmp_display == NULL) > + *display = NULL; > + else > + *display = strdup(tmp_display); > + } > + if (xauth) { > + if (tmp_xauth == NULL) > + *xauth = NULL; > + else > + *xauth = strdup(tmp_xauth); > + } > + ret = 1; > + > + out: > + CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s", > + *display, *xauth); > + > + return ret; > +} > + > static int parse_vnc_address(const char *id, > char **ip, > char **port) > @@ -1103,6 +1149,7 @@ > const char *msg = NULL; > bool ipv6 = false; > int ret; > + struct graphics_device *gdev = &dev->dev.graphics; > > if (cu_get_str_prop(inst, "ResourceSubType", &val) != > CMPI_RC_OK) { > msg = "GraphicsRASD ResourceSubType field not valid"; > @@ -1162,6 +1209,30 @@ > msg = "GraphicsRASD field Address not valid"; > goto out; > } > + } > + else if (STREQC(dev->dev.graphics.type, "sdl")) { > + if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) { > + CU_DEBUG("sdl graphics Address empty, using > default"); > + SDL_display(gdev) = NULL; > + SDL_xauth(gdev) = NULL; > + } > + else { > + ret = parse_sdl_address(val, > + &SDL_display(gdev), > + &SDL_xauth(gdev)); > + if (ret != 1) { > + msg = "GraphicsRASD sdl Address not > valid"; > + goto out; > + } > + } > + SDL_fullscreen(gdev) = NULL; > + if (cu_get_bool_prop(inst, "IsIPV6Only", &ipv6) == > + CMPI_RC_OK) { > + if (ipv6) > + SDL_fullscreen(gdev) = > strdup("yes"); > + else > + SDL_fullscreen(gdev) = > strdup("no"); > + } > } else { > CU_DEBUG("Unsupported graphics type %s", > dev->dev.graphics.type); > @@ -1172,6 +1243,9 @@ > free(dev->id); > if (STREQC(dev->dev.graphics.type, "vnc")) > ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); > + else if (STREQC(dev->dev.graphics.type, "sdl")) > + ret = asprintf(&dev->id, "%s:%s:%s", > + dev->dev.graphics.type, SDL_xauth(gdev), > SDL_display(gdev)); > else > ret = asprintf(&dev->id, "%s:%s", > dev->dev.graphics.type, > dev->dev.graphics.port); > @@ -1493,7 +1567,6 @@ > "Failed to lookup resulting system"); > goto out; > } > - > out: > virDomainFree(dom); > virConnectClose(conn); Best regards, -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From cvincent at linux.vnet.ibm.com Fri Jul 15 15:33:28 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Fri, 15 Jul 2011 11:33:28 -0400 Subject: [Libvirt-cim] [PATCH] [TEST] Update .hgignore In-Reply-To: <021243e63a3b9e0b7096.1310497353@etrunko-t410.br.ibm.com> References: <021243e63a3b9e0b7096.1310497353@etrunko-t410.br.ibm.com> Message-ID: <4E205DC8.2030509@linux.vnet.ibm.com> +1 and pushed. On 07/12/2011 03:02 PM, Eduardo Lima (Etrunko) wrote: > # HG changeset patch > # User Eduardo Lima (Etrunko) > # Date 1310497347 10800 > # Node ID 021243e63a3b9e0b709618886b63a66d6ab5adc3 > # Parent 26f6e541a714d5a915e4149554e057ba7ac328d1 > [TEST] Update .hgignore > > Signed-off-by: Eduardo Lima (Etrunko) > > diff --git a/.hgignore b/.hgignore > --- a/.hgignore > +++ b/.hgignore > @@ -1,1 +1,4 @@ > .*.pyc > +.*.log > +.*~ > +run_report.txt > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From snmishra at us.ibm.com Fri Jul 15 16:03:59 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Fri, 15 Jul 2011 09:03:59 -0700 Subject: [Libvirt-cim] [PATCH] SwitchService will show the nic connected to VSI switch Message-ID: # HG changeset patch # User Sharad Mishra # Date 1310745835 25200 # Node ID d458bd51459cd1b470bf9ec74304abb7ff05b53c # Parent 395f2d684c1046455462db7e4e87d30e7aae0feb SwitchService will show the nic connected to VSI switch. SwitchService instance will list out the interface connected to the VSI capable switch. This helps identify which nic is conneced to VSI switch when there are multiple nics. Signed-off-by: Sharad Mishra diff -r 395f2d684c10 -r d458bd51459c schema/SwitchService.mof --- a/schema/SwitchService.mof Tue Jul 05 15:52:31 2011 -0300 +++ b/schema/SwitchService.mof Fri Jul 15 09:03:55 2011 -0700 @@ -5,6 +5,7 @@ { [Description("Flag to determine if VSI is supported on the switch")] boolean IsVSISupported; + string VSIInterface; }; @@ -13,6 +14,7 @@ { [Description("Flag to determine if VSI is supported on the switch")] boolean IsVSISupported; + string VSIInterface; }; @@ -21,6 +23,7 @@ { [Description("Flag to determine if VSI is supported on the switch")] boolean IsVSISupported; + string VSIInterface; }; diff -r 395f2d684c10 -r d458bd51459c src/Virt_SwitchService.c --- a/src/Virt_SwitchService.c Tue Jul 05 15:52:31 2011 -0300 +++ b/src/Virt_SwitchService.c Fri Jul 15 09:03:55 2011 -0700 @@ -250,6 +250,8 @@ s = check_vsi_support(cmd); if (s.rc == CMPI_RC_OK) { vsi = true; + CMSetProperty(inst, "VSIInterface", + (CMPIValue *)if_list[i], CMPI_chars); break; } else From eblima at linux.vnet.ibm.com Fri Jul 15 20:45:48 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Fri, 15 Jul 2011 17:45:48 -0300 Subject: [Libvirt-cim] [PATCH] SwitchService will show the nic connected to VSI switch In-Reply-To: References: Message-ID: <4E20A6FC.5050301@linux.vnet.ibm.com> On 07/15/2011 01:03 PM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1310745835 25200 > # Node ID d458bd51459cd1b470bf9ec74304abb7ff05b53c > # Parent 395f2d684c1046455462db7e4e87d30e7aae0feb > SwitchService will show the nic connected to VSI switch. > > SwitchService instance will list out the interface connected to the VSI capable switch. This helps identify which nic is conneced to VSI switch when there are multiple nics. > Could you break the commit message to < 80 columns as well? > Signed-off-by: Sharad Mishra > > diff -r 395f2d684c10 -r d458bd51459c schema/SwitchService.mof > --- a/schema/SwitchService.mof Tue Jul 05 15:52:31 2011 -0300 > +++ b/schema/SwitchService.mof Fri Jul 15 09:03:55 2011 -0700 > @@ -5,6 +5,7 @@ > { > [Description("Flag to determine if VSI is supported on the switch")] > boolean IsVSISupported; > + string VSIInterface; > > }; > > @@ -13,6 +14,7 @@ > { > [Description("Flag to determine if VSI is supported on the switch")] > boolean IsVSISupported; > + string VSIInterface; > > }; > > @@ -21,6 +23,7 @@ > { > [Description("Flag to determine if VSI is supported on the switch")] > boolean IsVSISupported; > + string VSIInterface; > > }; > > diff -r 395f2d684c10 -r d458bd51459c src/Virt_SwitchService.c > --- a/src/Virt_SwitchService.c Tue Jul 05 15:52:31 2011 -0300 > +++ b/src/Virt_SwitchService.c Fri Jul 15 09:03:55 2011 -0700 > @@ -250,6 +250,8 @@ > s = check_vsi_support(cmd); > if (s.rc == CMPI_RC_OK) { > vsi = true; > + CMSetProperty(inst, "VSIInterface", > + (CMPIValue *)if_list[i], CMPI_chars); > break; > } > else > +1. Pretty straightforward. -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From snmishra at us.ibm.com Fri Jul 15 22:00:24 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Fri, 15 Jul 2011 15:00:24 -0700 Subject: [Libvirt-cim] [PATCH] Add source host and directory for netfs diskpool Message-ID: # HG changeset patch # User Sharad Mishra # Date 1310766822 25200 # Node ID f064a20fba355fa2fbaa2bc914fa2189712223f6 # Parent 0563cf6502d4cd10418001d88c0c60b269370b3e Add source host and directory for netfs diskpool. Added new properties to populate the source host and directory being used for netfs diskpool. Signed-off-by: Sharad Mishra diff -r 0563cf6502d4 -r f064a20fba35 schema/DiskPool.mof --- a/schema/DiskPool.mof Fri Jul 15 09:03:55 2011 -0700 +++ b/schema/DiskPool.mof Fri Jul 15 14:53:42 2011 -0700 @@ -5,6 +5,9 @@ { [Description("Path this storage pool represents")] string Path; + uint16 Autostart; + string Host; + string SourceDirectory; }; @@ -13,6 +16,9 @@ { [Description("Path this storage pool represents")] string Path; + uint16 Autostart; + string Host; + string SourceDirectory; }; @@ -21,6 +27,9 @@ { [Description("Path this storage pool represents")] string Path; + uint16 Autostart; + string Host; + string SourceDirectory; }; diff -r 0563cf6502d4 -r f064a20fba35 src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Fri Jul 15 09:03:55 2011 -0700 +++ b/src/Virt_DevicePool.c Fri Jul 15 14:53:42 2011 -0700 @@ -213,6 +213,19 @@ CMSetProperty(inst, "Path", (CMPIValue *)pool_str, CMPI_chars); } + if (pool_vals->pool_info.disk.host != NULL) { + pool_str = strdup(pool_vals->pool_info.disk.host); + + CMSetProperty(inst, "Host", + (CMPIValue *)pool_str, CMPI_chars); + } + if (pool_vals->pool_info.disk.src_dir != NULL) { + pool_str = strdup(pool_vals->pool_info.disk.src_dir); + + CMSetProperty(inst, "SourceDirectory", + (CMPIValue *)pool_str, CMPI_chars); + } + type = pool_vals->pool_info.disk.pool_type; CMSetProperty(inst, "OtherResourceType", (CMPIValue *)get_disk_pool_type(type), From snmishra at us.ibm.com Sun Jul 17 19:49:44 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Sun, 17 Jul 2011 12:49:44 -0700 Subject: [Libvirt-cim] [PATCH] Set PoolID for CIM_NetResourceAllocationSettingData Message-ID: # HG changeset patch # User Sharad Mishra # Date 1310931451 25200 # Node ID e8c1cdd5c9cbe887286ef169d8ff525cc9035485 # Parent 0563cf6502d4cd10418001d88c0c60b269370b3e Set PoolID for CIM_NetResourceAllocationSettingData. PoolID wasn't getting set for NETResourceAllocationSettingData. PoolID for NETResourceAllocationSettingData is set by appending "NetworkPool" to the network name. Signed-off-by: Sharad Mishra diff -r 0563cf6502d4 -r e8c1cdd5c9cb libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Fri Jul 15 09:03:55 2011 -0700 +++ b/libxkutil/device_parsing.c Sun Jul 17 12:37:31 2011 -0700 @@ -372,8 +372,16 @@ if (ndev->source != NULL) continue; ndev->source = get_attr_value(child, "network"); - if (ndev->source != NULL) + if (ndev->source != NULL) { + int ret = asprintf(&ndev->poolid, + "NetworkPool/%s", + ndev->source); + if (ret == -1) { + CU_DEBUG("Failed to get network" + " poolid"); + } continue; + } ndev->source = get_attr_value(child, "dev"); ndev->net_mode = get_attr_value(child, "mode"); if ((ndev->source != NULL) && (ndev->net_mode != NULL)) diff -r 0563cf6502d4 -r e8c1cdd5c9cb libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Fri Jul 15 09:03:55 2011 -0700 +++ b/libxkutil/device_parsing.h Sun Jul 17 12:37:31 2011 -0700 @@ -61,6 +61,7 @@ char *type; char *mac; char *source; + char *poolid; char *model; char *device; char *net_mode; diff -r 0563cf6502d4 -r e8c1cdd5c9cb src/Virt_RASD.c --- a/src/Virt_RASD.c Fri Jul 15 09:03:55 2011 -0700 +++ b/src/Virt_RASD.c Sun Jul 17 12:37:31 2011 -0700 @@ -401,6 +401,12 @@ (CMPIValue *)dev->dev.net.model, CMPI_chars); + if (dev->dev.net.poolid != NULL) + CMSetProperty(inst, + "PoolID", + (CMPIValue *)dev->dev.net.poolid, + CMPI_chars); + return s; } From xiawenc at linux.vnet.ibm.com Mon Jul 18 07:54:04 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Mon, 18 Jul 2011 15:54:04 +0800 Subject: [Libvirt-cim] [PATCH] Add SDL graphic device support In-Reply-To: <4E205945.8070209@linux.vnet.ibm.com> References: <4E1E8D82.8080802@linux.vnet.ibm.com> <4E205945.8070209@linux.vnet.ibm.com> Message-ID: <4E23E69C.2090109@linux.vnet.ibm.com> many thanks for your response. some description: Currently the SDL frame buffer is still supported by qemu and libvirt, and I like to use it more than VNC. :) https://bugzilla.linux.ibm.com/show_bug.cgi?id=71347 what libvirt-cim concern is to correctly pass the user definition about it to libvirt, as parameters. following is my comments. ? 2011-7-15 23:14, Eduardo Lima (Etrunko) ??: > On 07/14/2011 03:32 AM, Wayne Xia wrote: >> # HG changeset patch >> # User Wayne Xia >> # Date 1310271518 -28800 >> # Node ID ec5e5be04391afa9bab3b4a59bc5596a68a9f175 >> # Parent 395f2d684c1046455462db7e4e87d30e7aae0feb >> Add SDL graphic device support >> >> the options are described in ResourceAllocationSettingData.mof >> > > Thanks for the patch! > > Please provide the description also in the commit message. It is also > important to explain how your patch works and maybe the reasons of why > you decided to do things this way. See below. > >> Signed-off-by: Wayne Xia >> >> diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/device_parsing.c >> --- a/libxkutil/device_parsing.c Tue Jul 05 15:52:31 2011 -0300 >> +++ b/libxkutil/device_parsing.c Sun Jul 10 12:18:38 2011 +0800 >> @@ -90,11 +90,16 @@ >> >> static void cleanup_graphics_device(struct graphics_device *dev) >> { >> - free(dev->type); >> - free(dev->port); >> - free(dev->host); >> - free(dev->keymap); >> - free(dev->passwd); >> + if (dev->type !=NULL) >> + free(dev->type); >> + if (dev->port !=NULL) >> + free(dev->port); >> + if (dev->host !=NULL) >> + free(dev->host); >> + if (dev->keymap !=NULL) >> + free(dev->keymap); >> + if (dev->passwd !=NULL) >> + free(dev->passwd); >> } >> > > I am not sure if those checks are really necessary. Isn't free(NULL) > handled by glibc? One thing that could definitely cause a crash is > having the dev pointer assigned to NULL. > a crash happened before I added this code, more investigation need to do about it. >> static void cleanup_input_device(struct input_device *dev) >> @@ -529,6 +534,13 @@ >> if (gdev->port == NULL || gdev->host == NULL) >> goto err; >> } >> + else if (STREQC(gdev->type, "sdl")) { >> + SDL_display(gdev) = get_attr_value(node, "display"); >> + SDL_xauth(gdev) = get_attr_value(node, "xauth"); >> + SDL_fullscreen(gdev) = get_attr_value(node, "fullscreen"); >> + gdev->passwd = NULL; >> + } >> + >> else if (STREQC(gdev->type, "pty")) { >> if (node->name == NULL) >> goto err; >> diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/device_parsing.h >> --- a/libxkutil/device_parsing.h Tue Jul 05 15:52:31 2011 -0300 >> +++ b/libxkutil/device_parsing.h Sun Jul 10 12:18:38 2011 +0800 >> @@ -83,6 +83,9 @@ >> char *path; >> }; >> >> +#define SDL_display(dev) (dev->port) >> +#define SDL_xauth(dev) (dev->host) >> +#define SDL_fullscreen(dev) (dev->keymap) > > You see, this is a decision you should have explained in the commit > message. Anyway, I really don't like the idea of reusing the struct > fields for another completely different purpose. Imagine when another > type of graphic device lands. Wouldn't it be better to describe each > graphic device as union? Code will look a lot more cleaner, less error > prone and easier to maintain. > I agree this is a bad style. But when I tried to use union, it seems the structure declaration need to be changed too much making old code not compatible. For eg, if graphics_device is declare as this: union graphics_device{ struct vnc_device{ .... }dev1; struct sdl_device{ .... }deve; }graphics_device1; then in code: struct graphics_device* dev= *list; dev->type = 0; code like this would all need to be changed. it seems an additional layer of member need to be added, if union is used. >> struct graphics_device { >> char *type; >> char *port; >> diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/xmlgen.c >> --- a/libxkutil/xmlgen.c Tue Jul 05 15:52:31 2011 -0300 >> +++ b/libxkutil/xmlgen.c Sun Jul 10 12:18:38 2011 +0800 >> @@ -421,8 +421,21 @@ >> >> xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); >> >> - if (STREQC(dev->type, "sdl")) >> - return NULL; >> + if (STREQC(dev->type, "sdl")) { >> + if (SDL_display(dev)) { >> + xmlNewProp(tmp, BAD_CAST "display", >> + BAD_CAST SDL_display(dev)); >> + } >> + if (SDL_xauth(dev)) { >> + xmlNewProp(tmp, BAD_CAST "xauth", >> + BAD_CAST SDL_xauth(dev)); >> + } >> + if (SDL_fullscreen(dev)) { >> + xmlNewProp(tmp, BAD_CAST "fullscreen", >> + BAD_CAST SDL_fullscreen(dev)); >> + } >> + return NULL; >> + } >> >> if (dev->port) { >> xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); >> diff -r 395f2d684c10 -r ec5e5be04391 >> schema/ResourceAllocationSettingData.mof >> --- a/schema/ResourceAllocationSettingData.mof Tue Jul 05 15:52:31 2011 >> -0300 >> +++ b/schema/ResourceAllocationSettingData.mof Sun Jul 10 12:18:38 2011 >> +0800 > > What is this change from 0300 to 0800?? > I thought it is auto generated by the HG, isn't it? >> @@ -219,7 +219,9 @@ >> [Description ("If ResourceSubType is 'vnc', this is a VNC Address. " >> "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If >> ResourceSubType " >> "is 'console', this is a character device path in " >> - "path:port format (e.g., '/dev/pts/3:0'\)")] >> + "path:port format (e.g., '/dev/pts/3:0'\)." >> + "if ResourceSubType is 'sdl', this is a combination of its >> params as " >> + "xauth:display (e.g., '/root/.Xauthority::0'\)")] >> string Address; >> >> [Description ("Keyboard keymapping")] >> @@ -228,7 +230,8 @@ >> [Description ("VNC password")] >> string Password; >> >> - [Description ("Is IPv6 only addressing is to be used")] >> + [Description ("Is IPv6 only addressing is to be used." >> + "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")] >> boolean IsIPv6Only; >> }; >> here SDL used same attribute name For other graphic device, to minimize the change in schema. >> diff -r 395f2d684c10 -r ec5e5be04391 src/Virt_RASD.c >> --- a/src/Virt_RASD.c Tue Jul 05 15:52:31 2011 -0300 >> +++ b/src/Virt_RASD.c Sun Jul 10 12:18:38 2011 +0800 >> @@ -416,12 +416,14 @@ >> virDomainPtr dom = NULL; >> struct infostore_ctx *infostore = NULL; >> bool has_passwd = false; >> - >> + const struct graphics_device *gdev = &dev->dev.graphics; >> + >> CMSetProperty(inst, "ResourceSubType", >> (CMPIValue *)dev->dev.graphics.type, CMPI_chars); >> >> - if (STREQC(dev->dev.graphics.type, "sdl")) >> - rc = asprintf(&addr_str, "%s", dev->dev.graphics.type); >> + if (STREQC(dev->dev.graphics.type, "sdl")) { >> + rc = asprintf(&addr_str, "%s:%s", SDL_xauth(gdev), >> SDL_display(gdev)); >> + } >> else { >> rc = asprintf(&addr_str, >> "%s:%s", >> diff -r 395f2d684c10 -r ec5e5be04391 >> src/Virt_VirtualSystemManagementService.c >> --- a/src/Virt_VirtualSystemManagementService.c Tue Jul 05 15:52:31 2011 >> -0300 >> +++ b/src/Virt_VirtualSystemManagementService.c Sun Jul 10 12:18:38 2011 >> +0800 > > Another one... > >> @@ -1059,6 +1059,52 @@ >> return ret; >> } >> >> +static int parse_sdl_address(const char *id, >> + char **display, >> + char **xauth) >> +{ >> + int ret; >> + char *tmp_display = NULL; >> + char *tmp_xauth = NULL; >> + >> + CU_DEBUG("Entering parse_sdl_address, address is %s", id); >> + >> + ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display); >> + >> + if (ret <= 0) { >> + ret = sscanf(id, ":%as", &tmp_display); >> + if (ret <= 0) { >> + if (STREQC(id, ":")) { >> + /* do nothing, it is empty */ >> + } >> + else { >> + ret = 0; >> + goto out; >> + } >> + } >> + } >> + >> + if (display) { >> + if (tmp_display == NULL) >> + *display = NULL; >> + else >> + *display = strdup(tmp_display); >> + } >> + if (xauth) { >> + if (tmp_xauth == NULL) >> + *xauth = NULL; >> + else >> + *xauth = strdup(tmp_xauth); >> + } >> + ret = 1; >> + >> + out: >> + CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s", >> + *display, *xauth); >> + >> + return ret; >> +} >> + >> static int parse_vnc_address(const char *id, >> char **ip, >> char **port) >> @@ -1103,6 +1149,7 @@ >> const char *msg = NULL; >> bool ipv6 = false; >> int ret; >> + struct graphics_device *gdev = &dev->dev.graphics; >> >> if (cu_get_str_prop(inst, "ResourceSubType", &val) != >> CMPI_RC_OK) { >> msg = "GraphicsRASD ResourceSubType field not valid"; >> @@ -1162,6 +1209,30 @@ >> msg = "GraphicsRASD field Address not valid"; >> goto out; >> } >> + } >> + else if (STREQC(dev->dev.graphics.type, "sdl")) { >> + if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) { >> + CU_DEBUG("sdl graphics Address empty, using >> default"); >> + SDL_display(gdev) = NULL; >> + SDL_xauth(gdev) = NULL; >> + } >> + else { >> + ret = parse_sdl_address(val, >> + &SDL_display(gdev), >> + &SDL_xauth(gdev)); >> + if (ret != 1) { >> + msg = "GraphicsRASD sdl Address not >> valid"; >> + goto out; >> + } >> + } >> + SDL_fullscreen(gdev) = NULL; >> + if (cu_get_bool_prop(inst, "IsIPV6Only", &ipv6) == >> + CMPI_RC_OK) { >> + if (ipv6) >> + SDL_fullscreen(gdev) = >> strdup("yes"); >> + else >> + SDL_fullscreen(gdev) = >> strdup("no"); >> + } >> } else { >> CU_DEBUG("Unsupported graphics type %s", >> dev->dev.graphics.type); >> @@ -1172,6 +1243,9 @@ >> free(dev->id); >> if (STREQC(dev->dev.graphics.type, "vnc")) >> ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); >> + else if (STREQC(dev->dev.graphics.type, "sdl")) >> + ret = asprintf(&dev->id, "%s:%s:%s", >> + dev->dev.graphics.type, SDL_xauth(gdev), >> SDL_display(gdev)); >> else >> ret = asprintf(&dev->id, "%s:%s", >> dev->dev.graphics.type, >> dev->dev.graphics.port); >> @@ -1493,7 +1567,6 @@ >> "Failed to lookup resulting system"); >> goto out; >> } >> - >> out: >> virDomainFree(dom); >> virConnectClose(conn); > > Best regards, > -- Best Regards Wayne Xia mail:xiawenc at linux.vnet.ibm.com tel:86-010-82450803 From cvincent at linux.vnet.ibm.com Mon Jul 18 12:44:09 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Mon, 18 Jul 2011 08:44:09 -0400 Subject: [Libvirt-cim] [PATCH] Make libconfig requirement optional In-Reply-To: <2823d4e157125fc47668.1310149572@etrunko-t410.br.ibm.com> References: <2823d4e157125fc47668.1310149572@etrunko-t410.br.ibm.com> Message-ID: <4E242A99.1040602@linux.vnet.ibm.com> I don't see my ack so resending. +1 and pushed. On 07/08/2011 02:26 PM, Eduardo Lima (Etrunko) wrote: > # HG changeset patch > # User Eduardo Lima (Etrunko) > # Date 1310149559 10800 > # Node ID 2823d4e157125fc47668a9f0d6ef2f52e52169ce > # Parent 395f2d684c1046455462db7e4e87d30e7aae0feb > Make libconfig requirement optional > > libconfig is a required to build libvirt-cim since r1104, but the > package is not included in RHEL 5, which we still support. This patch > enables libvirt-cim to be built even if libconfig is not found. > > Note that it will not be possible for users of that distro to configure > libvirt-cim to operate in read-only mode. > > Signed-off-by: Eduardo Lima (Etrunko) > > diff --git a/acinclude.m4 b/acinclude.m4 > --- a/acinclude.m4 > +++ b/acinclude.m4 > @@ -272,7 +272,11 @@ > > AC_DEFUN([CHECK_LIBCONFIG], > [ > - PKG_CHECK_MODULES([LIBCONFIG], [libconfig]) > + PKG_CHECK_MODULES([LIBCONFIG], [libconfig], > + [LIBCONFIG_FOUND=yes], [LIBCONFIG_FOUND=no]) > + if test "$LIBCONFIG_FOUND" = "yes" ; then > + AC_DEFINE(HAVE_LIBCONFIG, 1, [Define if libconfig development files were found]) > + fi > AC_SUBST([LIBCONFIG_CFLAGS]) > AC_SUBST([LIBCONFIG_LIBS]) > CPPFLAGS="$CPPFLAGS $LIBCONFIG_CFLAGS" > diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in > --- a/libvirt-cim.spec.in > +++ b/libvirt-cim.spec.in > @@ -22,11 +22,11 @@ > BuildRequires: e2fsprogs-devel > %else > BuildRequires: libuuid-devel > +BuildRequires: libconfig-devel > %endif > > BuildRequires: libxml2-devel > BuildRequires: libcmpiutil-devel > -BuildRequires: libconfig-devel > BuildConflicts: sblim-cmpi-devel > > %description > diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c > --- a/libxkutil/misc_util.c > +++ b/libxkutil/misc_util.c > @@ -20,6 +20,8 @@ > * License along with this library; if not, write to the Free Software > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > */ > +#include "config.h" > + > #include > #include > #include > @@ -35,12 +37,14 @@ > > #include > #include > + > +#ifdef HAVE_LIBCONFIG > #include > +#endif > > #include "misc_util.h" > #include "cs_util.h" > > -#include "config.h" > > #define URI_ENV "HYPURI" > > @@ -58,8 +62,11 @@ > > static int is_read_only(void) > { > + int readonly = 0; > + > +#ifdef HAVE_LIBCONFIG > config_t conf; > - int ret, readonly = 0; > + int ret; > const char *readonly_str = "readonly"; > > config_init(&conf); > @@ -82,6 +89,7 @@ > LIBVIRTCIM_CONF, readonly); > out: > config_destroy(&conf); > +#endif > > /* Default value is 0 (false) */ > return readonly; > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Mon Jul 18 13:55:07 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Mon, 18 Jul 2011 09:55:07 -0400 Subject: [Libvirt-cim] [PATCH] Add SDL graphic device support In-Reply-To: <4E23E69C.2090109@linux.vnet.ibm.com> References: <4E1E8D82.8080802@linux.vnet.ibm.com> <4E205945.8070209@linux.vnet.ibm.com> <4E23E69C.2090109@linux.vnet.ibm.com> Message-ID: <4E243B3B.6040104@linux.vnet.ibm.com> On 07/18/2011 03:54 AM, Wayne Xia wrote: > many thanks for your response. > > some description: > Currently the SDL frame buffer is still supported by qemu and > libvirt, and I like to use it more than VNC. :) > https://bugzilla.linux.ibm.com/show_bug.cgi?id=71347 > > what libvirt-cim concern is to correctly pass the user definition about > it to libvirt, as parameters. > > following is my comments. Be sure the comment above is present when the patch is resubmitted > > ? 2011-7-15 23:14, Eduardo Lima (Etrunko) ??: >> On 07/14/2011 03:32 AM, Wayne Xia wrote: >>> # HG changeset patch >>> # User Wayne Xia >>> # Date 1310271518 -28800 >>> # Node ID ec5e5be04391afa9bab3b4a59bc5596a68a9f175 >>> # Parent 395f2d684c1046455462db7e4e87d30e7aae0feb >>> Add SDL graphic device support >>> >>> the options are described in ResourceAllocationSettingData.mof >>> >> >> Thanks for the patch! >> >> Please provide the description also in the commit message. It is also >> important to explain how your patch works and maybe the reasons of why >> you decided to do things this way. See below. >> >>> Signed-off-by: Wayne Xia >>> >>> diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/device_parsing.c >>> --- a/libxkutil/device_parsing.c Tue Jul 05 15:52:31 2011 -0300 >>> +++ b/libxkutil/device_parsing.c Sun Jul 10 12:18:38 2011 +0800 >>> @@ -90,11 +90,16 @@ >>> >>> static void cleanup_graphics_device(struct graphics_device *dev) >>> { >>> - free(dev->type); >>> - free(dev->port); >>> - free(dev->host); >>> - free(dev->keymap); >>> - free(dev->passwd); >>> + if (dev->type !=NULL) >>> + free(dev->type); >>> + if (dev->port !=NULL) >>> + free(dev->port); >>> + if (dev->host !=NULL) >>> + free(dev->host); >>> + if (dev->keymap !=NULL) >>> + free(dev->keymap); >>> + if (dev->passwd !=NULL) >>> + free(dev->passwd); >>> } >>> >> >> I am not sure if those checks are really necessary. Isn't free(NULL) >> handled by glibc? One thing that could definitely cause a crash is >> having the dev pointer assigned to NULL. >> > a crash happened before I added this code, more investigation need to > do about it. Please do. The null check before delete is noisy :) > >>> static void cleanup_input_device(struct input_device *dev) >>> @@ -529,6 +534,13 @@ >>> if (gdev->port == NULL || gdev->host == NULL) >>> goto err; >>> } >>> + else if (STREQC(gdev->type, "sdl")) { >>> + SDL_display(gdev) = get_attr_value(node, "display"); >>> + SDL_xauth(gdev) = get_attr_value(node, "xauth"); >>> + SDL_fullscreen(gdev) = get_attr_value(node, "fullscreen"); >>> + gdev->passwd = NULL; >>> + } >>> + >>> else if (STREQC(gdev->type, "pty")) { >>> if (node->name == NULL) >>> goto err; >>> diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/device_parsing.h >>> --- a/libxkutil/device_parsing.h Tue Jul 05 15:52:31 2011 -0300 >>> +++ b/libxkutil/device_parsing.h Sun Jul 10 12:18:38 2011 +0800 >>> @@ -83,6 +83,9 @@ >>> char *path; >>> }; >>> >>> +#define SDL_display(dev) (dev->port) >>> +#define SDL_xauth(dev) (dev->host) >>> +#define SDL_fullscreen(dev) (dev->keymap) >> >> You see, this is a decision you should have explained in the commit >> message. Anyway, I really don't like the idea of reusing the struct >> fields for another completely different purpose. Imagine when another >> type of graphic device lands. Wouldn't it be better to describe each >> graphic device as union? Code will look a lot more cleaner, less error >> prone and easier to maintain. >> > I agree this is a bad style. > But when I tried to use union, it seems the structure declaration need > to be changed too much making old code not compatible. For eg, > if graphics_device is declare as this: > > union graphics_device{ > struct vnc_device{ > .... > }dev1; > struct sdl_device{ > .... > }deve; > }graphics_device1; > > then in code: > struct graphics_device* dev= *list; > dev->type = 0; > > code like this would all need to be changed. it seems an additional > layer of member need to be added, if union is used. > I think the union approach is the way to go, even if it impacts existing code. The change is mostly a cut and paste and occurs in relatively few places in the code. >>> struct graphics_device { >>> char *type; >>> char *port; >>> diff -r 395f2d684c10 -r ec5e5be04391 libxkutil/xmlgen.c >>> --- a/libxkutil/xmlgen.c Tue Jul 05 15:52:31 2011 -0300 >>> +++ b/libxkutil/xmlgen.c Sun Jul 10 12:18:38 2011 +0800 >>> @@ -421,8 +421,21 @@ >>> >>> xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); >>> >>> - if (STREQC(dev->type, "sdl")) >>> - return NULL; >>> + if (STREQC(dev->type, "sdl")) { >>> + if (SDL_display(dev)) { >>> + xmlNewProp(tmp, BAD_CAST "display", >>> + BAD_CAST SDL_display(dev)); >>> + } >>> + if (SDL_xauth(dev)) { >>> + xmlNewProp(tmp, BAD_CAST "xauth", >>> + BAD_CAST SDL_xauth(dev)); >>> + } >>> + if (SDL_fullscreen(dev)) { >>> + xmlNewProp(tmp, BAD_CAST "fullscreen", >>> + BAD_CAST SDL_fullscreen(dev)); >>> + } >>> + return NULL; >>> + } >>> >>> if (dev->port) { >>> xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); >>> diff -r 395f2d684c10 -r ec5e5be04391 >>> schema/ResourceAllocationSettingData.mof >>> --- a/schema/ResourceAllocationSettingData.mof Tue Jul 05 15:52:31 2011 >>> -0300 >>> +++ b/schema/ResourceAllocationSettingData.mof Sun Jul 10 12:18:38 2011 >>> +0800 >> >> What is this change from 0300 to 0800?? >> > I thought it is auto generated by the HG, isn't it? > >>> @@ -219,7 +219,9 @@ >>> [Description ("If ResourceSubType is 'vnc', this is a VNC Address. " >>> "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If >>> ResourceSubType " >>> "is 'console', this is a character device path in " >>> - "path:port format (e.g., '/dev/pts/3:0'\)")] >>> + "path:port format (e.g., '/dev/pts/3:0'\)." >>> + "if ResourceSubType is 'sdl', this is a combination of its >>> params as " >>> + "xauth:display (e.g., '/root/.Xauthority::0'\)")] >>> string Address; >>> >>> [Description ("Keyboard keymapping")] >>> @@ -228,7 +230,8 @@ >>> [Description ("VNC password")] >>> string Password; >>> >>> - [Description ("Is IPv6 only addressing is to be used")] >>> + [Description ("Is IPv6 only addressing is to be used." >>> + "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")] >>> boolean IsIPv6Only; >>> }; >>> > > here SDL used same attribute name For other graphic device, to minimize > the change in schema. >>> diff -r 395f2d684c10 -r ec5e5be04391 src/Virt_RASD.c >>> --- a/src/Virt_RASD.c Tue Jul 05 15:52:31 2011 -0300 >>> +++ b/src/Virt_RASD.c Sun Jul 10 12:18:38 2011 +0800 >>> @@ -416,12 +416,14 @@ >>> virDomainPtr dom = NULL; >>> struct infostore_ctx *infostore = NULL; >>> bool has_passwd = false; >>> - >>> + const struct graphics_device *gdev = &dev->dev.graphics; >>> + >>> CMSetProperty(inst, "ResourceSubType", >>> (CMPIValue *)dev->dev.graphics.type, CMPI_chars); >>> >>> - if (STREQC(dev->dev.graphics.type, "sdl")) >>> - rc = asprintf(&addr_str, "%s", dev->dev.graphics.type); >>> + if (STREQC(dev->dev.graphics.type, "sdl")) { >>> + rc = asprintf(&addr_str, "%s:%s", SDL_xauth(gdev), >>> SDL_display(gdev)); >>> + } >>> else { >>> rc = asprintf(&addr_str, >>> "%s:%s", >>> diff -r 395f2d684c10 -r ec5e5be04391 >>> src/Virt_VirtualSystemManagementService.c >>> --- a/src/Virt_VirtualSystemManagementService.c Tue Jul 05 15:52:31 2011 >>> -0300 >>> +++ b/src/Virt_VirtualSystemManagementService.c Sun Jul 10 12:18:38 2011 >>> +0800 >> >> Another one... >> >>> @@ -1059,6 +1059,52 @@ >>> return ret; >>> } >>> >>> +static int parse_sdl_address(const char *id, >>> + char **display, >>> + char **xauth) >>> +{ >>> + int ret; >>> + char *tmp_display = NULL; >>> + char *tmp_xauth = NULL; >>> + >>> + CU_DEBUG("Entering parse_sdl_address, address is %s", id); >>> + >>> + ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display); >>> + >>> + if (ret <= 0) { >>> + ret = sscanf(id, ":%as", &tmp_display); >>> + if (ret <= 0) { >>> + if (STREQC(id, ":")) { >>> + /* do nothing, it is empty */ >>> + } >>> + else { >>> + ret = 0; >>> + goto out; >>> + } >>> + } >>> + } >>> + >>> + if (display) { >>> + if (tmp_display == NULL) >>> + *display = NULL; >>> + else >>> + *display = strdup(tmp_display); >>> + } >>> + if (xauth) { >>> + if (tmp_xauth == NULL) >>> + *xauth = NULL; >>> + else >>> + *xauth = strdup(tmp_xauth); >>> + } >>> + ret = 1; >>> + >>> + out: >>> + CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s", >>> + *display, *xauth); >>> + >>> + return ret; >>> +} >>> + >>> static int parse_vnc_address(const char *id, >>> char **ip, >>> char **port) >>> @@ -1103,6 +1149,7 @@ >>> const char *msg = NULL; >>> bool ipv6 = false; >>> int ret; >>> + struct graphics_device *gdev = &dev->dev.graphics; >>> >>> if (cu_get_str_prop(inst, "ResourceSubType", &val) != >>> CMPI_RC_OK) { >>> msg = "GraphicsRASD ResourceSubType field not valid"; >>> @@ -1162,6 +1209,30 @@ >>> msg = "GraphicsRASD field Address not valid"; >>> goto out; >>> } >>> + } >>> + else if (STREQC(dev->dev.graphics.type, "sdl")) { >>> + if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) { >>> + CU_DEBUG("sdl graphics Address empty, using >>> default"); >>> + SDL_display(gdev) = NULL; >>> + SDL_xauth(gdev) = NULL; >>> + } >>> + else { >>> + ret = parse_sdl_address(val, >>> + &SDL_display(gdev), >>> + &SDL_xauth(gdev)); >>> + if (ret != 1) { >>> + msg = "GraphicsRASD sdl Address not >>> valid"; >>> + goto out; >>> + } >>> + } >>> + SDL_fullscreen(gdev) = NULL; >>> + if (cu_get_bool_prop(inst, "IsIPV6Only", &ipv6) == >>> + CMPI_RC_OK) { >>> + if (ipv6) >>> + SDL_fullscreen(gdev) = >>> strdup("yes"); >>> + else >>> + SDL_fullscreen(gdev) = >>> strdup("no"); >>> + } >>> } else { >>> CU_DEBUG("Unsupported graphics type %s", >>> dev->dev.graphics.type); >>> @@ -1172,6 +1243,9 @@ >>> free(dev->id); >>> if (STREQC(dev->dev.graphics.type, "vnc")) >>> ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); >>> + else if (STREQC(dev->dev.graphics.type, "sdl")) >>> + ret = asprintf(&dev->id, "%s:%s:%s", >>> + dev->dev.graphics.type, SDL_xauth(gdev), >>> SDL_display(gdev)); >>> else >>> ret = asprintf(&dev->id, "%s:%s", >>> dev->dev.graphics.type, >>> dev->dev.graphics.port); >>> @@ -1493,7 +1567,6 @@ >>> "Failed to lookup resulting system"); >>> goto out; >>> } >>> - >>> out: >>> virDomainFree(dom); >>> virConnectClose(conn); >> >> Best regards, >> > > -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From eblima at linux.vnet.ibm.com Mon Jul 18 14:13:55 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Mon, 18 Jul 2011 11:13:55 -0300 Subject: [Libvirt-cim] [PATCH] libxkutil: Handle vnc password when retrieving domain XML Message-ID: <3c90a88a5199a4ed931a.1310998435@etrunko-t410.br.ibm.com> # HG changeset patch # User Eduardo Lima (Etrunko) # Date 1310998420 10800 # Node ID 3c90a88a5199a4ed931a4a76097cff8f55deae41 # Parent 3ac0556ffdf12015839ebafe035547cea5b715f5 libxkutil: Handle vnc password when retrieving domain XML Whenever a call for ModifyResourceSettings was issued, the XML for the domain was requested, parsed, the property had its value changed and then XML was updated with the new value. It occurs that we need to specify the VIR_DOMAIN_XML_SECURE flag to retrieve full domain info, including sensitive fields, such as passwords. This patch fixes the problem for vnc password, which was not handled in the XML parsing code. Signed-off-by: Eduardo Lima (Etrunko) diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -525,6 +525,7 @@ gdev->port = get_attr_value(node, "port"); gdev->host = get_attr_value(node, "listen"); gdev->keymap = get_attr_value(node, "keymap"); + gdev->passwd = get_attr_value(node, "passwd"); if (gdev->port == NULL || gdev->host == NULL) goto err; @@ -1127,7 +1128,7 @@ char *xml; int ret; int start; - xml = virDomainGetXMLDesc(dom, 0); + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); if (xml == NULL) return 0; From cvincent at linux.vnet.ibm.com Mon Jul 18 14:41:51 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Mon, 18 Jul 2011 10:41:51 -0400 Subject: [Libvirt-cim] [PATCH] libxkutil: Handle vnc password when retrieving domain XML In-Reply-To: <3c90a88a5199a4ed931a.1310998435@etrunko-t410.br.ibm.com> References: <3c90a88a5199a4ed931a.1310998435@etrunko-t410.br.ibm.com> Message-ID: <4E24462F.9060308@linux.vnet.ibm.com> +1 and pushed. BTW - Prior to this change, libvirt-cim was using the info store (has_vnc_passwd) for persisting the fact the password was set. It appears we can now remove that logic since the XML contains this data. For reference: Virt_VirtualSystemManagementService.c ~1548 sets has_vnc_passwd Virt_RASD.c ~457 fetches has_vnc_passwd Objections? On 07/18/2011 10:13 AM, Eduardo Lima (Etrunko) wrote: > # HG changeset patch > # User Eduardo Lima (Etrunko) > # Date 1310998420 10800 > # Node ID 3c90a88a5199a4ed931a4a76097cff8f55deae41 > # Parent 3ac0556ffdf12015839ebafe035547cea5b715f5 > libxkutil: Handle vnc password when retrieving domain XML > > Whenever a call for ModifyResourceSettings was issued, the XML for the > domain was requested, parsed, the property had its value changed and then > XML was updated with the new value. > > It occurs that we need to specify the VIR_DOMAIN_XML_SECURE flag to retrieve > full domain info, including sensitive fields, such as passwords. This patch > fixes the problem for vnc password, which was not handled in the XML parsing > code. > > Signed-off-by: Eduardo Lima (Etrunko) > > diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c > +++ b/libxkutil/device_parsing.c > @@ -525,6 +525,7 @@ > gdev->port = get_attr_value(node, "port"); > gdev->host = get_attr_value(node, "listen"); > gdev->keymap = get_attr_value(node, "keymap"); > + gdev->passwd = get_attr_value(node, "passwd"); > > if (gdev->port == NULL || gdev->host == NULL) > goto err; > @@ -1127,7 +1128,7 @@ > char *xml; > int ret; > int start; > - xml = virDomainGetXMLDesc(dom, 0); > + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); > > if (xml == NULL) > return 0; > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From eblima at linux.vnet.ibm.com Mon Jul 18 15:01:17 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Mon, 18 Jul 2011 12:01:17 -0300 Subject: [Libvirt-cim] [PATCH] libxkutil: Handle vnc password when retrieving domain XML In-Reply-To: <4E24462F.9060308@linux.vnet.ibm.com> References: <3c90a88a5199a4ed931a.1310998435@etrunko-t410.br.ibm.com> <4E24462F.9060308@linux.vnet.ibm.com> Message-ID: <4E244ABD.3010602@linux.vnet.ibm.com> On 07/18/2011 11:41 AM, Chip Vincent wrote: > +1 and pushed. > > BTW - Prior to this change, libvirt-cim was using the info store > (has_vnc_passwd) for persisting the fact the password was set. It > appears we can now remove that logic since the XML contains this data. > > For reference: > Virt_VirtualSystemManagementService.c ~1548 sets has_vnc_passwd > Virt_RASD.c ~457 fetches has_vnc_passwd > > Objections? > Code cleanups are always good. I had the impression that code was used by something else. Best regards, -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From bestor at us.ibm.com Mon Jul 18 18:39:44 2011 From: bestor at us.ibm.com (Gareth S Bestor) Date: Mon, 18 Jul 2011 11:39:44 -0700 Subject: [Libvirt-cim] Patch(es) for Virt_SettingsDefineCapabilities: incorrect Default ValueRole, strstr() misuse Message-ID: Please find below a patch to Virt_SettingsDefineCapabilities.c to fix a couple issues I found: - The CIM_AllocationCapabilities for 'Default' RASDs have the incorrect ValueRole. per DSP1043 "Allocation Capabilities Profile", Section 10.5 "CIM_SettingsDefineCapabilities ? Default" the ValueRole should be 0 ("Default") - Fixed mistake with usage of strstr() swapping the arguments; should be: char *strstr(const char *haystack, const char *needle); This may not have mattered before when both strings were always exactly same or didnt match, but now for new 'Point' instances the instanceid has a prefix. [Thnx Sharad for catching this] Please excuse the fact the patch is not in the correct format - I am still setting up my mercurial to correctly format and post patches, thnx. # User Dr. Gareth S. Bestor # diff -r 395f2d684c10 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Tue Jul 05 15:52:31 2011 -0300 +++ b/src/Virt_SettingsDefineCapabilities.c Mon Jul 18 04:11:35 2011 -0700 @@ -2054,20 +2188,21 @@ goto out; } - if (strstr("Default", iid) != NULL) + if (strstr(iid, "Default") != NULL) { valuerange = SDC_RANGE_POINT; - else if (strstr("Increment", iid) != NULL) + valuerole = SDC_ROLE_DEFAULT; + } + else if (strstr(iid, "Point") != NULL) + valuerange = SDC_RANGE_POINT; + else if (strstr(iid, "Increment") != NULL) valuerange = SDC_RANGE_INC; - else if (strstr("Maximum", iid) != NULL) + else if (strstr(iid, "Maximum") != NULL) valuerange = SDC_RANGE_MAX; - else if (strstr("Minimum", iid) != NULL) + else if (strstr(iid, "Minimum") != NULL) valuerange = SDC_RANGE_MIN; else CU_DEBUG("Unknown default RASD type: `%s'", iid); - if (valuerange == SDC_RANGE_POINT) - valuerole = SDC_ROLE_DEFAULT; - CMSetProperty(ref_inst, "ValueRole", (CMPIValue *)&valuerole, CMPI_uint16); CMSetProperty(ref_inst, "ValueRange", Dr. Gareth S. Bestor IBM Senior Software Engineer Systems & Technology Group - Systems Management Standards 971-285-6375 (mobile) bestor at us.ibm.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From snmishra at us.ibm.com Mon Jul 18 18:12:01 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Mon, 18 Jul 2011 11:12:01 -0700 Subject: [Libvirt-cim] [PATCH] Set PoolID for CIM_DiskResourceAllocationSettingData Message-ID: # HG changeset patch # User Sharad Mishra # Date 1311012637 25200 # Node ID d1f131ad4cf75263d8178ebb89ad9dada3997280 # Parent e8c1cdd5c9cbe887286ef169d8ff525cc9035485 Set PoolID for CIM_DiskResourceAllocationSettingData. PoolID wasn't getting set for DiskResourceAllocationSettingData. PoolID for DiskResourceAllocationSettingData is set by appending "DiskPool" to the Storage Pool name. Signed-off-by: Sharad Mishra diff -r e8c1cdd5c9cb -r d1f131ad4cf7 src/Virt_RASD.c --- a/src/Virt_RASD.c Sun Jul 17 12:37:31 2011 -0700 +++ b/src/Virt_RASD.c Mon Jul 18 11:10:37 2011 -0700 @@ -234,6 +234,7 @@ uint64_t cap = 0; uint16_t type; CMPIStatus s = {CMPI_RC_OK, NULL}; + char *poolid = NULL; get_vol_size(broker, ref, dev->dev.disk.source, &cap); @@ -253,6 +254,55 @@ (CMPIValue *)dev->dev.disk.source, CMPI_chars); + virConnectPtr conn = connect_by_classname(broker, CLASSNAME(ref), &s); + if (conn == NULL) { + virt_set_status(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + conn, + "Could not get connection to hypervisor"); + goto cont; + } + + virStorageVolPtr vol = virStorageVolLookupByPath(conn, + dev->dev.disk.source); + if (vol == NULL) { + virt_set_status(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + conn, + "Failed to get StorageVolPtr"); + goto cont; + } + + virStoragePoolPtr pool = virStoragePoolLookupByVolume(vol); + if (pool == NULL) { + virt_set_status(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + conn, + "Failed to get StoragePoolPtr"); + goto cont; + } + + char *pool_name = virStoragePoolGetName(pool); + if (pool_name == NULL) { + virt_set_status(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + conn, + "Failed to get Pool name for volume"); + goto cont; + } + + int ret = asprintf(&poolid, "DiskPool/%s", pool_name); + + if (ret == -1) { + CU_DEBUG("Failed to get disk poolid"); + goto cont; + } + + CMSetProperty(inst, + "PoolID", + (CMPIValue *)poolid, + CMPI_chars); + cont: CMSetProperty(inst, "BusType", (CMPIValue *)dev->dev.disk.bus_type, From cvincent at linux.vnet.ibm.com Fri Jul 15 21:19:18 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Fri, 15 Jul 2011 17:19:18 -0400 Subject: [Libvirt-cim] [PATCH] Make libconfig requirement optional In-Reply-To: <2823d4e157125fc47668.1310149572@etrunko-t410.br.ibm.com> References: <2823d4e157125fc47668.1310149572@etrunko-t410.br.ibm.com> Message-ID: <4E20AED6.9080400@linux.vnet.ibm.com> +1 and pushed On 07/08/2011 02:26 PM, Eduardo Lima (Etrunko) wrote: > # HG changeset patch > # User Eduardo Lima (Etrunko) > # Date 1310149559 10800 > # Node ID 2823d4e157125fc47668a9f0d6ef2f52e52169ce > # Parent 395f2d684c1046455462db7e4e87d30e7aae0feb > Make libconfig requirement optional > > libconfig is a required to build libvirt-cim since r1104, but the > package is not included in RHEL 5, which we still support. This patch > enables libvirt-cim to be built even if libconfig is not found. > > Note that it will not be possible for users of that distro to configure > libvirt-cim to operate in read-only mode. > > Signed-off-by: Eduardo Lima (Etrunko) > > diff --git a/acinclude.m4 b/acinclude.m4 > --- a/acinclude.m4 > +++ b/acinclude.m4 > @@ -272,7 +272,11 @@ > > AC_DEFUN([CHECK_LIBCONFIG], > [ > - PKG_CHECK_MODULES([LIBCONFIG], [libconfig]) > + PKG_CHECK_MODULES([LIBCONFIG], [libconfig], > + [LIBCONFIG_FOUND=yes], [LIBCONFIG_FOUND=no]) > + if test "$LIBCONFIG_FOUND" = "yes" ; then > + AC_DEFINE(HAVE_LIBCONFIG, 1, [Define if libconfig development files were found]) > + fi > AC_SUBST([LIBCONFIG_CFLAGS]) > AC_SUBST([LIBCONFIG_LIBS]) > CPPFLAGS="$CPPFLAGS $LIBCONFIG_CFLAGS" > diff --git a/libvirt-cim.spec.in b/libvirt-cim.spec.in > --- a/libvirt-cim.spec.in > +++ b/libvirt-cim.spec.in > @@ -22,11 +22,11 @@ > BuildRequires: e2fsprogs-devel > %else > BuildRequires: libuuid-devel > +BuildRequires: libconfig-devel > %endif > > BuildRequires: libxml2-devel > BuildRequires: libcmpiutil-devel > -BuildRequires: libconfig-devel > BuildConflicts: sblim-cmpi-devel > > %description > diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c > --- a/libxkutil/misc_util.c > +++ b/libxkutil/misc_util.c > @@ -20,6 +20,8 @@ > * License along with this library; if not, write to the Free Software > * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > */ > +#include "config.h" > + > #include > #include > #include > @@ -35,12 +37,14 @@ > > #include > #include > + > +#ifdef HAVE_LIBCONFIG > #include > +#endif > > #include "misc_util.h" > #include "cs_util.h" > > -#include "config.h" > > #define URI_ENV "HYPURI" > > @@ -58,8 +62,11 @@ > > static int is_read_only(void) > { > + int readonly = 0; > + > +#ifdef HAVE_LIBCONFIG > config_t conf; > - int ret, readonly = 0; > + int ret; > const char *readonly_str = "readonly"; > > config_init(&conf); > @@ -82,6 +89,7 @@ > LIBVIRTCIM_CONF, readonly); > out: > config_destroy(&conf); > +#endif > > /* Default value is 0 (false) */ > return readonly; > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From snmishra at us.ibm.com Mon Jul 18 15:11:37 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Mon, 18 Jul 2011 08:11:37 -0700 Subject: [Libvirt-cim] [PATCH] libxkutil: Handle vnc password when retrieving domain XML In-Reply-To: <4E24462F.9060308@linux.vnet.ibm.com> References: <3c90a88a5199a4ed931a.1310998435@etrunko-t410.br.ibm.com> <4E24462F.9060308@linux.vnet.ibm.com> Message-ID: Sharad Mishra Open Virtualization Linux Technology Center IBM libvirt-cim-bounces at redhat.com wrote on 07/18/2011 07:41:51 AM: > Chip Vincent > Sent by: libvirt-cim-bounces at redhat.com > > 07/18/11 07:41 AM > > Please respond to > cvincent at linux.vnet.ibm.com; Please respond to > List for discussion and development of libvirt CIM > > To > > libvirt-cim at redhat.com > > cc > > Subject > > Re: [Libvirt-cim] [PATCH] libxkutil: Handle vnc password when > retrieving domain XML > > +1 and pushed. > > BTW - Prior to this change, libvirt-cim was using the info store > (has_vnc_passwd) for persisting the fact the password was set. It > appears we can now remove that logic since the XML contains this data. Please remove the logic. > > For reference: > Virt_VirtualSystemManagementService.c ~1548 sets has_vnc_passwd > Virt_RASD.c ~457 fetches has_vnc_passwd > > Objections? I don't see any. > > On 07/18/2011 10:13 AM, Eduardo Lima (Etrunko) wrote: > > # HG changeset patch > > # User Eduardo Lima (Etrunko) > > # Date 1310998420 10800 > > # Node ID 3c90a88a5199a4ed931a4a76097cff8f55deae41 > > # Parent 3ac0556ffdf12015839ebafe035547cea5b715f5 > > libxkutil: Handle vnc password when retrieving domain XML > > > > Whenever a call for ModifyResourceSettings was issued, the XML for the > > domain was requested, parsed, the property had its value changed and then > > XML was updated with the new value. > > > > It occurs that we need to specify the VIR_DOMAIN_XML_SECURE flag to retrieve > > full domain info, including sensitive fields, such as passwords. This patch > > fixes the problem for vnc password, which was not handled in the XML parsing > > code. > > > > Signed-off-by: Eduardo Lima (Etrunko) > > > > diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c > > --- a/libxkutil/device_parsing.c > > +++ b/libxkutil/device_parsing.c > > @@ -525,6 +525,7 @@ > > gdev->port = get_attr_value(node, "port"); > > gdev->host = get_attr_value(node, "listen"); > > gdev->keymap = get_attr_value(node, "keymap"); > > + gdev->passwd = get_attr_value(node, "passwd"); > > > > if (gdev->port == NULL || gdev->host == NULL) > > goto err; > > @@ -1127,7 +1128,7 @@ > > char *xml; > > int ret; > > int start; > > - xml = virDomainGetXMLDesc(dom, 0); > > + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); > > > > if (xml == NULL) > > return 0; > > > > _______________________________________________ > > Libvirt-cim mailing list > > Libvirt-cim at redhat.com > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > -- > Chip Vincent > Open Virtualization > IBM Linux Technology Center > cvincent at linux.vnet.ibm.com > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From cvincent at linux.vnet.ibm.com Fri Jul 15 21:29:59 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Fri, 15 Jul 2011 17:29:59 -0400 Subject: [Libvirt-cim] [PATCH] SwitchService will show the nic connected to VSI switch In-Reply-To: <4E20A6FC.5050301@linux.vnet.ibm.com> References: <4E20A6FC.5050301@linux.vnet.ibm.com> Message-ID: <4E20B157.4090007@linux.vnet.ibm.com> Addressed nit and pushed. On 07/15/2011 04:45 PM, Eduardo Lima (Etrunko) wrote: > On 07/15/2011 01:03 PM, Sharad Mishra wrote: >> # HG changeset patch >> # User Sharad Mishra >> # Date 1310745835 25200 >> # Node ID d458bd51459cd1b470bf9ec74304abb7ff05b53c >> # Parent 395f2d684c1046455462db7e4e87d30e7aae0feb >> SwitchService will show the nic connected to VSI switch. >> >> SwitchService instance will list out the interface connected to the >> VSI capable switch. This helps identify which nic is conneced to VSI >> switch when there are multiple nics. >> > > Could you break the commit message to < 80 columns as well? > >> Signed-off-by: Sharad Mishra >> >> diff -r 395f2d684c10 -r d458bd51459c schema/SwitchService.mof >> --- a/schema/SwitchService.mof Tue Jul 05 15:52:31 2011 -0300 >> +++ b/schema/SwitchService.mof Fri Jul 15 09:03:55 2011 -0700 >> @@ -5,6 +5,7 @@ >> { >> [Description("Flag to determine if VSI is supported on the switch")] >> boolean IsVSISupported; >> + string VSIInterface; >> >> }; >> >> @@ -13,6 +14,7 @@ >> { >> [Description("Flag to determine if VSI is supported on the switch")] >> boolean IsVSISupported; >> + string VSIInterface; >> >> }; >> >> @@ -21,6 +23,7 @@ >> { >> [Description("Flag to determine if VSI is supported on the switch")] >> boolean IsVSISupported; >> + string VSIInterface; >> >> }; >> >> diff -r 395f2d684c10 -r d458bd51459c src/Virt_SwitchService.c >> --- a/src/Virt_SwitchService.c Tue Jul 05 15:52:31 2011 -0300 >> +++ b/src/Virt_SwitchService.c Fri Jul 15 09:03:55 2011 -0700 >> @@ -250,6 +250,8 @@ >> s = check_vsi_support(cmd); >> if (s.rc == CMPI_RC_OK) { >> vsi = true; >> + CMSetProperty(inst, "VSIInterface", >> + (CMPIValue *)if_list[i], CMPI_chars); >> break; >> } >> else >> > > +1. Pretty straightforward. > > -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Mon Jul 18 13:13:28 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Mon, 18 Jul 2011 09:13:28 -0400 Subject: [Libvirt-cim] [PATCH] Set PoolID for CIM_NetResourceAllocationSettingData In-Reply-To: References: Message-ID: <4E243178.9090503@linux.vnet.ibm.com> Out of curiosity, have you run the cimtests with this change? The same sort of change for the graphics devices impacted some of the association logic and cimtests and I want to be sure this does not do the same. I'm inclined to keep the logic below 'as is' and independent of the cimtests, and just fix them separately. Thoughts? On 07/17/2011 03:49 PM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1310931451 25200 > # Node ID e8c1cdd5c9cbe887286ef169d8ff525cc9035485 > # Parent 0563cf6502d4cd10418001d88c0c60b269370b3e > Set PoolID for CIM_NetResourceAllocationSettingData. > > PoolID wasn't getting set for NETResourceAllocationSettingData. PoolID > for NETResourceAllocationSettingData is set by appending "NetworkPool" > to the network name. > > Signed-off-by: Sharad Mishra > > diff -r 0563cf6502d4 -r e8c1cdd5c9cb libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Fri Jul 15 09:03:55 2011 -0700 > +++ b/libxkutil/device_parsing.c Sun Jul 17 12:37:31 2011 -0700 > @@ -372,8 +372,16 @@ > if (ndev->source != NULL) > continue; > ndev->source = get_attr_value(child, "network"); > - if (ndev->source != NULL) > + if (ndev->source != NULL) { > + int ret = asprintf(&ndev->poolid, > + "NetworkPool/%s", > + ndev->source); > + if (ret == -1) { > + CU_DEBUG("Failed to get network" > + " poolid"); > + } > continue; > + } > ndev->source = get_attr_value(child, "dev"); > ndev->net_mode = get_attr_value(child, "mode"); > if ((ndev->source != NULL)&& (ndev->net_mode != NULL)) > diff -r 0563cf6502d4 -r e8c1cdd5c9cb libxkutil/device_parsing.h > --- a/libxkutil/device_parsing.h Fri Jul 15 09:03:55 2011 -0700 > +++ b/libxkutil/device_parsing.h Sun Jul 17 12:37:31 2011 -0700 > @@ -61,6 +61,7 @@ > char *type; > char *mac; > char *source; > + char *poolid; > char *model; > char *device; > char *net_mode; > diff -r 0563cf6502d4 -r e8c1cdd5c9cb src/Virt_RASD.c > --- a/src/Virt_RASD.c Fri Jul 15 09:03:55 2011 -0700 > +++ b/src/Virt_RASD.c Sun Jul 17 12:37:31 2011 -0700 > @@ -401,6 +401,12 @@ > (CMPIValue *)dev->dev.net.model, > CMPI_chars); > > + if (dev->dev.net.poolid != NULL) > + CMSetProperty(inst, > + "PoolID", > + (CMPIValue *)dev->dev.net.poolid, > + CMPI_chars); > + > return s; > } > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From snmishra at us.ibm.com Tue Jul 19 19:46:36 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Tue, 19 Jul 2011 12:46:36 -0700 Subject: [Libvirt-cim] [PATCH] Set PoolID for CIM_NetResourceAllocationSettingData In-Reply-To: <4E243178.9090503@linux.vnet.ibm.com> References: <4E243178.9090503@linux.vnet.ibm.com> Message-ID: Good point Chip. I have not run the entire set of cimtest with this patch. Will do and report the results later today. Regards, Sharad Mishra Open Virtualization Linux Technology Center IBM libvirt-cim-bounces at redhat.com wrote on 07/18/2011 06:13:28 AM: > Chip Vincent > Sent by: libvirt-cim-bounces at redhat.com > > 07/18/11 06:13 AM > > Please respond to > cvincent at linux.vnet.ibm.com; Please respond to > List for discussion and development of libvirt CIM > > To > > libvirt-cim at redhat.com > > cc > > Subject > > Re: [Libvirt-cim] [PATCH] Set PoolID for CIM_NetResourceAllocationSettingData > > Out of curiosity, have you run the cimtests with this change? The same > sort of change for the graphics devices impacted some of the association > logic and cimtests and I want to be sure this does not do the same. > > I'm inclined to keep the logic below 'as is' and independent of the > cimtests, and just fix them separately. > > Thoughts? > > On 07/17/2011 03:49 PM, Sharad Mishra wrote: > > # HG changeset patch > > # User Sharad Mishra > > # Date 1310931451 25200 > > # Node ID e8c1cdd5c9cbe887286ef169d8ff525cc9035485 > > # Parent 0563cf6502d4cd10418001d88c0c60b269370b3e > > Set PoolID for CIM_NetResourceAllocationSettingData. > > > > PoolID wasn't getting set for NETResourceAllocationSettingData. PoolID > > for NETResourceAllocationSettingData is set by appending "NetworkPool" > > to the network name. > > > > Signed-off-by: Sharad Mishra > > > > diff -r 0563cf6502d4 -r e8c1cdd5c9cb libxkutil/device_parsing.c > > --- a/libxkutil/device_parsing.c Fri Jul 15 09:03:55 2011 -0700 > > +++ b/libxkutil/device_parsing.c Sun Jul 17 12:37:31 2011 -0700 > > @@ -372,8 +372,16 @@ > > if (ndev->source != NULL) > > continue; > > ndev->source = get_attr_value(child, "network"); > > - if (ndev->source != NULL) > > + if (ndev->source != NULL) { > > + int ret = asprintf(&ndev->poolid, > > + "NetworkPool/%s", > > + ndev->source); > > + if (ret == -1) { > > + CU_DEBUG("Failed to get network" > > + " poolid"); > > + } > > continue; > > + } > > ndev->source = get_attr_value(child, "dev"); > > ndev->net_mode = get_attr_value(child, "mode"); > > if ((ndev->source != NULL)&& > (ndev->net_mode != NULL)) > > diff -r 0563cf6502d4 -r e8c1cdd5c9cb libxkutil/device_parsing.h > > --- a/libxkutil/device_parsing.h Fri Jul 15 09:03:55 2011 -0700 > > +++ b/libxkutil/device_parsing.h Sun Jul 17 12:37:31 2011 -0700 > > @@ -61,6 +61,7 @@ > > char *type; > > char *mac; > > char *source; > > + char *poolid; > > char *model; > > char *device; > > char *net_mode; > > diff -r 0563cf6502d4 -r e8c1cdd5c9cb src/Virt_RASD.c > > --- a/src/Virt_RASD.c Fri Jul 15 09:03:55 2011 -0700 > > +++ b/src/Virt_RASD.c Sun Jul 17 12:37:31 2011 -0700 > > @@ -401,6 +401,12 @@ > > (CMPIValue *)dev->dev.net.model, > > CMPI_chars); > > > > + if (dev->dev.net.poolid != NULL) > > + CMSetProperty(inst, > > + "PoolID", > > + (CMPIValue *)dev->dev.net.poolid, > > + CMPI_chars); > > + > > return s; > > } > > > > > > _______________________________________________ > > Libvirt-cim mailing list > > Libvirt-cim at redhat.com > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > -- > Chip Vincent > Open Virtualization > IBM Linux Technology Center > cvincent at linux.vnet.ibm.com > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From eblima at linux.vnet.ibm.com Tue Jul 19 19:46:26 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Tue, 19 Jul 2011 16:46:26 -0300 Subject: [Libvirt-cim] [PATCH] libxkutil: More meaningful log message Message-ID: <43f9834c98a030ada1d6.1311104786@etrunko-t410.br.ibm.com> # HG changeset patch # User Eduardo Lima (Etrunko) # Date 1311104779 10800 # Node ID 43f9834c98a030ada1d69693d119cdc6367cf284 # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 libxkutil: More meaningful log message Signed-off-by: Eduardo Lima (Etrunko) diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c --- a/libxkutil/misc_util.c +++ b/libxkutil/misc_util.c @@ -73,14 +73,14 @@ ret = config_read_file(&conf, LIBVIRTCIM_CONF); if (ret == CONFIG_FALSE) { - CU_DEBUG("Error reading config file at liine %d: '%s'\n", + CU_DEBUG("Error reading config file at line %d: '%s'\n", conf.error_line, conf.error_text); goto out; } ret = config_lookup_bool(&conf, readonly_str, &readonly); if (ret == CONFIG_FALSE) { - CU_DEBUG("Error: '%s' not found in config file\n", + CU_DEBUG("'%s' not found in config file, assuming false\n", readonly_str); goto out; } From xiawenc at linux.vnet.ibm.com Wed Jul 20 12:17:06 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Wed, 20 Jul 2011 20:17:06 +0800 Subject: [Libvirt-cim] [PATCH v2 1/2] Add SDL graphic device support Message-ID: <4E26C742.30904@linux.vnet.ibm.com> # HG changeset patch # User Wayne Xia # Date 1311156234 -28800 # Node ID 0c52e4f6c421cc2e168197a82a9333d4ce369655 # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 made the graphic structure as union These change were made to allow SDL device properties added more clearly, the graphic_device structure now contains a union Signed-off-by: Wayne Xia (Wayne) diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300 +++ b/libxkutil/device_parsing.c Wed Jul 20 18:03:54 2011 +0800 @@ -91,10 +91,10 @@ static void cleanup_graphics_device(struct graphics_device *dev) { free(dev->type); - free(dev->port); - free(dev->host); - free(dev->keymap); - free(dev->passwd); + free(dev->dev.vnc.port); + free(dev->dev.vnc.host); + free(dev->dev.vnc.keymap); + free(dev->dev.vnc.passwd); } static void cleanup_input_device(struct input_device *dev) @@ -522,12 +522,12 @@ CU_DEBUG("graphics device type = %s", gdev->type); if (STREQC(gdev->type, "vnc")) { - gdev->port = get_attr_value(node, "port"); - gdev->host = get_attr_value(node, "listen"); - gdev->keymap = get_attr_value(node, "keymap"); - gdev->passwd = get_attr_value(node, "passwd"); + gdev->dev.vnc.port = get_attr_value(node, "port"); + gdev->dev.vnc.host = get_attr_value(node, "listen"); + gdev->dev.vnc.keymap = get_attr_value(node, "keymap"); + gdev->dev.vnc.passwd = get_attr_value(node, "passwd"); - if (gdev->port == NULL || gdev->host == NULL) + if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) goto err; } else if (STREQC(gdev->type, "pty")) { @@ -542,9 +542,9 @@ for (child = node->children; child != NULL; child = child->next) { if (XSTREQ(child->name, "source")) - gdev->host = get_attr_value(child, "path"); + gdev->dev.vnc.host = get_attr_value(child, "path"); else if (XSTREQ(child->name, "target")) - gdev->port = get_attr_value(child, "port"); + gdev->dev.vnc.port = get_attr_value(child, "port"); } } else { @@ -557,7 +557,7 @@ if (STREQC(gdev->type, "vnc")) ret = asprintf(&vdev->id, "%s", gdev->type); else - ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->port); + ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->dev.vnc.port); if (ret == -1) { CU_DEBUG("Failed to create graphics is string"); @@ -798,9 +798,10 @@ DUP_FIELD(dev, _dev, dev.emu.path); } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { DUP_FIELD(dev, _dev, dev.graphics.type); - DUP_FIELD(dev, _dev, dev.graphics.port); - DUP_FIELD(dev, _dev, dev.graphics.host); - DUP_FIELD(dev, _dev, dev.graphics.keymap); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.host); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.port); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.keymap); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.passwd); } else if (dev->type == CIM_RES_TYPE_INPUT) { DUP_FIELD(dev, _dev, dev.input.type); DUP_FIELD(dev, _dev, dev.input.bus); diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300 +++ b/libxkutil/device_parsing.h Wed Jul 20 18:03:54 2011 +0800 @@ -83,14 +83,28 @@ char *path; }; -struct graphics_device { - char *type; +//vnc_device must be larger or equal than sdl_device +struct vnc_device { char *port; char *host; char *keymap; char *passwd; }; +struct sdl_device { + char *display; + char *xauth; + char *fullscreen; +}; + +struct graphics_device { + char *type; + union { + struct vnc_device vnc; + struct sdl_device sdl; + } dev; +}; + struct input_device { char *type; char *bus; diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xml_parse_test.c --- a/libxkutil/xml_parse_test.c Mon Jul 18 11:13:40 2011 -0300 +++ b/libxkutil/xml_parse_test.c Wed Jul 20 18:03:54 2011 +0800 @@ -116,7 +116,7 @@ FILE *d) { print_value(d, "Graphics Type", dev->dev.graphics.type); - print_value(d, "Graphics Port", dev->dev.graphics.port); + print_value(d, "Graphics Port", dev->dev.graphics.dev.vnc.port); } static void print_devices(struct domain *dominfo, diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Mon Jul 18 11:13:40 2011 -0300 +++ b/libxkutil/xmlgen.c Wed Jul 20 18:03:54 2011 +0800 @@ -424,22 +424,22 @@ if (STREQC(dev->type, "sdl")) return NULL; - if (dev->port) { - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); - if (STREQC(dev->port, "-1")) + if (dev->dev.vnc.port) { + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); + if (STREQC(dev->dev.vnc.port, "-1")) xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes"); else xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no"); } - if (dev->host) - xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); + if (dev->dev.vnc.host) + xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->dev.vnc.host); - if (dev->passwd) - xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd); + if (dev->dev.vnc.passwd) + xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->dev.vnc.passwd); - if (dev->keymap) - xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); + if (dev->dev.vnc.keymap) + xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->dev.vnc.keymap); return NULL; } @@ -460,15 +460,15 @@ if (tmp == NULL) return XML_ERROR; - if(dev->host) - xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host); + if(dev->dev.vnc.host) + xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host); tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL); if (tmp == NULL) return XML_ERROR; - if(dev->port) - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); + if(dev->dev.vnc.port) + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); return NULL; } diff -r 3c90a88a5199 -r 0c52e4f6c421 src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Mon Jul 18 11:13:40 2011 -0300 +++ b/src/Virt_ComputerSystem.c Wed Jul 20 18:03:54 2011 +0800 @@ -104,7 +104,7 @@ "Virtual System (Console on %s://%s:%s)", domain->dev_graphics[0].dev.graphics.type, host, - domain->dev_graphics[0].dev.graphics.port); + domain->dev_graphics[0].dev.graphics.dev.vnc.port); else ret = asprintf(&cap, "Virtual System (No console)"); diff -r 3c90a88a5199 -r 0c52e4f6c421 src/Virt_Device.c --- a/src/Virt_Device.c Mon Jul 18 11:13:40 2011 -0300 +++ b/src/Virt_Device.c Wed Jul 20 18:03:54 2011 +0800 @@ -194,8 +194,8 @@ else rc = asprintf(&vp_str, "%s/%s:%s", dev->type, - dev->host, - dev->port); + dev->dev.vnc.host, + dev->dev.vnc.port); if (rc == -1) return 0; diff -r 3c90a88a5199 -r 0c52e4f6c421 src/Virt_KVMRedirectionSAP.c --- a/src/Virt_KVMRedirectionSAP.c Mon Jul 18 11:13:40 2011 -0300 +++ b/src/Virt_KVMRedirectionSAP.c Wed Jul 20 18:03:54 2011 +0800 @@ -366,7 +366,7 @@ continue; } - ret = sscanf(dominfo->dev_graphics->dev.graphics.port, + ret = sscanf(dominfo->dev_graphics->dev.graphics.dev.vnc.port, "%d", &lport); if (ret != 1) { diff -r 3c90a88a5199 -r 0c52e4f6c421 src/Virt_RASD.c --- a/src/Virt_RASD.c Mon Jul 18 11:13:40 2011 -0300 +++ b/src/Virt_RASD.c Wed Jul 20 18:03:54 2011 +0800 @@ -425,8 +425,8 @@ else { rc = asprintf(&addr_str, "%s:%s", - dev->dev.graphics.host, - dev->dev.graphics.port); + dev->dev.graphics.dev.vnc.host, + dev->dev.graphics.dev.vnc.port); } CU_DEBUG("graphics Address = %s", addr_str); @@ -439,7 +439,7 @@ if (STREQC(dev->dev.graphics.type, "vnc")) { CMSetProperty(inst, "KeyMap", - (CMPIValue *)dev->dev.graphics.keymap, CMPI_chars); + (CMPIValue *)dev->dev.graphics.dev.vnc.keymap, CMPI_chars); conn = connect_by_classname(_BROKER, classname, &s); if (conn == NULL) diff -r 3c90a88a5199 -r 0c52e4f6c421 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Jul 18 11:13:40 2011 -0300 +++ b/src/Virt_VirtualSystemManagementService.c Wed Jul 20 18:03:54 2011 +0800 @@ -370,9 +370,9 @@ } domain->dev_graphics->dev.graphics.type = strdup("vnc"); - domain->dev_graphics->dev.graphics.port = strdup("-1"); - domain->dev_graphics->dev.graphics.host = strdup("127.0.0.1"); - domain->dev_graphics->dev.graphics.keymap = strdup("en-us"); + domain->dev_graphics->dev.graphics.dev.vnc.port = strdup("-1"); + domain->dev_graphics->dev.graphics.dev.vnc.host = strdup("127.0.0.1"); + domain->dev_graphics->dev.graphics.dev.vnc.keymap = strdup("en-us"); domain->dev_graphics_ct = 1; return true; @@ -1128,24 +1128,24 @@ } ret = parse_vnc_address(val, - &dev->dev.graphics.host, - &dev->dev.graphics.port); + &dev->dev.graphics.dev.vnc.host, + &dev->dev.graphics.dev.vnc.port); if (ret != 1) { msg = "GraphicsRASD field Address not valid"; goto out; } if (cu_get_str_prop(inst, "KeyMap", &val) != CMPI_RC_OK) - dev->dev.graphics.keymap = strdup("en-us"); + dev->dev.graphics.dev.vnc.keymap = strdup("en-us"); else - dev->dev.graphics.keymap = strdup(val); + dev->dev.graphics.dev.vnc.keymap = strdup(val); if (cu_get_str_prop(inst, "Password", &val) != CMPI_RC_OK) { CU_DEBUG("vnc password is not set"); - dev->dev.graphics.passwd = NULL; + dev->dev.graphics.dev.vnc.passwd = NULL; } else { CU_DEBUG("vnc password is set"); - dev->dev.graphics.passwd = strdup(val); + dev->dev.graphics.dev.vnc.passwd = strdup(val); } } else if (STREQC(dev->dev.graphics.type, "console") || @@ -1156,8 +1156,8 @@ } ret = parse_console_address(val, - &dev->dev.graphics.host, - &dev->dev.graphics.port); + &dev->dev.graphics.dev.vnc.host, + &dev->dev.graphics.dev.vnc.port); if (ret != 1) { msg = "GraphicsRASD field Address not valid"; goto out; @@ -1174,7 +1174,7 @@ ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); else ret = asprintf(&dev->id, "%s:%s", - dev->dev.graphics.type, dev->dev.graphics.port); + dev->dev.graphics.type, dev->dev.graphics.dev.vnc.port); if (ret == -1) { msg = "Failed to create graphics is string"; @@ -1545,7 +1545,7 @@ dev = dominfo->dev_graphics; if(dev != NULL){ - if (dev->dev.graphics.passwd != NULL) + if (dev->dev.graphics.dev.vnc.passwd != NULL) infostore_set_bool(ctx, "has_vnc_passwd", true); else infostore_set_bool(ctx, "has_vnc_passwd", false); From xiawenc at linux.vnet.ibm.com Wed Jul 20 12:17:15 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Wed, 20 Jul 2011 20:17:15 +0800 Subject: [Libvirt-cim] [PATCH v2 2/2] Add SDL graphic device support Message-ID: <4E26C74B.5010801@linux.vnet.ibm.com> # HG changeset patch # User Wayne Xia # Date 1311161825 -28800 # Node ID 4c47a4b500e86abe2bb6461fdaaf2fe5d2e1d861 # Parent 0c52e4f6c421cc2e168197a82a9333d4ce369655 add sdl frame buffer support. Now libvirt still supports sdl frame buffer, and it may take three parameters: display,xauth,fullscreen. This patch enable the libvirt-cim to accept these configuration and pass them in XML define to let libvirt know about it.Exposed interface could be found in the file ResourceAllocationSettingData.mof. https://bugzilla.linux.ibm.com/show_bug.cgi?id=71347 diff -r 0c52e4f6c421 -r 4c47a4b500e8 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Wed Jul 20 18:03:54 2011 +0800 +++ b/libxkutil/device_parsing.c Wed Jul 20 19:37:05 2011 +0800 @@ -530,6 +530,11 @@ if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) goto err; } + else if (STREQC(gdev->type, "sdl")) { + gdev->dev.sdl.display = get_attr_value(node, "display"); + gdev->dev.sdl.xauth = get_attr_value(node, "xauth"); + gdev->dev.sdl.fullscreen = get_attr_value(node, "fullscreen"); + } else if (STREQC(gdev->type, "pty")) { if (node->name == NULL) goto err; diff -r 0c52e4f6c421 -r 4c47a4b500e8 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Wed Jul 20 18:03:54 2011 +0800 +++ b/libxkutil/xmlgen.c Wed Jul 20 19:37:05 2011 +0800 @@ -421,8 +421,21 @@ xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); - if (STREQC(dev->type, "sdl")) - return NULL; + if (STREQC(dev->type, "sdl")) { + if (dev->dev.sdl.display) { + xmlNewProp(tmp, BAD_CAST "display", + BAD_CAST dev->dev.sdl.display); + } + if (dev->dev.sdl.xauth) { + xmlNewProp(tmp, BAD_CAST "xauth", + BAD_CAST dev->dev.sdl.xauth); + } + if (dev->dev.sdl.fullscreen) { + xmlNewProp(tmp, BAD_CAST "fullscreen", + BAD_CAST dev->dev.sdl.fullscreen); + } + return NULL; + } if (dev->dev.vnc.port) { xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); diff -r 0c52e4f6c421 -r 4c47a4b500e8 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Wed Jul 20 18:03:54 2011 +0800 +++ b/schema/ResourceAllocationSettingData.mof Wed Jul 20 19:37:05 2011 +0800 @@ -219,7 +219,9 @@ [Description ("If ResourceSubType is 'vnc', this is a VNC Address. " "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If ResourceSubType " "is 'console', this is a character device path in " - "path:port format (e.g., '/dev/pts/3:0'\)")] + "path:port format (e.g., '/dev/pts/3:0'\) " + "if ResourceSubType is 'sdl', this is a combination of its params as " + "xauth:display (e.g., '/root/.Xauthority::0'\)")] string Address; [Description ("Keyboard keymapping")] @@ -228,7 +230,8 @@ [Description ("VNC password")] string Password; - [Description ("Is IPv6 only addressing is to be used")] + [Description ("Is IPv6 only addressing is to be used." + "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")] boolean IsIPv6Only; }; diff -r 0c52e4f6c421 -r 4c47a4b500e8 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Wed Jul 20 18:03:54 2011 +0800 +++ b/src/Virt_VirtualSystemManagementService.c Wed Jul 20 19:37:05 2011 +0800 @@ -1059,6 +1059,52 @@ return ret; } +static int parse_sdl_address(const char *id, + char **display, + char **xauth) +{ + int ret; + char *tmp_display = NULL; + char *tmp_xauth = NULL; + + CU_DEBUG("Entering parse_sdl_address, address is %s", id); + + ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display); + + if (ret <= 0) { + ret = sscanf(id, ":%as", &tmp_display); + if (ret <= 0) { + if (STREQC(id, ":")) { + /* do nothing, it is empty */ + } + else { + ret = 0; + goto out; + } + } + } + + if (display) { + if (tmp_display == NULL) + *display = NULL; + else + *display = strdup(tmp_display); + } + if (xauth) { + if (tmp_xauth == NULL) + *xauth = NULL; + else + *xauth = strdup(tmp_xauth); + } + ret = 1; + + out: + CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s", + *display, *xauth); + + return ret; +} + static int parse_vnc_address(const char *id, char **ip, char **port) @@ -1162,6 +1208,30 @@ msg = "GraphicsRASD field Address not valid"; goto out; } + } + else if (STREQC(dev->dev.graphics.type, "sdl")) { + if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) { + CU_DEBUG("sdl graphics Address empty, using default"); + dev->dev.graphics.dev.sdl.display = NULL; + dev->dev.graphics.dev.sdl.xauth = NULL; + } + else { + ret = parse_sdl_address(val, + &dev->dev.graphics.dev.sdl.display, + &dev->dev.graphics.dev.sdl.xauth); + if (ret != 1) { + msg = "GraphicsRASD sdl Address not valid"; + goto out; + } + } + dev->dev.graphics.dev.sdl.fullscreen = NULL; + if (cu_get_bool_prop(inst, "IsIPV6Only", &ipv6) == + CMPI_RC_OK) { + if (ipv6) + dev->dev.graphics.dev.sdl.fullscreen = strdup("yes"); + else + dev->dev.graphics.dev.sdl.fullscreen = strdup("no"); + } } else { CU_DEBUG("Unsupported graphics type %s", dev->dev.graphics.type); @@ -1170,7 +1240,8 @@ } free(dev->id); - if (STREQC(dev->dev.graphics.type, "vnc")) + if ((STREQC(dev->dev.graphics.type, "vnc"))|| + (STREQC(dev->dev.graphics.type, "sdl"))) ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); else ret = asprintf(&dev->id, "%s:%s", From cvincent at linux.vnet.ibm.com Wed Jul 20 13:25:46 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 20 Jul 2011 09:25:46 -0400 Subject: [Libvirt-cim] [PATCH] Set PoolID for CIM_NetResourceAllocationSettingData In-Reply-To: References: <4E243178.9090503@linux.vnet.ibm.com> Message-ID: <4E26D75A.3080902@linux.vnet.ibm.com> +1 and pushed since as I mentioned before, this change is correct and we can resolve any test issues via another patch. On 07/19/2011 03:46 PM, Sharad Mishra wrote: > Good point Chip. I have not run the entire set of cimtest with this patch. > Will do and report the results later today. > > Regards, > Sharad Mishra > Open Virtualization > Linux Technology Center > IBM > > libvirt-cim-bounces at redhat.com wrote on 07/18/2011 06:13:28 AM: > > > Chip Vincent > > Sent by: libvirt-cim-bounces at redhat.com > > > > 07/18/11 06:13 AM > > > > Please respond to > > cvincent at linux.vnet.ibm.com; Please respond to > > List for discussion and development of libvirt CIM > > > > > To > > > > libvirt-cim at redhat.com > > > > cc > > > > Subject > > > > Re: [Libvirt-cim] [PATCH] Set PoolID for > CIM_NetResourceAllocationSettingData > > > > Out of curiosity, have you run the cimtests with this change? The same > > sort of change for the graphics devices impacted some of the association > > logic and cimtests and I want to be sure this does not do the same. > > > > I'm inclined to keep the logic below 'as is' and independent of the > > cimtests, and just fix them separately. > > > > Thoughts? > > > > On 07/17/2011 03:49 PM, Sharad Mishra wrote: > > > # HG changeset patch > > > # User Sharad Mishra > > > # Date 1310931451 25200 > > > # Node ID e8c1cdd5c9cbe887286ef169d8ff525cc9035485 > > > # Parent 0563cf6502d4cd10418001d88c0c60b269370b3e > > > Set PoolID for CIM_NetResourceAllocationSettingData. > > > > > > PoolID wasn't getting set for NETResourceAllocationSettingData. PoolID > > > for NETResourceAllocationSettingData is set by appending "NetworkPool" > > > to the network name. > > > > > > Signed-off-by: Sharad Mishra > > > > > > diff -r 0563cf6502d4 -r e8c1cdd5c9cb libxkutil/device_parsing.c > > > --- a/libxkutil/device_parsing.c Fri Jul 15 09:03:55 2011 -0700 > > > +++ b/libxkutil/device_parsing.c Sun Jul 17 12:37:31 2011 -0700 > > > @@ -372,8 +372,16 @@ > > > if (ndev->source != NULL) > > > continue; > > > ndev->source = get_attr_value(child, "network"); > > > - if (ndev->source != NULL) > > > + if (ndev->source != NULL) { > > > + int ret = asprintf(&ndev->poolid, > > > + "NetworkPool/%s", > > > + ndev->source); > > > + if (ret == -1) { > > > + CU_DEBUG("Failed to get network" > > > + " poolid"); > > > + } > > > continue; > > > + } > > > ndev->source = get_attr_value(child, "dev"); > > > ndev->net_mode = get_attr_value(child, "mode"); > > > if ((ndev->source != NULL)&& > > (ndev->net_mode != NULL)) > > > diff -r 0563cf6502d4 -r e8c1cdd5c9cb libxkutil/device_parsing.h > > > --- a/libxkutil/device_parsing.h Fri Jul 15 09:03:55 2011 -0700 > > > +++ b/libxkutil/device_parsing.h Sun Jul 17 12:37:31 2011 -0700 > > > @@ -61,6 +61,7 @@ > > > char *type; > > > char *mac; > > > char *source; > > > + char *poolid; > > > char *model; > > > char *device; > > > char *net_mode; > > > diff -r 0563cf6502d4 -r e8c1cdd5c9cb src/Virt_RASD.c > > > --- a/src/Virt_RASD.c Fri Jul 15 09:03:55 2011 -0700 > > > +++ b/src/Virt_RASD.c Sun Jul 17 12:37:31 2011 -0700 > > > @@ -401,6 +401,12 @@ > > > (CMPIValue *)dev->dev.net.model, > > > CMPI_chars); > > > > > > + if (dev->dev.net.poolid != NULL) > > > + CMSetProperty(inst, > > > + "PoolID", > > > + (CMPIValue *)dev->dev.net.poolid, > > > + CMPI_chars); > > > + > > > return s; > > > } > > > > > > > > > _______________________________________________ > > > Libvirt-cim mailing list > > > Libvirt-cim at redhat.com > > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > -- > > Chip Vincent > > Open Virtualization > > IBM Linux Technology Center > > cvincent at linux.vnet.ibm.com > > > > _______________________________________________ > > Libvirt-cim mailing list > > Libvirt-cim at redhat.com > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Wed Jul 20 13:48:50 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 20 Jul 2011 09:48:50 -0400 Subject: [Libvirt-cim] [PATCH] Set PoolID for CIM_DiskResourceAllocationSettingData In-Reply-To: References: Message-ID: <4E26DCC2.3010702@linux.vnet.ibm.com> On 07/18/2011 02:12 PM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1311012637 25200 > # Node ID d1f131ad4cf75263d8178ebb89ad9dada3997280 > # Parent e8c1cdd5c9cbe887286ef169d8ff525cc9035485 > Set PoolID for CIM_DiskResourceAllocationSettingData. > > PoolID wasn't getting set for DiskResourceAllocationSettingData. PoolID > for DiskResourceAllocationSettingData is set by appending "DiskPool" > to the Storage Pool name. > > Signed-off-by: Sharad Mishra > > diff -r e8c1cdd5c9cb -r d1f131ad4cf7 src/Virt_RASD.c > --- a/src/Virt_RASD.c Sun Jul 17 12:37:31 2011 -0700 > +++ b/src/Virt_RASD.c Mon Jul 18 11:10:37 2011 -0700 > @@ -234,6 +234,7 @@ > uint64_t cap = 0; > uint16_t type; > CMPIStatus s = {CMPI_RC_OK, NULL}; > + char *poolid = NULL; > > get_vol_size(broker, ref, dev->dev.disk.source,&cap); > > @@ -253,6 +254,55 @@ > (CMPIValue *)dev->dev.disk.source, > CMPI_chars); > > + virConnectPtr conn = connect_by_classname(broker, CLASSNAME(ref),&s); > + if (conn == NULL) { > + virt_set_status(broker,&s, > + CMPI_RC_ERR_NOT_FOUND, > + conn, > + "Could not get connection to hypervisor"); > + goto cont; > + } > + > + virStorageVolPtr vol = virStorageVolLookupByPath(conn, > + dev->dev.disk.source); > + if (vol == NULL) { > + virt_set_status(broker,&s, > + CMPI_RC_ERR_NOT_FOUND, > + conn, > + "Failed to get StorageVolPtr"); > + goto cont; > + } > + > + virStoragePoolPtr pool = virStoragePoolLookupByVolume(vol); > + if (pool == NULL) { > + virt_set_status(broker,&s, > + CMPI_RC_ERR_NOT_FOUND, > + conn, > + "Failed to get StoragePoolPtr"); > + goto cont; > + } > + > + char *pool_name = virStoragePoolGetName(pool); cc1: warnings being treated as errors Virt_RASD.c: In function ?set_disk_rasd_params?: Virt_RASD.c:285: error: initialization discards qualifiers from pointer target type According to libvirt docs: const char * virStoragePoolGetName (virStoragePoolPtr pool) > + if (pool_name == NULL) { > + virt_set_status(broker,&s, > + CMPI_RC_ERR_NOT_FOUND, > + conn, > + "Failed to get Pool name for volume"); > + goto cont; > + } > + > + int ret = asprintf(&poolid, "DiskPool/%s", pool_name); > + > + if (ret == -1) { > + CU_DEBUG("Failed to get disk poolid"); > + goto cont; > + } > + > + CMSetProperty(inst, > + "PoolID", > + (CMPIValue *)poolid, > + CMPI_chars); > + cont: > CMSetProperty(inst, > "BusType", > (CMPIValue *)dev->dev.disk.bus_type, > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From snmishra at us.ibm.com Wed Jul 20 14:06:05 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Wed, 20 Jul 2011 07:06:05 -0700 Subject: [Libvirt-cim] [PATCH] Set PoolID for CIM_DiskResourceAllocationSettingData In-Reply-To: <4E26DCC2.3010702@linux.vnet.ibm.com> References: <4E26DCC2.3010702@linux.vnet.ibm.com> Message-ID: libvirt-cim-bounces at redhat.com wrote on 07/20/2011 06:48:50 AM: > Chip Vincent > Sent by: libvirt-cim-bounces at redhat.com > > 07/20/11 06:48 AM > > Please respond to > cvincent at linux.vnet.ibm.com; Please respond to > List for discussion and development of libvirt CIM > > To > > libvirt-cim at redhat.com > > cc > > Subject > > Re: [Libvirt-cim] [PATCH] Set PoolID for CIM_DiskResourceAllocationSettingData > > On 07/18/2011 02:12 PM, Sharad Mishra wrote: > > # HG changeset patch > > # User Sharad Mishra > > # Date 1311012637 25200 > > # Node ID d1f131ad4cf75263d8178ebb89ad9dada3997280 > > # Parent e8c1cdd5c9cbe887286ef169d8ff525cc9035485 > > Set PoolID for CIM_DiskResourceAllocationSettingData. > > > > PoolID wasn't getting set for DiskResourceAllocationSettingData. PoolID > > for DiskResourceAllocationSettingData is set by appending "DiskPool" > > to the Storage Pool name. > > > > Signed-off-by: Sharad Mishra > > > > diff -r e8c1cdd5c9cb -r d1f131ad4cf7 src/Virt_RASD.c > > --- a/src/Virt_RASD.c Sun Jul 17 12:37:31 2011 -0700 > > +++ b/src/Virt_RASD.c Mon Jul 18 11:10:37 2011 -0700 > > @@ -234,6 +234,7 @@ > > uint64_t cap = 0; > > uint16_t type; > > CMPIStatus s = {CMPI_RC_OK, NULL}; > > + char *poolid = NULL; > > > > get_vol_size(broker, ref, dev->dev.disk.source,&cap); > > > > @@ -253,6 +254,55 @@ > > (CMPIValue *)dev->dev.disk.source, > > CMPI_chars); > > > > + virConnectPtr conn = connect_by_classname(broker, > CLASSNAME(ref),&s); > > + if (conn == NULL) { > > + virt_set_status(broker,&s, > > + CMPI_RC_ERR_NOT_FOUND, > > + conn, > > + "Could not get connection to hypervisor"); > > + goto cont; > > + } > > + > > + virStorageVolPtr vol = virStorageVolLookupByPath(conn, > > + > dev->dev.disk.source); > > + if (vol == NULL) { > > + virt_set_status(broker,&s, > > + CMPI_RC_ERR_NOT_FOUND, > > + conn, > > + "Failed to get StorageVolPtr"); > > + goto cont; > > + } > > + > > + virStoragePoolPtr pool = virStoragePoolLookupByVolume(vol); > > + if (pool == NULL) { > > + virt_set_status(broker,&s, > > + CMPI_RC_ERR_NOT_FOUND, > > + conn, > > + "Failed to get StoragePoolPtr"); > > + goto cont; > > + } > > + > > + char *pool_name = virStoragePoolGetName(pool); > > cc1: warnings being treated as errors > Virt_RASD.c: In function ?set_disk_rasd_params?: > Virt_RASD.c:285: error: initialization discards qualifiers from pointer > target type > > According to libvirt docs: > const char * virStoragePoolGetName (virStoragePoolPtr pool) that's right. donno why it did not complain for me. I compile with warning enabled too. Will do another patch and resend. -Sharad > > > > > + if (pool_name == NULL) { > > + virt_set_status(broker,&s, > > + CMPI_RC_ERR_NOT_FOUND, > > + conn, > > + "Failed to get Pool name for volume"); > > + goto cont; > > + } > > + > > + int ret = asprintf(&poolid, "DiskPool/%s", pool_name); > > + > > + if (ret == -1) { > > + CU_DEBUG("Failed to get disk poolid"); > > + goto cont; > > + } > > + > > + CMSetProperty(inst, > > + "PoolID", > > + (CMPIValue *)poolid, > > + CMPI_chars); > > + cont: > > CMSetProperty(inst, > > "BusType", > > (CMPIValue *)dev->dev.disk.bus_type, > > > > _______________________________________________ > > Libvirt-cim mailing list > > Libvirt-cim at redhat.com > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > -- > Chip Vincent > Open Virtualization > IBM Linux Technology Center > cvincent at linux.vnet.ibm.com > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From cvincent at linux.vnet.ibm.com Wed Jul 20 14:06:24 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 20 Jul 2011 10:06:24 -0400 Subject: [Libvirt-cim] [PATCH] Add source host and directory for netfs diskpool In-Reply-To: References: Message-ID: <4E26E0E0.5060203@linux.vnet.ibm.com> Looks correct, builds source and rpm. I did not explicitly test the function since I don't have netfs access. +1 and pushed. On 07/15/2011 06:00 PM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1310766822 25200 > # Node ID f064a20fba355fa2fbaa2bc914fa2189712223f6 > # Parent 0563cf6502d4cd10418001d88c0c60b269370b3e > Add source host and directory for netfs diskpool. > > Added new properties to populate the source host and > directory being used for netfs diskpool. > > Signed-off-by: Sharad Mishra > > diff -r 0563cf6502d4 -r f064a20fba35 schema/DiskPool.mof > --- a/schema/DiskPool.mof Fri Jul 15 09:03:55 2011 -0700 > +++ b/schema/DiskPool.mof Fri Jul 15 14:53:42 2011 -0700 > @@ -5,6 +5,9 @@ > { > [Description("Path this storage pool represents")] > string Path; > + uint16 Autostart; > + string Host; > + string SourceDirectory; > > }; > > @@ -13,6 +16,9 @@ > { > [Description("Path this storage pool represents")] > string Path; > + uint16 Autostart; > + string Host; > + string SourceDirectory; > > }; > > @@ -21,6 +27,9 @@ > { > [Description("Path this storage pool represents")] > string Path; > + uint16 Autostart; > + string Host; > + string SourceDirectory; > > }; > > diff -r 0563cf6502d4 -r f064a20fba35 src/Virt_DevicePool.c > --- a/src/Virt_DevicePool.c Fri Jul 15 09:03:55 2011 -0700 > +++ b/src/Virt_DevicePool.c Fri Jul 15 14:53:42 2011 -0700 > @@ -213,6 +213,19 @@ > CMSetProperty(inst, "Path", > (CMPIValue *)pool_str, CMPI_chars); > } > + if (pool_vals->pool_info.disk.host != NULL) { > + pool_str = strdup(pool_vals->pool_info.disk.host); > + > + CMSetProperty(inst, "Host", > + (CMPIValue *)pool_str, CMPI_chars); > + } > + if (pool_vals->pool_info.disk.src_dir != NULL) { > + pool_str = strdup(pool_vals->pool_info.disk.src_dir); > + > + CMSetProperty(inst, "SourceDirectory", > + (CMPIValue *)pool_str, CMPI_chars); > + } > + > type = pool_vals->pool_info.disk.pool_type; > CMSetProperty(inst, "OtherResourceType", > (CMPIValue *)get_disk_pool_type(type), > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Wed Jul 20 14:20:37 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 20 Jul 2011 10:20:37 -0400 Subject: [Libvirt-cim] [PATCH] libxkutil: More meaningful log message In-Reply-To: <43f9834c98a030ada1d6.1311104786@etrunko-t410.br.ibm.com> References: <43f9834c98a030ada1d6.1311104786@etrunko-t410.br.ibm.com> Message-ID: <4E26E435.6000502@linux.vnet.ibm.com> +1 and pushed. Thanks for fixing that. I saw lots more 'Errors' that are not actual errors after we added the read-only support. On 07/19/2011 03:46 PM, Eduardo Lima (Etrunko) wrote: > # HG changeset patch > # User Eduardo Lima (Etrunko) > # Date 1311104779 10800 > # Node ID 43f9834c98a030ada1d69693d119cdc6367cf284 > # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 > libxkutil: More meaningful log message > > Signed-off-by: Eduardo Lima (Etrunko) > > diff --git a/libxkutil/misc_util.c b/libxkutil/misc_util.c > --- a/libxkutil/misc_util.c > +++ b/libxkutil/misc_util.c > @@ -73,14 +73,14 @@ > > ret = config_read_file(&conf, LIBVIRTCIM_CONF); > if (ret == CONFIG_FALSE) { > - CU_DEBUG("Error reading config file at liine %d: '%s'\n", > + CU_DEBUG("Error reading config file at line %d: '%s'\n", > conf.error_line, conf.error_text); > goto out; > } > > ret = config_lookup_bool(&conf, readonly_str,&readonly); > if (ret == CONFIG_FALSE) { > - CU_DEBUG("Error: '%s' not found in config file\n", > + CU_DEBUG("'%s' not found in config file, assuming false\n", > readonly_str); > goto out; > } > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From snmishra at us.ibm.com Wed Jul 20 13:44:14 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Wed, 20 Jul 2011 06:44:14 -0700 Subject: [Libvirt-cim] [PATCH] (#2)Set PoolID for CIM_DiskResourceAllocationSettingData Message-ID: <7cb42b369d3776c9d727.1311169454@elm3a148.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1311169386 25200 # Node ID 7cb42b369d3776c9d727402ba0198eea573d0d40 # Parent 6056961c3c5347d3b8375039767d7bc78fa97eb5 (#2)Set PoolID for CIM_DiskResourceAllocationSettingData. PoolID wasn't getting set for DiskResourceAllocationSettingData. PoolID for DiskResourceAllocationSettingData is set by appending "DiskPool" to the Storage Pool name. #2: Added "const" to const char* virStoragePoolGetName at line 286. Signed-off-by: Sharad Mishra diff -r 6056961c3c53 -r 7cb42b369d37 src/Virt_RASD.c --- a/src/Virt_RASD.c Tue Jul 19 16:46:19 2011 -0300 +++ b/src/Virt_RASD.c Wed Jul 20 06:43:06 2011 -0700 @@ -234,6 +234,7 @@ uint64_t cap = 0; uint16_t type; CMPIStatus s = {CMPI_RC_OK, NULL}; + char *poolid = NULL; get_vol_size(broker, ref, dev->dev.disk.source, &cap); @@ -253,6 +254,55 @@ (CMPIValue *)dev->dev.disk.source, CMPI_chars); + virConnectPtr conn = connect_by_classname(broker, CLASSNAME(ref), &s); + if (conn == NULL) { + virt_set_status(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + conn, + "Could not get connection to hypervisor"); + goto cont; + } + + virStorageVolPtr vol = virStorageVolLookupByPath(conn, + dev->dev.disk.source); + if (vol == NULL) { + virt_set_status(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + conn, + "Failed to get StorageVolPtr"); + goto cont; + } + + virStoragePoolPtr pool = virStoragePoolLookupByVolume(vol); + if (pool == NULL) { + virt_set_status(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + conn, + "Failed to get StoragePoolPtr"); + goto cont; + } + + const char *pool_name = virStoragePoolGetName(pool); + if (pool_name == NULL) { + virt_set_status(broker, &s, + CMPI_RC_ERR_NOT_FOUND, + conn, + "Failed to get Pool name for volume"); + goto cont; + } + + int ret = asprintf(&poolid, "DiskPool/%s", pool_name); + + if (ret == -1) { + CU_DEBUG("Failed to get disk poolid"); + goto cont; + } + + CMSetProperty(inst, + "PoolID", + (CMPIValue *)poolid, + CMPI_chars); + cont: CMSetProperty(inst, "BusType", (CMPIValue *)dev->dev.disk.bus_type, From eblima at linux.vnet.ibm.com Wed Jul 20 20:20:58 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Wed, 20 Jul 2011 17:20:58 -0300 Subject: [Libvirt-cim] [PATCH] Remove has_vnc_passwd key from infostore Message-ID: <9746544f39f508bb08b0.1311193258@etrunko-t410.br.ibm.com> # HG changeset patch # User Eduardo Lima (Etrunko) # Date 1311192727 10800 # Node ID 9746544f39f508bb08b0c7ea71153dbbceda8dd9 # Parent 6056961c3c5347d3b8375039767d7bc78fa97eb5 Remove has_vnc_passwd key from infostore The logic is not necessary anymore since we return the vnc password in every call to retrieve a domain XML. Also fix some other places where this field was not handled properly. Signed-off-by: Eduardo Lima (Etrunko) diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c +++ b/libxkutil/device_parsing.c @@ -809,6 +809,7 @@ DUP_FIELD(dev, _dev, dev.graphics.port); DUP_FIELD(dev, _dev, dev.graphics.host); DUP_FIELD(dev, _dev, dev.graphics.keymap); + DUP_FIELD(dev, _dev, dev.graphics.passwd); } else if (dev->type == CIM_RES_TYPE_INPUT) { DUP_FIELD(dev, _dev, dev.input.type); DUP_FIELD(dev, _dev, dev.input.bus); @@ -889,7 +890,7 @@ char *xml; int ret; - xml = virDomainGetXMLDesc(dom, 0); + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); if (xml == NULL) return 0; diff --git a/src/Virt_ComputerSystem.c b/src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c +++ b/src/Virt_ComputerSystem.c @@ -920,7 +920,7 @@ return s; } - xml = virDomainGetXMLDesc(dom, 0); + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); if (xml == NULL) { CU_DEBUG("Unable to retrieve domain XML"); virt_set_status(_BROKER, &s, diff --git a/src/Virt_ComputerSystemIndication.c b/src/Virt_ComputerSystemIndication.c --- a/src/Virt_ComputerSystemIndication.c +++ b/src/Virt_ComputerSystemIndication.c @@ -151,7 +151,7 @@ } (*dom_xml_list)[i].xml = virDomainGetXMLDesc(dom_ptr_list[i], - 0); + VIR_DOMAIN_XML_SECURE); if ((*dom_xml_list)[i].xml == NULL) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c --- a/src/Virt_RASD.c +++ b/src/Virt_RASD.c @@ -420,8 +420,6 @@ CMPIStatus s = {CMPI_RC_OK, NULL}; virConnectPtr conn = NULL; virDomainPtr dom = NULL; - struct infostore_ctx *infostore = NULL; - bool has_passwd = false; CMSetProperty(inst, "ResourceSubType", (CMPIValue *)dev->dev.graphics.type, CMPI_chars); @@ -460,19 +458,12 @@ goto out; } - infostore = infostore_open(dom); - if (infostore != NULL) - has_passwd = infostore_get_bool(infostore, - "has_vnc_passwd"); - - if (has_passwd) { + if (dev->dev.graphics.passwd && strlen(dev->dev.graphics.passwd)) { CU_DEBUG("has password"); CMSetProperty(inst, "Password", (CMPIValue *)"********", CMPI_chars); } - infostore_close(infostore); - /* FIXME: Populate the IsIPv6Only */ } diff --git a/src/Virt_VSMigrationService.c b/src/Virt_VSMigrationService.c --- a/src/Virt_VSMigrationService.c +++ b/src/Virt_VSMigrationService.c @@ -1060,7 +1060,7 @@ { CMPIStatus s = {CMPI_RC_OK, NULL}; - *xml = virDomainGetXMLDesc(dom, 0); + *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); if (*xml == NULL) { virt_set_status(_BROKER, &s, diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c +++ b/src/Virt_VirtualSystemManagementService.c @@ -373,6 +373,7 @@ domain->dev_graphics->dev.graphics.port = strdup("-1"); domain->dev_graphics->dev.graphics.host = strdup("127.0.0.1"); domain->dev_graphics->dev.graphics.keymap = strdup("en-us"); + domain->dev_graphics->dev.graphics.passwd = NULL; domain->dev_graphics_ct = 1; return true; @@ -1543,14 +1544,6 @@ infostore_set_u64(ctx, "weight", dev->dev.vcpu.weight); infostore_set_u64(ctx, "limit", dev->dev.vcpu.limit); - dev = dominfo->dev_graphics; - if(dev != NULL){ - if (dev->dev.graphics.passwd != NULL) - infostore_set_bool(ctx, "has_vnc_passwd", true); - else - infostore_set_bool(ctx, "has_vnc_passwd", false); - } - out: infostore_close(ctx); From cvincent at linux.vnet.ibm.com Wed Jul 20 20:36:52 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 20 Jul 2011 16:36:52 -0400 Subject: [Libvirt-cim] [PATCH] Remove has_vnc_passwd key from infostore In-Reply-To: <9746544f39f508bb08b0.1311193258@etrunko-t410.br.ibm.com> References: <9746544f39f508bb08b0.1311193258@etrunko-t410.br.ibm.com> Message-ID: <4E273C64.6030805@linux.vnet.ibm.com> One question below... On 07/20/2011 04:20 PM, Eduardo Lima (Etrunko) wrote: > # HG changeset patch > # User Eduardo Lima (Etrunko) > # Date 1311192727 10800 > # Node ID 9746544f39f508bb08b0c7ea71153dbbceda8dd9 > # Parent 6056961c3c5347d3b8375039767d7bc78fa97eb5 > Remove has_vnc_passwd key from infostore > > The logic is not necessary anymore since we return the vnc password > in every call to retrieve a domain XML. Also fix some other places > where this field was not handled properly. > > Signed-off-by: Eduardo Lima (Etrunko) > > diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c > +++ b/libxkutil/device_parsing.c > @@ -809,6 +809,7 @@ > DUP_FIELD(dev, _dev, dev.graphics.port); > DUP_FIELD(dev, _dev, dev.graphics.host); > DUP_FIELD(dev, _dev, dev.graphics.keymap); > + DUP_FIELD(dev, _dev, dev.graphics.passwd); > } else if (dev->type == CIM_RES_TYPE_INPUT) { > DUP_FIELD(dev, _dev, dev.input.type); > DUP_FIELD(dev, _dev, dev.input.bus); > @@ -889,7 +890,7 @@ > char *xml; > int ret; > > - xml = virDomainGetXMLDesc(dom, 0); > + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); > if (xml == NULL) > return 0; > > diff --git a/src/Virt_ComputerSystem.c b/src/Virt_ComputerSystem.c > --- a/src/Virt_ComputerSystem.c > +++ b/src/Virt_ComputerSystem.c > @@ -920,7 +920,7 @@ > return s; > } > > - xml = virDomainGetXMLDesc(dom, 0); > + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); > if (xml == NULL) { > CU_DEBUG("Unable to retrieve domain XML"); > virt_set_status(_BROKER,&s, > diff --git a/src/Virt_ComputerSystemIndication.c b/src/Virt_ComputerSystemIndication.c > --- a/src/Virt_ComputerSystemIndication.c > +++ b/src/Virt_ComputerSystemIndication.c > @@ -151,7 +151,7 @@ > } > > (*dom_xml_list)[i].xml = virDomainGetXMLDesc(dom_ptr_list[i], > - 0); > + VIR_DOMAIN_XML_SECURE); > if ((*dom_xml_list)[i].xml == NULL) { > cu_statusf(_BROKER,&s, > CMPI_RC_ERR_FAILED, > diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c > --- a/src/Virt_RASD.c > +++ b/src/Virt_RASD.c > @@ -420,8 +420,6 @@ > CMPIStatus s = {CMPI_RC_OK, NULL}; > virConnectPtr conn = NULL; > virDomainPtr dom = NULL; > - struct infostore_ctx *infostore = NULL; > - bool has_passwd = false; > > CMSetProperty(inst, "ResourceSubType", > (CMPIValue *)dev->dev.graphics.type, CMPI_chars); > @@ -460,19 +458,12 @@ > goto out; > } > > - infostore = infostore_open(dom); > - if (infostore != NULL) > - has_passwd = infostore_get_bool(infostore, > - "has_vnc_passwd"); > - > - if (has_passwd) { > + if (dev->dev.graphics.passwd&& strlen(dev->dev.graphics.passwd)) { Is a NULL password different than a zero-length password? This check assumes that's possible, but one would expect '****' to be present in the instance for non-NULL, zero-length strings. Right? > CU_DEBUG("has password"); > CMSetProperty(inst, "Password", > (CMPIValue *)"********", CMPI_chars); > } > > - infostore_close(infostore); > - > /* FIXME: Populate the IsIPv6Only */ > } > > diff --git a/src/Virt_VSMigrationService.c b/src/Virt_VSMigrationService.c > --- a/src/Virt_VSMigrationService.c > +++ b/src/Virt_VSMigrationService.c > @@ -1060,7 +1060,7 @@ > { > CMPIStatus s = {CMPI_RC_OK, NULL}; > > - *xml = virDomainGetXMLDesc(dom, 0); > + *xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); > if (*xml == NULL) { > > virt_set_status(_BROKER,&s, > diff --git a/src/Virt_VirtualSystemManagementService.c b/src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c > +++ b/src/Virt_VirtualSystemManagementService.c > @@ -373,6 +373,7 @@ > domain->dev_graphics->dev.graphics.port = strdup("-1"); > domain->dev_graphics->dev.graphics.host = strdup("127.0.0.1"); > domain->dev_graphics->dev.graphics.keymap = strdup("en-us"); > + domain->dev_graphics->dev.graphics.passwd = NULL; > domain->dev_graphics_ct = 1; > > return true; > @@ -1543,14 +1544,6 @@ > infostore_set_u64(ctx, "weight", dev->dev.vcpu.weight); > infostore_set_u64(ctx, "limit", dev->dev.vcpu.limit); > > - dev = dominfo->dev_graphics; > - if(dev != NULL){ > - if (dev->dev.graphics.passwd != NULL) > - infostore_set_bool(ctx, "has_vnc_passwd", true); > - else > - infostore_set_bool(ctx, "has_vnc_passwd", false); > - } > - > out: > infostore_close(ctx); > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Wed Jul 20 21:35:56 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 20 Jul 2011 17:35:56 -0400 Subject: [Libvirt-cim] [PATCH] Fix crash when creating ACL filter lists Message-ID: # HG changeset patch # User Chip Vincent # Date 1311193039 14400 # Node ID c4fae0f5cc8f21f0d66077df7693158c10633ece # Parent 6056961c3c5347d3b8375039767d7bc78fa97eb5 Fix crash when creating ACL filter lists Specifically, AppliedFilterList and NestedFilterList CreateInstance(). For AppliedFilterList: The Antecedent and Dependent were backwards and the provider would crash since no libvirt connection was made before calling get_filter_by_name(). Also added some additional error checking in acl_parsing.c. It appears libvirt w/ qemu does not support dynamic updating of virtual net devices in 0.8.1 so CreateInstance() will still fail (but not crash) in that version. Looking for alternatives to provide dynamic support and will post in a follow-on patch. For NestedFilterList: The code was trying to extract the 'Name' property from the instance reference, rather than the Antecedent and Dependent properties. Also fixed an issue when creating the filter XML. NOTE: I'm still seeing sparatic cores in various providers when doing 'deep' or 'broad' associators calls (not using the -ac). However, there is no indication that bug is tied to this feature. For example, I cannot get the ACL providers to crash when using 'wbemcli ai -ac'. Signed-off-by: Chip Vincent diff --git a/libxkutil/acl_parsing.c b/libxkutil/acl_parsing.c --- a/libxkutil/acl_parsing.c +++ b/libxkutil/acl_parsing.c @@ -429,6 +429,7 @@ int get_filter_from_xml(const char *xml, struct acl_filter **filter) { xmlDoc *xmldoc = NULL; + int ret = 0; if (xml == NULL || filter == NULL) return 0; @@ -440,15 +441,19 @@ goto err; *filter = malloc(sizeof(**filter)); + if (*filter == NULL) + goto err; memset(*filter, 0, sizeof(**filter)); parse_acl_filter(xmldoc->children, *filter); + ret = 1; + err: xmlSetGenericErrorFunc(NULL, NULL); xmlFreeDoc(xmldoc); - return 1; + return ret; } int get_filter_by_name( @@ -464,6 +469,8 @@ return 0; vfilter = virNWFilterLookupByName(conn, name); + if (vfilter == NULL) + return 0; xml = virNWFilterGetXMLDesc(vfilter, 0); @@ -472,9 +479,7 @@ if (xml == NULL) return 0; - get_filter_from_xml(xml, filter); - - return 1; + return get_filter_from_xml(xml, filter); #else return 0; #endif @@ -493,6 +498,8 @@ return 0; vfilter = virNWFilterLookupByUUIDString(conn, uuid); + if (vfilter == NULL) + return 0; xml = virNWFilterGetXMLDesc(vfilter, 0); @@ -581,31 +588,27 @@ int update_filter(virConnectPtr conn, struct acl_filter *filter) { - if (delete_filter(conn, filter) == 0 || - create_filter(conn, filter) == 0) - return 0; - - return 1; + return create_filter(conn, filter); } int delete_filter(virConnectPtr conn, struct acl_filter *filter) { #if LIBVIR_VERSION_NUMBER > 8000 + int ret = 0; virNWFilterPtr vfilter = NULL; if (filter == NULL) return 0; - vfilter = virNWFilterLookupByUUIDString(conn, filter->uuid); + vfilter = virNWFilterLookupByName(conn, filter->name); if (vfilter == NULL) return 0; - if (virNWFilterUndefine(vfilter) != 0) { - virNWFilterFree(vfilter); - return 0; - } + ret = virNWFilterUndefine(vfilter); - return 1; + virNWFilterFree(vfilter); + + return ret == 0 ? 1 : 0; #else return 0; #endif diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c +++ b/libxkutil/xmlgen.c @@ -1375,14 +1375,16 @@ if (xmlNewProp(root, BAD_CAST "name", BAD_CAST filter->name) == NULL) goto out; - if (filter->chain != NULL) + if (filter->chain != NULL) { if (xmlNewProp(root, BAD_CAST "chain", BAD_CAST filter->chain) == NULL) goto out; + } if (filter->uuid != NULL) { - tmp = xmlNewChild(root, NULL, BAD_CAST "uuid", NULL); - if (xmlNewProp(tmp, NULL, BAD_CAST filter->uuid) == NULL) + tmp = xmlNewChild(root, NULL, BAD_CAST "uuid", + BAD_CAST filter->uuid); + if (tmp == NULL) goto out; } @@ -1406,7 +1408,7 @@ msg = NULL; /* no errors */ out: - CU_DEBUG("Filter XML: %s", msg); + CU_DEBUG("Filter XML: %s", xml); xmlFreeNode(root); diff --git a/src/Virt_AppliedFilterList.c b/src/Virt_AppliedFilterList.c --- a/src/Virt_AppliedFilterList.c +++ b/src/Virt_AppliedFilterList.c @@ -30,6 +30,7 @@ #include "acl_parsing.h" #include "misc_util.h" #include "cs_util.h" +#include "xmlgen.h" #include "Virt_Device.h" #include "Virt_FilterList.h" @@ -111,20 +112,14 @@ VIR_DOMAIN_DEVICE_MODIFY_CONFIG; int ret = 0; - /** device_to_xml() is not exported, so this function needs - * to be moved - */ - - /* xml = device_to_xml(dev); */ - + xml = device_to_xml(dev); if (xml == NULL) { CU_DEBUG("Failed to get XML for device '%s'", dev->id); goto out; } if (virDomainUpdateDeviceFlags(dom, xml, flags) != 0) { - CU_DEBUG("Failed to dynamically update device:"); - CU_DEBUG("%s", xml); + CU_DEBUG("Failed to dynamically update device"); goto out; } @@ -430,6 +425,10 @@ virConnectPtr conn = NULL; virDomainPtr dom = NULL; + conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); + if (conn == NULL) + goto out; + CU_DEBUG("Reference = %s", REF2STR(reference)); if (cu_get_ref_prop(instance, "Antecedent", @@ -440,18 +439,13 @@ goto out; } - if (cu_get_str_path(reference, "Name", &filter_name) != CMPI_RC_OK) { + CU_DEBUG("Antecedent = %s", REF2STR(antecedent)); + + if (cu_get_str_path(antecedent, "DeviceID", + &device_name) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, - "Unable to get Antecedent.Name property"); - goto out; - } - - get_filter_by_name(conn, filter_name, &filter); - if (filter == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Antecedent.Name object does not exist"); + "Unable to get Antecedent.DeviceID property"); goto out; } @@ -463,15 +457,23 @@ goto out; } - if (cu_get_str_path(reference, "DeviceID", - &device_name) != CMPI_RC_OK) { + CU_DEBUG("Dependent = %s", REF2STR(dependent)); + + if (cu_get_str_path(dependent, "Name", + &filter_name) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, - "Unable to get Dependent.DeviceID property"); + "Unable to get Dependent.Name property"); goto out; } - CU_DEBUG("DeviceID = %s", device_name); + get_filter_by_name(conn, filter_name, &filter); + if (filter == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Antecedent.Name object does not exist"); + goto out; + } if (parse_fq_devid(device_name, &domain_name, &net_name) == 0) { CU_DEBUG("Failed to parse devid"); @@ -539,6 +541,10 @@ virConnectPtr conn = NULL; virDomainPtr dom = NULL; + conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); + if (conn == NULL) + goto out; + CU_DEBUG("Reference = %s", REF2STR(reference)); if (cu_get_ref_path(reference, "Antecedent", @@ -549,18 +555,11 @@ goto out; } - if (cu_get_str_path(reference, "Name", &filter_name) != CMPI_RC_OK) { + if (cu_get_str_path(reference, "DeviceID", + &device_name) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, - "Unable to get Antecedent.Name property"); - goto out; - } - - get_filter_by_name(conn, filter_name, &filter); - if (filter == NULL) { - cu_statusf(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "Antecedent.Name object does not exist"); + "Unable to get Antecedent.DeviceID property"); goto out; } @@ -572,15 +571,21 @@ goto out; } - if (cu_get_str_path(reference, "DeviceID", - &device_name) != CMPI_RC_OK) { + if (cu_get_str_path(reference, "Name", + &filter_name) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, - "Unable to get Dependent.DeviceID property"); + "Unable to get Dependent.Name property"); goto out; } - CU_DEBUG("DeviceID = %s", device_name); + get_filter_by_name(conn, filter_name, &filter); + if (filter == NULL) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Antecedent.Name object does not exist"); + goto out; + } if (parse_fq_devid(device_name, &domain_name, &net_name) == 0) { CU_DEBUG("Failed to parse devid"); diff --git a/src/Virt_FilterList.c b/src/Virt_FilterList.c --- a/src/Virt_FilterList.c +++ b/src/Virt_FilterList.c @@ -269,6 +269,8 @@ CMPIInstance *_instance = NULL; virConnectPtr conn = NULL; + CU_DEBUG("Reference = %s", REF2STR(reference)); + /**Get Name from instance rather than reference since keys * are set by this provider, not the client. */ @@ -335,6 +337,8 @@ struct acl_filter *filter = NULL; virConnectPtr conn = NULL; + CU_DEBUG("Reference = %s", REF2STR(reference)); + if (cu_get_str_path(reference, "Name", &name) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_NOT_FOUND, diff --git a/src/Virt_NestedFilterList.c b/src/Virt_NestedFilterList.c --- a/src/Virt_NestedFilterList.c +++ b/src/Virt_NestedFilterList.c @@ -323,13 +323,17 @@ goto out; } - if (cu_get_str_path(reference, "Name", &parent_name) != CMPI_RC_OK) { + CU_DEBUG("Antecedent = %s", REF2STR(antecedent)); + + if (cu_get_str_path(antecedent, "Name", &parent_name) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to get Antecedent.Name property"); goto out; } + CU_DEBUG("Antecedent.Name = %s", parent_name); + get_filter_by_name(conn, parent_name, &parent_filter); if (parent_filter == NULL) { cu_statusf(_BROKER, &s, @@ -346,13 +350,17 @@ goto out; } - if (cu_get_str_path(reference, "Name", &child_name) != CMPI_RC_OK) { + CU_DEBUG("Dependent = %s", REF2STR(dependent)); + + if (cu_get_str_path(dependent, "Name", &child_name) != CMPI_RC_OK) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, "Unable to get Dependent.Name property"); goto out; } + CU_DEBUG("Dependent.Name = %s", child_name); + get_filter_by_name(conn, child_name, &child_filter); if (child_filter == NULL) { cu_statusf(_BROKER, &s, @@ -368,6 +376,9 @@ goto out; } + CU_DEBUG("filter appended, parent_filter->name = %s", + parent_filter->name); + if (update_filter(conn, parent_filter) == 0) { cu_statusf(_BROKER, &s, CMPI_RC_ERR_FAILED, From cvincent at linux.vnet.ibm.com Wed Jul 20 21:48:55 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Wed, 20 Jul 2011 17:48:55 -0400 Subject: [Libvirt-cim] [PATCH] (#2)Set PoolID for CIM_DiskResourceAllocationSettingData In-Reply-To: <7cb42b369d3776c9d727.1311169454@elm3a148.beaverton.ibm.com> References: <7cb42b369d3776c9d727.1311169454@elm3a148.beaverton.ibm.com> Message-ID: <4E274D47.70006@linux.vnet.ibm.com> +1 and pushed. Thanks. On 07/20/2011 09:44 AM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1311169386 25200 > # Node ID 7cb42b369d3776c9d727402ba0198eea573d0d40 > # Parent 6056961c3c5347d3b8375039767d7bc78fa97eb5 > (#2)Set PoolID for CIM_DiskResourceAllocationSettingData. > > PoolID wasn't getting set for DiskResourceAllocationSettingData. PoolID > for DiskResourceAllocationSettingData is set by appending "DiskPool" > to the Storage Pool name. > > #2: Added "const" to const char* virStoragePoolGetName at line 286. > > Signed-off-by: Sharad Mishra > > diff -r 6056961c3c53 -r 7cb42b369d37 src/Virt_RASD.c > --- a/src/Virt_RASD.c Tue Jul 19 16:46:19 2011 -0300 > +++ b/src/Virt_RASD.c Wed Jul 20 06:43:06 2011 -0700 > @@ -234,6 +234,7 @@ > uint64_t cap = 0; > uint16_t type; > CMPIStatus s = {CMPI_RC_OK, NULL}; > + char *poolid = NULL; > > get_vol_size(broker, ref, dev->dev.disk.source,&cap); > > @@ -253,6 +254,55 @@ > (CMPIValue *)dev->dev.disk.source, > CMPI_chars); > > + virConnectPtr conn = connect_by_classname(broker, CLASSNAME(ref),&s); > + if (conn == NULL) { > + virt_set_status(broker,&s, > + CMPI_RC_ERR_NOT_FOUND, > + conn, > + "Could not get connection to hypervisor"); > + goto cont; > + } > + > + virStorageVolPtr vol = virStorageVolLookupByPath(conn, > + dev->dev.disk.source); > + if (vol == NULL) { > + virt_set_status(broker,&s, > + CMPI_RC_ERR_NOT_FOUND, > + conn, > + "Failed to get StorageVolPtr"); > + goto cont; > + } > + > + virStoragePoolPtr pool = virStoragePoolLookupByVolume(vol); > + if (pool == NULL) { > + virt_set_status(broker,&s, > + CMPI_RC_ERR_NOT_FOUND, > + conn, > + "Failed to get StoragePoolPtr"); > + goto cont; > + } > + > + const char *pool_name = virStoragePoolGetName(pool); > + if (pool_name == NULL) { > + virt_set_status(broker,&s, > + CMPI_RC_ERR_NOT_FOUND, > + conn, > + "Failed to get Pool name for volume"); > + goto cont; > + } > + > + int ret = asprintf(&poolid, "DiskPool/%s", pool_name); > + > + if (ret == -1) { > + CU_DEBUG("Failed to get disk poolid"); > + goto cont; > + } > + > + CMSetProperty(inst, > + "PoolID", > + (CMPIValue *)poolid, > + CMPI_chars); > + cont: > CMSetProperty(inst, > "BusType", > (CMPIValue *)dev->dev.disk.bus_type, > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From xiawenc at linux.vnet.ibm.com Thu Jul 21 07:32:52 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Thu, 21 Jul 2011 15:32:52 +0800 Subject: [Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData does not conform to profile Message-ID: <4E27D624.60600@linux.vnet.ibm.com> # HG changeset patch # User Wayne Xia # Date 1311231387 -28800 # Node ID 677867c3d2a16a97591bde2828808f9f39b859a7 # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 changed a bit to make it conform to CIM profile According to the discuss and profile, the reserved property means the memory actually allocated to support the VM running, and the unit should be byte*2^10. This patch added some code to retrieve VM's state, and the report the memory status according to that. https://bugzilla.linux.ibm.com/show_bug.cgi?id=72759 Signed-off-by: Wayne Xia diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300 +++ b/libxkutil/device_parsing.c Thu Jul 21 14:56:27 2011 +0800 @@ -792,6 +792,7 @@ } else if (dev->type == CIM_RES_TYPE_MEM) { dev->dev.mem.size = _dev->dev.mem.size; dev->dev.mem.maxsize = _dev->dev.mem.maxsize; + dev->dev.mem.reserved = _dev->dev.mem.reserved; } else if (dev->type == CIM_RES_TYPE_PROC) { dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity; } else if (dev->type == CIM_RES_TYPE_EMU) { @@ -885,8 +886,22 @@ if (xml == NULL) return 0; - if (type == CIM_RES_TYPE_MEM) + if (type == CIM_RES_TYPE_MEM) { ret = _get_mem_device(xml, list); + if (*list != NULL) { + virDomainInfo dom_info; + if (virDomainGetInfo(dom, &dom_info) == 0) { + (*list)->dev.mem.reserved = dom_info.memory; + if (dom_info.state == 5) { /* VM not active */ + (*list)->dev.mem.reserved = 0; + } + } + else { + CU_DEBUG("failed to get dom state for mem"); + ret = -1; + } + } + } else if (type == CIM_RES_TYPE_PROC) ret = _get_proc_device(xml, list); else diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300 +++ b/libxkutil/device_parsing.h Thu Jul 21 14:56:27 2011 +0800 @@ -71,6 +71,7 @@ struct mem_device { uint64_t size; uint64_t maxsize; + uint64_t reserved; }; struct vcpu_device { diff -r 3c90a88a5199 -r 677867c3d2a1 src/Virt_RASD.c --- a/src/Virt_RASD.c Mon Jul 18 11:13:40 2011 -0300 +++ b/src/Virt_RASD.c Thu Jul 21 14:56:27 2011 +0800 @@ -576,14 +576,14 @@ inst); } else if (dev->type == CIM_RES_TYPE_MEM) { - const char *units = "KiloBytes"; + const char *units = "byte*2^10"; CMSetProperty(inst, "AllocationUnits", (CMPIValue *)units, CMPI_chars); CMSetProperty(inst, "VirtualQuantity", (CMPIValue *)&dev->dev.mem.size, CMPI_uint64); CMSetProperty(inst, "Reservation", - (CMPIValue *)&dev->dev.mem.size, CMPI_uint64); + (CMPIValue *)&dev->dev.mem.reserved, CMPI_uint64); CMSetProperty(inst, "Limit", (CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64); } else if (dev->type == CIM_RES_TYPE_PROC) { From eblima at linux.vnet.ibm.com Thu Jul 21 13:28:07 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Thu, 21 Jul 2011 10:28:07 -0300 Subject: [Libvirt-cim] [PATCH] Remove has_vnc_passwd key from infostore In-Reply-To: <4E273C64.6030805@linux.vnet.ibm.com> References: <9746544f39f508bb08b0.1311193258@etrunko-t410.br.ibm.com> <4E273C64.6030805@linux.vnet.ibm.com> Message-ID: <4E282967.3050302@linux.vnet.ibm.com> On 07/20/2011 05:36 PM, Chip Vincent wrote: > One question below... > > On 07/20/2011 04:20 PM, Eduardo Lima (Etrunko) wrote: >> # HG changeset patch >> # User Eduardo Lima (Etrunko) >> # Date 1311192727 10800 >> # Node ID 9746544f39f508bb08b0c7ea71153dbbceda8dd9 >> # Parent 6056961c3c5347d3b8375039767d7bc78fa97eb5 >> Remove has_vnc_passwd key from infostore >> >> The logic is not necessary anymore since we return the vnc password >> in every call to retrieve a domain XML. Also fix some other places >> where this field was not handled properly. >> >> Signed-off-by: Eduardo Lima (Etrunko) >> >> diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c >> --- a/libxkutil/device_parsing.c >> +++ b/libxkutil/device_parsing.c >> @@ -809,6 +809,7 @@ >> DUP_FIELD(dev, _dev, dev.graphics.port); >> DUP_FIELD(dev, _dev, dev.graphics.host); >> DUP_FIELD(dev, _dev, dev.graphics.keymap); >> + DUP_FIELD(dev, _dev, dev.graphics.passwd); >> } else if (dev->type == CIM_RES_TYPE_INPUT) { >> DUP_FIELD(dev, _dev, dev.input.type); >> DUP_FIELD(dev, _dev, dev.input.bus); >> @@ -889,7 +890,7 @@ >> char *xml; >> int ret; >> >> - xml = virDomainGetXMLDesc(dom, 0); >> + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); >> if (xml == NULL) >> return 0; >> >> diff --git a/src/Virt_ComputerSystem.c b/src/Virt_ComputerSystem.c >> --- a/src/Virt_ComputerSystem.c >> +++ b/src/Virt_ComputerSystem.c >> @@ -920,7 +920,7 @@ >> return s; >> } >> >> - xml = virDomainGetXMLDesc(dom, 0); >> + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); >> if (xml == NULL) { >> CU_DEBUG("Unable to retrieve domain XML"); >> virt_set_status(_BROKER,&s, >> diff --git a/src/Virt_ComputerSystemIndication.c >> b/src/Virt_ComputerSystemIndication.c >> --- a/src/Virt_ComputerSystemIndication.c >> +++ b/src/Virt_ComputerSystemIndication.c >> @@ -151,7 +151,7 @@ >> } >> >> (*dom_xml_list)[i].xml = virDomainGetXMLDesc(dom_ptr_list[i], >> - 0); >> + VIR_DOMAIN_XML_SECURE); >> if ((*dom_xml_list)[i].xml == NULL) { >> cu_statusf(_BROKER,&s, >> CMPI_RC_ERR_FAILED, >> diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c >> --- a/src/Virt_RASD.c >> +++ b/src/Virt_RASD.c >> @@ -420,8 +420,6 @@ >> CMPIStatus s = {CMPI_RC_OK, NULL}; >> virConnectPtr conn = NULL; >> virDomainPtr dom = NULL; >> - struct infostore_ctx *infostore = NULL; >> - bool has_passwd = false; >> >> CMSetProperty(inst, "ResourceSubType", >> (CMPIValue *)dev->dev.graphics.type, CMPI_chars); >> @@ -460,19 +458,12 @@ >> goto out; >> } >> >> - infostore = infostore_open(dom); >> - if (infostore != NULL) >> - has_passwd = infostore_get_bool(infostore, >> - "has_vnc_passwd"); >> - >> - if (has_passwd) { >> + if (dev->dev.graphics.passwd&& strlen(dev->dev.graphics.passwd)) { > > Is a NULL password different than a zero-length password? This check > assumes that's possible, but one would expect '****' to be present in > the instance for non-NULL, zero-length strings. Right? > In practical terms, they are not different at all. If you edit the XML for a domain adding an empty password attribute for vnc you will get the exact same behavior as when that attribute is not there. You will only get prompted for a password when it's lenght is > 0. And that was the reason for this extra check. Best regards, -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From cvincent at linux.vnet.ibm.com Thu Jul 21 14:29:10 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 21 Jul 2011 10:29:10 -0400 Subject: [Libvirt-cim] [PATCH] Remove has_vnc_passwd key from infostore In-Reply-To: <4E282967.3050302@linux.vnet.ibm.com> References: <9746544f39f508bb08b0.1311193258@etrunko-t410.br.ibm.com> <4E273C64.6030805@linux.vnet.ibm.com> <4E282967.3050302@linux.vnet.ibm.com> Message-ID: <4E2837B6.5000607@linux.vnet.ibm.com> Thanks. -------------------------------------------------------------------- VirtualSystemManagementService - 20_verify_vnc_password.py: PASS -------------------------------------------------------------------- +1 and pushed. On 07/21/2011 09:28 AM, Eduardo Lima (Etrunko) wrote: > On 07/20/2011 05:36 PM, Chip Vincent wrote: >> One question below... >> >> On 07/20/2011 04:20 PM, Eduardo Lima (Etrunko) wrote: >>> # HG changeset patch >>> # User Eduardo Lima (Etrunko) >>> # Date 1311192727 10800 >>> # Node ID 9746544f39f508bb08b0c7ea71153dbbceda8dd9 >>> # Parent 6056961c3c5347d3b8375039767d7bc78fa97eb5 >>> Remove has_vnc_passwd key from infostore >>> >>> The logic is not necessary anymore since we return the vnc password >>> in every call to retrieve a domain XML. Also fix some other places >>> where this field was not handled properly. >>> >>> Signed-off-by: Eduardo Lima (Etrunko) >>> >>> diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c >>> --- a/libxkutil/device_parsing.c >>> +++ b/libxkutil/device_parsing.c >>> @@ -809,6 +809,7 @@ >>> DUP_FIELD(dev, _dev, dev.graphics.port); >>> DUP_FIELD(dev, _dev, dev.graphics.host); >>> DUP_FIELD(dev, _dev, dev.graphics.keymap); >>> + DUP_FIELD(dev, _dev, dev.graphics.passwd); >>> } else if (dev->type == CIM_RES_TYPE_INPUT) { >>> DUP_FIELD(dev, _dev, dev.input.type); >>> DUP_FIELD(dev, _dev, dev.input.bus); >>> @@ -889,7 +890,7 @@ >>> char *xml; >>> int ret; >>> >>> - xml = virDomainGetXMLDesc(dom, 0); >>> + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); >>> if (xml == NULL) >>> return 0; >>> >>> diff --git a/src/Virt_ComputerSystem.c b/src/Virt_ComputerSystem.c >>> --- a/src/Virt_ComputerSystem.c >>> +++ b/src/Virt_ComputerSystem.c >>> @@ -920,7 +920,7 @@ >>> return s; >>> } >>> >>> - xml = virDomainGetXMLDesc(dom, 0); >>> + xml = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_SECURE); >>> if (xml == NULL) { >>> CU_DEBUG("Unable to retrieve domain XML"); >>> virt_set_status(_BROKER,&s, >>> diff --git a/src/Virt_ComputerSystemIndication.c >>> b/src/Virt_ComputerSystemIndication.c >>> --- a/src/Virt_ComputerSystemIndication.c >>> +++ b/src/Virt_ComputerSystemIndication.c >>> @@ -151,7 +151,7 @@ >>> } >>> >>> (*dom_xml_list)[i].xml = virDomainGetXMLDesc(dom_ptr_list[i], >>> - 0); >>> + VIR_DOMAIN_XML_SECURE); >>> if ((*dom_xml_list)[i].xml == NULL) { >>> cu_statusf(_BROKER,&s, >>> CMPI_RC_ERR_FAILED, >>> diff --git a/src/Virt_RASD.c b/src/Virt_RASD.c >>> --- a/src/Virt_RASD.c >>> +++ b/src/Virt_RASD.c >>> @@ -420,8 +420,6 @@ >>> CMPIStatus s = {CMPI_RC_OK, NULL}; >>> virConnectPtr conn = NULL; >>> virDomainPtr dom = NULL; >>> - struct infostore_ctx *infostore = NULL; >>> - bool has_passwd = false; >>> >>> CMSetProperty(inst, "ResourceSubType", >>> (CMPIValue *)dev->dev.graphics.type, CMPI_chars); >>> @@ -460,19 +458,12 @@ >>> goto out; >>> } >>> >>> - infostore = infostore_open(dom); >>> - if (infostore != NULL) >>> - has_passwd = infostore_get_bool(infostore, >>> - "has_vnc_passwd"); >>> - >>> - if (has_passwd) { >>> + if (dev->dev.graphics.passwd&& strlen(dev->dev.graphics.passwd)) { >> >> Is a NULL password different than a zero-length password? This check >> assumes that's possible, but one would expect '****' to be present in >> the instance for non-NULL, zero-length strings. Right? >> > > In practical terms, they are not different at all. If you edit the XML > for a domain adding an empty password attribute for vnc you will get the > exact same behavior as when that attribute is not there. > > You will only get prompted for a password when it's lenght is > 0. And > that was the reason for this extra check. > > Best regards, > -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From bestor at us.ibm.com Thu Jul 21 15:52:53 2011 From: bestor at us.ibm.com (Gareth S Bestor) Date: Thu, 21 Jul 2011 08:52:53 -0700 Subject: [Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData does not conform to profile In-Reply-To: <4E27D624.60600@linux.vnet.ibm.com> Message-ID: } else if (dev->type == CIM_RES_TYPE_MEM) { - const char *units = "KiloBytes"; + const char *units = "byte*2^10"; If we're doing this sorta change here then we should probably do it everywhere, since users may be checking AllocationUnits between CIM classes. Specifically, these should match the units being returned from memory pool capabilities, and we need to check these new units will be correctly parsed when passed as embedded instances (eg DefineSystem(), ModifyResourceSettings(), etc)... Alternatively, we might want to consider going thru the entire libvirt-cim suite and upgrading all classes from DSP0004v2.4 to DSP0004 2.5+ conformance level (ie using Augmented BNF everywhere its relevant) rather than having in old and new units sprinkled around. Basically, doing this change here and now may have much wider implications. - Gareth Dr. Gareth S. Bestor IBM Senior Software Engineer Systems & Technology Group - Systems Management Standards 971-285-6375 (mobile) bestor at us.ibm.com [Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData does not conform to profile Wayne Xia to: List for discussion and development of libvirt CIM 07/21/11 12:34 AM Sent by: libvirt-cim-bounces at redhat.com Please respond to List for discussion and development of libvirt CIM # HG changeset patch # User Wayne Xia # Date 1311231387 -28800 # Node ID 677867c3d2a16a97591bde2828808f9f39b859a7 # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 changed a bit to make it conform to CIM profile According to the discuss and profile, the reserved property means the memory actually allocated to support the VM running, and the unit should be byte*2^10. This patch added some code to retrieve VM's state, and the report the memory status according to that. https://bugzilla.linux.ibm.com/show_bug.cgi?id=72759 Signed-off-by: Wayne Xia diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300 +++ b/libxkutil/device_parsing.c Thu Jul 21 14:56:27 2011 +0800 @@ -792,6 +792,7 @@ } else if (dev->type == CIM_RES_TYPE_MEM) { dev->dev.mem.size = _dev->dev.mem.size; dev->dev.mem.maxsize = _dev->dev.mem.maxsize; + dev->dev.mem.reserved = _dev->dev.mem.reserved; } else if (dev->type == CIM_RES_TYPE_PROC) { dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity; } else if (dev->type == CIM_RES_TYPE_EMU) { @@ -885,8 +886,22 @@ if (xml == NULL) return 0; - if (type == CIM_RES_TYPE_MEM) + if (type == CIM_RES_TYPE_MEM) { ret = _get_mem_device(xml, list); + if (*list != NULL) { + virDomainInfo dom_info; + if (virDomainGetInfo(dom, &dom_info) == 0) { + (*list)->dev.mem.reserved = dom_info.memory; + if (dom_info.state == 5) { /* VM not active */ + (*list)->dev.mem.reserved = 0; + } + } + else { + CU_DEBUG("failed to get dom state for mem"); + ret = -1; + } + } + } else if (type == CIM_RES_TYPE_PROC) ret = _get_proc_device(xml, list); else diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300 +++ b/libxkutil/device_parsing.h Thu Jul 21 14:56:27 2011 +0800 @@ -71,6 +71,7 @@ struct mem_device { uint64_t size; uint64_t maxsize; + uint64_t reserved; }; struct vcpu_device { diff -r 3c90a88a5199 -r 677867c3d2a1 src/Virt_RASD.c --- a/src/Virt_RASD.c Mon Jul 18 11:13:40 2011 -0300 +++ b/src/Virt_RASD.c Thu Jul 21 14:56:27 2011 +0800 @@ -576,14 +576,14 @@ inst); } else if (dev->type == CIM_RES_TYPE_MEM) { - const char *units = "KiloBytes"; + const char *units = "byte*2^10"; CMSetProperty(inst, "AllocationUnits", (CMPIValue *)units, CMPI_chars); CMSetProperty(inst, "VirtualQuantity", (CMPIValue *)&dev->dev.mem.size, CMPI_uint64); CMSetProperty(inst, "Reservation", - (CMPIValue *)&dev->dev.mem.size, CMPI_uint64); + (CMPIValue *)&dev->dev.mem.reserved, CMPI_uint64); CMSetProperty(inst, "Limit", (CMPIValue *)&dev->dev.mem.maxsize, CMPI_uint64); } else if (dev->type == CIM_RES_TYPE_PROC) { _______________________________________________ Libvirt-cim mailing list Libvirt-cim at redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From eblima at linux.vnet.ibm.com Thu Jul 21 17:35:43 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Thu, 21 Jul 2011 14:35:43 -0300 Subject: [Libvirt-cim] [PATCH] Fix crash when creating ACL filter lists In-Reply-To: References: Message-ID: <4E28636F.40207@linux.vnet.ibm.com> On 07/20/2011 06:35 PM, Chip Vincent wrote: > # HG changeset patch > # User Chip Vincent > # Date 1311193039 14400 > # Node ID c4fae0f5cc8f21f0d66077df7693158c10633ece > # Parent 6056961c3c5347d3b8375039767d7bc78fa97eb5 > Fix crash when creating ACL filter lists > > Specifically, AppliedFilterList and NestedFilterList CreateInstance(). > > For AppliedFilterList: > The Antecedent and Dependent were backwards and the provider would crash > since no libvirt connection was made before calling get_filter_by_name(). > Also added some additional error checking in acl_parsing.c. It appears > libvirt w/ qemu does not support dynamic updating of virtual net devices > in 0.8.1 so CreateInstance() will still fail (but not crash) in that > version. Looking for alternatives to provide dynamic support and will post > in a follow-on patch. > > For NestedFilterList: > The code was trying to extract the 'Name' property from the instance reference, > rather than the Antecedent and Dependent properties. Also fixed an issue > when creating the filter XML. > Looks good. With this patch I was able to successfully create a new filter with a filterref entry referring to another pre-existent filter. I was not able to create the AppliedFilterList instance though, i.e, associate a filter to a network interface of a given domain. Is there any restriction about that? If so, the patch is good to go and a proper fix where necessary can be provided by another patch. Best regards, -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From cvincent at linux.vnet.ibm.com Thu Jul 21 17:45:52 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 21 Jul 2011 13:45:52 -0400 Subject: [Libvirt-cim] [PATCH] Fix crash when creating ACL filter lists In-Reply-To: <4E28636F.40207@linux.vnet.ibm.com> References: <4E28636F.40207@linux.vnet.ibm.com> Message-ID: <4E2865D0.70301@linux.vnet.ibm.com> On 07/21/2011 01:35 PM, Eduardo Lima (Etrunko) wrote: > > Looks good. With this patch I was able to successfully create a new > filter with a filterref entry referring to another pre-existent filter. > I was not able to create the AppliedFilterList instance though, i.e, > associate a filter to a network interface of a given domain. Is there > any restriction about that? If so, the patch is good to go and a proper > fix where necessary can be provided by another patch. > Yep. I mentioned this in the comment: "It appears libvirt w/ qemu does not support dynamic updating of virtual net devices in 0.8.1 so CreateInstance() will still fail (but not crash) in that version. Looking for alternatives to provide dynamic support and will post in a follow-on patch. " You should be seeing an error message like "failed to dynamically update device". I'm working on a separate patch for that now along with write support for filter rules. > Best regards, > -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From eblima at linux.vnet.ibm.com Thu Jul 21 17:58:27 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Thu, 21 Jul 2011 14:58:27 -0300 Subject: [Libvirt-cim] [PATCH] Fix crash when creating ACL filter lists In-Reply-To: <4E2865D0.70301@linux.vnet.ibm.com> References: <4E28636F.40207@linux.vnet.ibm.com> <4E2865D0.70301@linux.vnet.ibm.com> Message-ID: <4E2868C3.2090709@linux.vnet.ibm.com> On 07/21/2011 02:45 PM, Chip Vincent wrote: > > > On 07/21/2011 01:35 PM, Eduardo Lima (Etrunko) wrote: > >> >> Looks good. With this patch I was able to successfully create a new >> filter with a filterref entry referring to another pre-existent filter. >> I was not able to create the AppliedFilterList instance though, i.e, >> associate a filter to a network interface of a given domain. Is there >> any restriction about that? If so, the patch is good to go and a proper >> fix where necessary can be provided by another patch. >> > > Yep. I mentioned this in the comment: > > "It appears libvirt w/ qemu does not support dynamic updating of virtual > net devices in 0.8.1 so CreateInstance() will still fail (but not crash) > in that version. Looking for alternatives to provide dynamic support and > will post in a follow-on patch. " > > You should be seeing an error message like "failed to dynamically update > device". I'm working on a separate patch for that now along with write > support for filter rules. > Uh, my bad, sorry. Go for it, then. :) >> Best regards, >> > -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From eblima at linux.vnet.ibm.com Thu Jul 21 18:08:59 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Thu, 21 Jul 2011 15:08:59 -0300 Subject: [Libvirt-cim] [PATCH v2 1/2] Add SDL graphic device support In-Reply-To: <4E26C742.30904@linux.vnet.ibm.com> References: <4E26C742.30904@linux.vnet.ibm.com> Message-ID: <4E286B3B.9090304@linux.vnet.ibm.com> On 07/20/2011 09:17 AM, Wayne Xia wrote: > # HG changeset patch > # User Wayne Xia > # Date 1311156234 -28800 > # Node ID 0c52e4f6c421cc2e168197a82a9333d4ce369655 > # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 > made the graphic structure as union > > These change were made to allow SDL device properties added more > clearly, the graphic_device structure now contains a union > Tried to apply your patch, without success. Are you sure you are in sync with latest tip? Especially now that Chip pushed some changes I submitted which would very likely conflict with this patch. Anyway, There is only a small indentation issue below... > Signed-off-by: Wayne Xia (Wayne) > > diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300 > +++ b/libxkutil/device_parsing.c Wed Jul 20 18:03:54 2011 +0800 > @@ -91,10 +91,10 @@ > static void cleanup_graphics_device(struct graphics_device *dev) > { > free(dev->type); > - free(dev->port); > - free(dev->host); > - free(dev->keymap); > - free(dev->passwd); > + free(dev->dev.vnc.port); > + free(dev->dev.vnc.host); > + free(dev->dev.vnc.keymap); > + free(dev->dev.vnc.passwd); > } > > static void cleanup_input_device(struct input_device *dev) > @@ -522,12 +522,12 @@ > CU_DEBUG("graphics device type = %s", gdev->type); > > if (STREQC(gdev->type, "vnc")) { > - gdev->port = get_attr_value(node, "port"); > - gdev->host = get_attr_value(node, "listen"); > - gdev->keymap = get_attr_value(node, "keymap"); > - gdev->passwd = get_attr_value(node, "passwd"); > + gdev->dev.vnc.port = get_attr_value(node, "port"); > + gdev->dev.vnc.host = get_attr_value(node, "listen"); > + gdev->dev.vnc.keymap = get_attr_value(node, "keymap"); > + gdev->dev.vnc.passwd = get_attr_value(node, "passwd"); > > - if (gdev->port == NULL || gdev->host == NULL) > + if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) > goto err; > } > else if (STREQC(gdev->type, "pty")) { > @@ -542,9 +542,9 @@ > for (child = node->children; child != NULL; > child = child->next) { > if (XSTREQ(child->name, "source")) > - gdev->host = get_attr_value(child, "path"); > + gdev->dev.vnc.host = get_attr_value(child, "path"); > else if (XSTREQ(child->name, "target")) > - gdev->port = get_attr_value(child, "port"); > + gdev->dev.vnc.port = get_attr_value(child, "port"); > } > } > else { > @@ -557,7 +557,7 @@ > if (STREQC(gdev->type, "vnc")) > ret = asprintf(&vdev->id, "%s", gdev->type); > else > - ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->port); > + ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->dev.vnc.port); > > if (ret == -1) { > CU_DEBUG("Failed to create graphics is string"); > @@ -798,9 +798,10 @@ > DUP_FIELD(dev, _dev, dev.emu.path); > } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { > DUP_FIELD(dev, _dev, dev.graphics.type); > - DUP_FIELD(dev, _dev, dev.graphics.port); > - DUP_FIELD(dev, _dev, dev.graphics.host); > - DUP_FIELD(dev, _dev, dev.graphics.keymap); > + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.host); > + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.port); > + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.keymap); > + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.passwd); > } else if (dev->type == CIM_RES_TYPE_INPUT) { > DUP_FIELD(dev, _dev, dev.input.type); > DUP_FIELD(dev, _dev, dev.input.bus); > diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.h > --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300 > +++ b/libxkutil/device_parsing.h Wed Jul 20 18:03:54 2011 +0800 > @@ -83,14 +83,28 @@ > char *path; > }; > > -struct graphics_device { > - char *type; > +//vnc_device must be larger or equal than sdl_device > +struct vnc_device { > char *port; > char *host; > char *keymap; > char *passwd; > }; > > +struct sdl_device { > + char *display; > + char *xauth; > + char *fullscreen; > +}; > + > +struct graphics_device { > + char *type; > + union { > + struct vnc_device vnc; > + struct sdl_device sdl; > + } dev; > +}; > + > struct input_device { > char *type; > char *bus; > diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xml_parse_test.c > --- a/libxkutil/xml_parse_test.c Mon Jul 18 11:13:40 2011 -0300 > +++ b/libxkutil/xml_parse_test.c Wed Jul 20 18:03:54 2011 +0800 > @@ -116,7 +116,7 @@ > FILE *d) > { > print_value(d, "Graphics Type", dev->dev.graphics.type); > - print_value(d, "Graphics Port", dev->dev.graphics.port); > + print_value(d, "Graphics Port", dev->dev.graphics.dev.vnc.port); > } > > static void print_devices(struct domain *dominfo, > diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xmlgen.c > --- a/libxkutil/xmlgen.c Mon Jul 18 11:13:40 2011 -0300 > +++ b/libxkutil/xmlgen.c Wed Jul 20 18:03:54 2011 +0800 > @@ -424,22 +424,22 @@ > if (STREQC(dev->type, "sdl")) > return NULL; > > - if (dev->port) { > - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); > - if (STREQC(dev->port, "-1")) > + if (dev->dev.vnc.port) { > + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); > + if (STREQC(dev->dev.vnc.port, "-1")) > xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes"); > else > xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no"); > } > > - if (dev->host) > - xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); > + if (dev->dev.vnc.host) > + xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->dev.vnc.host); > > - if (dev->passwd) > - xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd); > + if (dev->dev.vnc.passwd) > + xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->dev.vnc.passwd); > > - if (dev->keymap) > - xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); > + if (dev->dev.vnc.keymap) > + xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->dev.vnc.keymap); > > return NULL; > } > @@ -460,15 +460,15 @@ > if (tmp == NULL) > return XML_ERROR; > > - if(dev->host) > - xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host); > + if(dev->dev.vnc.host) > + xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host); > > tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL); > if (tmp == NULL) > return XML_ERROR; > > - if(dev->port) > - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); > + if(dev->dev.vnc.port) > + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); > > return NULL; > } > diff -r 3c90a88a5199 -r 0c52e4f6c421 src/Virt_ComputerSystem.c > --- a/src/Virt_ComputerSystem.c Mon Jul 18 11:13:40 2011 -0300 > +++ b/src/Virt_ComputerSystem.c Wed Jul 20 18:03:54 2011 +0800 > @@ -104,7 +104,7 @@ > "Virtual System (Console on %s://%s:%s)", > domain->dev_graphics[0].dev.graphics.type, > host, > - domain->dev_graphics[0].dev.graphics.port); > + domain->dev_graphics[0].dev.graphics.dev.vnc.port); Which is here, I don't know why the reply screwed all the indentation up, but you can find it on your original message. Best regards, -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From cvincent at linux.vnet.ibm.com Fri Jul 22 00:42:04 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 21 Jul 2011 20:42:04 -0400 Subject: [Libvirt-cim] [PATCH v2 1/2] Add SDL graphic device support In-Reply-To: <4E286B3B.9090304@linux.vnet.ibm.com> References: <4E26C742.30904@linux.vnet.ibm.com> <4E286B3B.9090304@linux.vnet.ibm.com> Message-ID: <4E28C75C.7090200@linux.vnet.ibm.com> Thanks. Pushed. On 07/21/2011 02:08 PM, Eduardo Lima (Etrunko) wrote: > On 07/20/2011 09:17 AM, Wayne Xia wrote: >> # HG changeset patch >> # User Wayne Xia >> # Date 1311156234 -28800 >> # Node ID 0c52e4f6c421cc2e168197a82a9333d4ce369655 >> # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 >> made the graphic structure as union >> >> These change were made to allow SDL device properties added more >> clearly, the graphic_device structure now contains a union >> > > Tried to apply your patch, without success. Are you sure you are in sync > with latest tip? Especially now that Chip pushed some changes I > submitted which would very likely conflict with this patch. > > Anyway, There is only a small indentation issue below... > >> Signed-off-by: Wayne Xia (Wayne) >> >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.c >> --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/device_parsing.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -91,10 +91,10 @@ >> static void cleanup_graphics_device(struct graphics_device *dev) >> { >> free(dev->type); >> - free(dev->port); >> - free(dev->host); >> - free(dev->keymap); >> - free(dev->passwd); >> + free(dev->dev.vnc.port); >> + free(dev->dev.vnc.host); >> + free(dev->dev.vnc.keymap); >> + free(dev->dev.vnc.passwd); >> } >> >> static void cleanup_input_device(struct input_device *dev) >> @@ -522,12 +522,12 @@ >> CU_DEBUG("graphics device type = %s", gdev->type); >> >> if (STREQC(gdev->type, "vnc")) { >> - gdev->port = get_attr_value(node, "port"); >> - gdev->host = get_attr_value(node, "listen"); >> - gdev->keymap = get_attr_value(node, "keymap"); >> - gdev->passwd = get_attr_value(node, "passwd"); >> + gdev->dev.vnc.port = get_attr_value(node, "port"); >> + gdev->dev.vnc.host = get_attr_value(node, "listen"); >> + gdev->dev.vnc.keymap = get_attr_value(node, "keymap"); >> + gdev->dev.vnc.passwd = get_attr_value(node, "passwd"); >> >> - if (gdev->port == NULL || gdev->host == NULL) >> + if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) >> goto err; >> } >> else if (STREQC(gdev->type, "pty")) { >> @@ -542,9 +542,9 @@ >> for (child = node->children; child != NULL; >> child = child->next) { >> if (XSTREQ(child->name, "source")) >> - gdev->host = get_attr_value(child, "path"); >> + gdev->dev.vnc.host = get_attr_value(child, "path"); >> else if (XSTREQ(child->name, "target")) >> - gdev->port = get_attr_value(child, "port"); >> + gdev->dev.vnc.port = get_attr_value(child, "port"); >> } >> } >> else { >> @@ -557,7 +557,7 @@ >> if (STREQC(gdev->type, "vnc")) >> ret = asprintf(&vdev->id, "%s", gdev->type); >> else >> - ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->port); >> + ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->dev.vnc.port); >> >> if (ret == -1) { >> CU_DEBUG("Failed to create graphics is string"); >> @@ -798,9 +798,10 @@ >> DUP_FIELD(dev, _dev, dev.emu.path); >> } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { >> DUP_FIELD(dev, _dev, dev.graphics.type); >> - DUP_FIELD(dev, _dev, dev.graphics.port); >> - DUP_FIELD(dev, _dev, dev.graphics.host); >> - DUP_FIELD(dev, _dev, dev.graphics.keymap); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.host); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.port); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.keymap); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.passwd); >> } else if (dev->type == CIM_RES_TYPE_INPUT) { >> DUP_FIELD(dev, _dev, dev.input.type); >> DUP_FIELD(dev, _dev, dev.input.bus); >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.h >> --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/device_parsing.h Wed Jul 20 18:03:54 2011 +0800 >> @@ -83,14 +83,28 @@ >> char *path; >> }; >> >> -struct graphics_device { >> - char *type; >> +//vnc_device must be larger or equal than sdl_device >> +struct vnc_device { >> char *port; >> char *host; >> char *keymap; >> char *passwd; >> }; >> >> +struct sdl_device { >> + char *display; >> + char *xauth; >> + char *fullscreen; >> +}; >> + >> +struct graphics_device { >> + char *type; >> + union { >> + struct vnc_device vnc; >> + struct sdl_device sdl; >> + } dev; >> +}; >> + >> struct input_device { >> char *type; >> char *bus; >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xml_parse_test.c >> --- a/libxkutil/xml_parse_test.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/xml_parse_test.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -116,7 +116,7 @@ >> FILE *d) >> { >> print_value(d, "Graphics Type", dev->dev.graphics.type); >> - print_value(d, "Graphics Port", dev->dev.graphics.port); >> + print_value(d, "Graphics Port", dev->dev.graphics.dev.vnc.port); >> } >> >> static void print_devices(struct domain *dominfo, >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xmlgen.c >> --- a/libxkutil/xmlgen.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/xmlgen.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -424,22 +424,22 @@ >> if (STREQC(dev->type, "sdl")) >> return NULL; >> >> - if (dev->port) { >> - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); >> - if (STREQC(dev->port, "-1")) >> + if (dev->dev.vnc.port) { >> + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); >> + if (STREQC(dev->dev.vnc.port, "-1")) >> xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes"); >> else >> xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no"); >> } >> >> - if (dev->host) >> - xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); >> + if (dev->dev.vnc.host) >> + xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->dev.vnc.host); >> >> - if (dev->passwd) >> - xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd); >> + if (dev->dev.vnc.passwd) >> + xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->dev.vnc.passwd); >> >> - if (dev->keymap) >> - xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); >> + if (dev->dev.vnc.keymap) >> + xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->dev.vnc.keymap); >> >> return NULL; >> } >> @@ -460,15 +460,15 @@ >> if (tmp == NULL) >> return XML_ERROR; >> >> - if(dev->host) >> - xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host); >> + if(dev->dev.vnc.host) >> + xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host); >> >> tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL); >> if (tmp == NULL) >> return XML_ERROR; >> >> - if(dev->port) >> - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); >> + if(dev->dev.vnc.port) >> + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); >> >> return NULL; >> } >> diff -r 3c90a88a5199 -r 0c52e4f6c421 src/Virt_ComputerSystem.c >> --- a/src/Virt_ComputerSystem.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/src/Virt_ComputerSystem.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -104,7 +104,7 @@ >> "Virtual System (Console on %s://%s:%s)", >> domain->dev_graphics[0].dev.graphics.type, >> host, >> - domain->dev_graphics[0].dev.graphics.port); >> + domain->dev_graphics[0].dev.graphics.dev.vnc.port); > > Which is here, I don't know why the reply screwed all the indentation > up, but you can find it on your original message. > > Best regards, > -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Fri Jul 22 00:42:27 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 21 Jul 2011 20:42:27 -0400 Subject: [Libvirt-cim] [PATCH] Fix crash when creating ACL filter lists In-Reply-To: <4E2868C3.2090709@linux.vnet.ibm.com> References: <4E28636F.40207@linux.vnet.ibm.com> <4E2865D0.70301@linux.vnet.ibm.com> <4E2868C3.2090709@linux.vnet.ibm.com> Message-ID: <4E28C773.3060603@linux.vnet.ibm.com> Thanks. Pushed. On 07/21/2011 01:58 PM, Eduardo Lima (Etrunko) wrote: > On 07/21/2011 02:45 PM, Chip Vincent wrote: >> >> >> On 07/21/2011 01:35 PM, Eduardo Lima (Etrunko) wrote: >> >>> >>> Looks good. With this patch I was able to successfully create a new >>> filter with a filterref entry referring to another pre-existent filter. >>> I was not able to create the AppliedFilterList instance though, i.e, >>> associate a filter to a network interface of a given domain. Is there >>> any restriction about that? If so, the patch is good to go and a proper >>> fix where necessary can be provided by another patch. >>> >> >> Yep. I mentioned this in the comment: >> >> "It appears libvirt w/ qemu does not support dynamic updating of virtual >> net devices in 0.8.1 so CreateInstance() will still fail (but not crash) >> in that version. Looking for alternatives to provide dynamic support and >> will post in a follow-on patch. " >> >> You should be seeing an error message like "failed to dynamically update >> device". I'm working on a separate patch for that now along with write >> support for filter rules. >> > > Uh, my bad, sorry. Go for it, then. :) > >>> Best regards, >>> >> > > -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Fri Jul 22 00:43:18 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 21 Jul 2011 20:43:18 -0400 Subject: [Libvirt-cim] [PATCH v2 1/2] Add SDL graphic device support In-Reply-To: <4E286B3B.9090304@linux.vnet.ibm.com> References: <4E26C742.30904@linux.vnet.ibm.com> <4E286B3B.9090304@linux.vnet.ibm.com> Message-ID: <4E28C7A6.4020100@linux.vnet.ibm.com> Disregard previous email. Hit send on wrong email. Not pushed yet since still under review. On 07/21/2011 02:08 PM, Eduardo Lima (Etrunko) wrote: > On 07/20/2011 09:17 AM, Wayne Xia wrote: >> # HG changeset patch >> # User Wayne Xia >> # Date 1311156234 -28800 >> # Node ID 0c52e4f6c421cc2e168197a82a9333d4ce369655 >> # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 >> made the graphic structure as union >> >> These change were made to allow SDL device properties added more >> clearly, the graphic_device structure now contains a union >> > > Tried to apply your patch, without success. Are you sure you are in sync > with latest tip? Especially now that Chip pushed some changes I > submitted which would very likely conflict with this patch. > > Anyway, There is only a small indentation issue below... > >> Signed-off-by: Wayne Xia (Wayne) >> >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.c >> --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/device_parsing.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -91,10 +91,10 @@ >> static void cleanup_graphics_device(struct graphics_device *dev) >> { >> free(dev->type); >> - free(dev->port); >> - free(dev->host); >> - free(dev->keymap); >> - free(dev->passwd); >> + free(dev->dev.vnc.port); >> + free(dev->dev.vnc.host); >> + free(dev->dev.vnc.keymap); >> + free(dev->dev.vnc.passwd); >> } >> >> static void cleanup_input_device(struct input_device *dev) >> @@ -522,12 +522,12 @@ >> CU_DEBUG("graphics device type = %s", gdev->type); >> >> if (STREQC(gdev->type, "vnc")) { >> - gdev->port = get_attr_value(node, "port"); >> - gdev->host = get_attr_value(node, "listen"); >> - gdev->keymap = get_attr_value(node, "keymap"); >> - gdev->passwd = get_attr_value(node, "passwd"); >> + gdev->dev.vnc.port = get_attr_value(node, "port"); >> + gdev->dev.vnc.host = get_attr_value(node, "listen"); >> + gdev->dev.vnc.keymap = get_attr_value(node, "keymap"); >> + gdev->dev.vnc.passwd = get_attr_value(node, "passwd"); >> >> - if (gdev->port == NULL || gdev->host == NULL) >> + if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) >> goto err; >> } >> else if (STREQC(gdev->type, "pty")) { >> @@ -542,9 +542,9 @@ >> for (child = node->children; child != NULL; >> child = child->next) { >> if (XSTREQ(child->name, "source")) >> - gdev->host = get_attr_value(child, "path"); >> + gdev->dev.vnc.host = get_attr_value(child, "path"); >> else if (XSTREQ(child->name, "target")) >> - gdev->port = get_attr_value(child, "port"); >> + gdev->dev.vnc.port = get_attr_value(child, "port"); >> } >> } >> else { >> @@ -557,7 +557,7 @@ >> if (STREQC(gdev->type, "vnc")) >> ret = asprintf(&vdev->id, "%s", gdev->type); >> else >> - ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->port); >> + ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->dev.vnc.port); >> >> if (ret == -1) { >> CU_DEBUG("Failed to create graphics is string"); >> @@ -798,9 +798,10 @@ >> DUP_FIELD(dev, _dev, dev.emu.path); >> } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { >> DUP_FIELD(dev, _dev, dev.graphics.type); >> - DUP_FIELD(dev, _dev, dev.graphics.port); >> - DUP_FIELD(dev, _dev, dev.graphics.host); >> - DUP_FIELD(dev, _dev, dev.graphics.keymap); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.host); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.port); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.keymap); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.passwd); >> } else if (dev->type == CIM_RES_TYPE_INPUT) { >> DUP_FIELD(dev, _dev, dev.input.type); >> DUP_FIELD(dev, _dev, dev.input.bus); >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.h >> --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/device_parsing.h Wed Jul 20 18:03:54 2011 +0800 >> @@ -83,14 +83,28 @@ >> char *path; >> }; >> >> -struct graphics_device { >> - char *type; >> +//vnc_device must be larger or equal than sdl_device >> +struct vnc_device { >> char *port; >> char *host; >> char *keymap; >> char *passwd; >> }; >> >> +struct sdl_device { >> + char *display; >> + char *xauth; >> + char *fullscreen; >> +}; >> + >> +struct graphics_device { >> + char *type; >> + union { >> + struct vnc_device vnc; >> + struct sdl_device sdl; >> + } dev; >> +}; >> + >> struct input_device { >> char *type; >> char *bus; >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xml_parse_test.c >> --- a/libxkutil/xml_parse_test.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/xml_parse_test.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -116,7 +116,7 @@ >> FILE *d) >> { >> print_value(d, "Graphics Type", dev->dev.graphics.type); >> - print_value(d, "Graphics Port", dev->dev.graphics.port); >> + print_value(d, "Graphics Port", dev->dev.graphics.dev.vnc.port); >> } >> >> static void print_devices(struct domain *dominfo, >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xmlgen.c >> --- a/libxkutil/xmlgen.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/xmlgen.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -424,22 +424,22 @@ >> if (STREQC(dev->type, "sdl")) >> return NULL; >> >> - if (dev->port) { >> - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); >> - if (STREQC(dev->port, "-1")) >> + if (dev->dev.vnc.port) { >> + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); >> + if (STREQC(dev->dev.vnc.port, "-1")) >> xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes"); >> else >> xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no"); >> } >> >> - if (dev->host) >> - xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); >> + if (dev->dev.vnc.host) >> + xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->dev.vnc.host); >> >> - if (dev->passwd) >> - xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd); >> + if (dev->dev.vnc.passwd) >> + xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->dev.vnc.passwd); >> >> - if (dev->keymap) >> - xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); >> + if (dev->dev.vnc.keymap) >> + xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->dev.vnc.keymap); >> >> return NULL; >> } >> @@ -460,15 +460,15 @@ >> if (tmp == NULL) >> return XML_ERROR; >> >> - if(dev->host) >> - xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host); >> + if(dev->dev.vnc.host) >> + xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host); >> >> tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL); >> if (tmp == NULL) >> return XML_ERROR; >> >> - if(dev->port) >> - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); >> + if(dev->dev.vnc.port) >> + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); >> >> return NULL; >> } >> diff -r 3c90a88a5199 -r 0c52e4f6c421 src/Virt_ComputerSystem.c >> --- a/src/Virt_ComputerSystem.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/src/Virt_ComputerSystem.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -104,7 +104,7 @@ >> "Virtual System (Console on %s://%s:%s)", >> domain->dev_graphics[0].dev.graphics.type, >> host, >> - domain->dev_graphics[0].dev.graphics.port); >> + domain->dev_graphics[0].dev.graphics.dev.vnc.port); > > Which is here, I don't know why the reply screwed all the indentation > up, but you can find it on your original message. > > Best regards, > -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Fri Jul 22 00:44:46 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 21 Jul 2011 20:44:46 -0400 Subject: [Libvirt-cim] [PATCH v2 1/2] Add SDL graphic device support In-Reply-To: <4E286B3B.9090304@linux.vnet.ibm.com> References: <4E26C742.30904@linux.vnet.ibm.com> <4E286B3B.9090304@linux.vnet.ibm.com> Message-ID: <4E28C7FE.7040403@linux.vnet.ibm.com> Good advice. We don't move very fast around here so it's a good idea to re-base to tha latest upstream version prior to send. On 07/21/2011 02:08 PM, Eduardo Lima (Etrunko) wrote: > On 07/20/2011 09:17 AM, Wayne Xia wrote: >> # HG changeset patch >> # User Wayne Xia >> # Date 1311156234 -28800 >> # Node ID 0c52e4f6c421cc2e168197a82a9333d4ce369655 >> # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 >> made the graphic structure as union >> >> These change were made to allow SDL device properties added more >> clearly, the graphic_device structure now contains a union >> > > Tried to apply your patch, without success. Are you sure you are in sync > with latest tip? Especially now that Chip pushed some changes I > submitted which would very likely conflict with this patch. > > Anyway, There is only a small indentation issue below... > >> Signed-off-by: Wayne Xia (Wayne) >> >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.c >> --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/device_parsing.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -91,10 +91,10 @@ >> static void cleanup_graphics_device(struct graphics_device *dev) >> { >> free(dev->type); >> - free(dev->port); >> - free(dev->host); >> - free(dev->keymap); >> - free(dev->passwd); >> + free(dev->dev.vnc.port); >> + free(dev->dev.vnc.host); >> + free(dev->dev.vnc.keymap); >> + free(dev->dev.vnc.passwd); >> } >> >> static void cleanup_input_device(struct input_device *dev) >> @@ -522,12 +522,12 @@ >> CU_DEBUG("graphics device type = %s", gdev->type); >> >> if (STREQC(gdev->type, "vnc")) { >> - gdev->port = get_attr_value(node, "port"); >> - gdev->host = get_attr_value(node, "listen"); >> - gdev->keymap = get_attr_value(node, "keymap"); >> - gdev->passwd = get_attr_value(node, "passwd"); >> + gdev->dev.vnc.port = get_attr_value(node, "port"); >> + gdev->dev.vnc.host = get_attr_value(node, "listen"); >> + gdev->dev.vnc.keymap = get_attr_value(node, "keymap"); >> + gdev->dev.vnc.passwd = get_attr_value(node, "passwd"); >> >> - if (gdev->port == NULL || gdev->host == NULL) >> + if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) >> goto err; >> } >> else if (STREQC(gdev->type, "pty")) { >> @@ -542,9 +542,9 @@ >> for (child = node->children; child != NULL; >> child = child->next) { >> if (XSTREQ(child->name, "source")) >> - gdev->host = get_attr_value(child, "path"); >> + gdev->dev.vnc.host = get_attr_value(child, "path"); >> else if (XSTREQ(child->name, "target")) >> - gdev->port = get_attr_value(child, "port"); >> + gdev->dev.vnc.port = get_attr_value(child, "port"); >> } >> } >> else { >> @@ -557,7 +557,7 @@ >> if (STREQC(gdev->type, "vnc")) >> ret = asprintf(&vdev->id, "%s", gdev->type); >> else >> - ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->port); >> + ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->dev.vnc.port); >> >> if (ret == -1) { >> CU_DEBUG("Failed to create graphics is string"); >> @@ -798,9 +798,10 @@ >> DUP_FIELD(dev, _dev, dev.emu.path); >> } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { >> DUP_FIELD(dev, _dev, dev.graphics.type); >> - DUP_FIELD(dev, _dev, dev.graphics.port); >> - DUP_FIELD(dev, _dev, dev.graphics.host); >> - DUP_FIELD(dev, _dev, dev.graphics.keymap); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.host); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.port); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.keymap); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.passwd); >> } else if (dev->type == CIM_RES_TYPE_INPUT) { >> DUP_FIELD(dev, _dev, dev.input.type); >> DUP_FIELD(dev, _dev, dev.input.bus); >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/device_parsing.h >> --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/device_parsing.h Wed Jul 20 18:03:54 2011 +0800 >> @@ -83,14 +83,28 @@ >> char *path; >> }; >> >> -struct graphics_device { >> - char *type; >> +//vnc_device must be larger or equal than sdl_device >> +struct vnc_device { >> char *port; >> char *host; >> char *keymap; >> char *passwd; >> }; >> >> +struct sdl_device { >> + char *display; >> + char *xauth; >> + char *fullscreen; >> +}; >> + >> +struct graphics_device { >> + char *type; >> + union { >> + struct vnc_device vnc; >> + struct sdl_device sdl; >> + } dev; >> +}; >> + >> struct input_device { >> char *type; >> char *bus; >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xml_parse_test.c >> --- a/libxkutil/xml_parse_test.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/xml_parse_test.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -116,7 +116,7 @@ >> FILE *d) >> { >> print_value(d, "Graphics Type", dev->dev.graphics.type); >> - print_value(d, "Graphics Port", dev->dev.graphics.port); >> + print_value(d, "Graphics Port", dev->dev.graphics.dev.vnc.port); >> } >> >> static void print_devices(struct domain *dominfo, >> diff -r 3c90a88a5199 -r 0c52e4f6c421 libxkutil/xmlgen.c >> --- a/libxkutil/xmlgen.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/libxkutil/xmlgen.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -424,22 +424,22 @@ >> if (STREQC(dev->type, "sdl")) >> return NULL; >> >> - if (dev->port) { >> - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); >> - if (STREQC(dev->port, "-1")) >> + if (dev->dev.vnc.port) { >> + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); >> + if (STREQC(dev->dev.vnc.port, "-1")) >> xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes"); >> else >> xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no"); >> } >> >> - if (dev->host) >> - xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); >> + if (dev->dev.vnc.host) >> + xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->dev.vnc.host); >> >> - if (dev->passwd) >> - xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd); >> + if (dev->dev.vnc.passwd) >> + xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->dev.vnc.passwd); >> >> - if (dev->keymap) >> - xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); >> + if (dev->dev.vnc.keymap) >> + xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->dev.vnc.keymap); >> >> return NULL; >> } >> @@ -460,15 +460,15 @@ >> if (tmp == NULL) >> return XML_ERROR; >> >> - if(dev->host) >> - xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host); >> + if(dev->dev.vnc.host) >> + xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host); >> >> tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL); >> if (tmp == NULL) >> return XML_ERROR; >> >> - if(dev->port) >> - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); >> + if(dev->dev.vnc.port) >> + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); >> >> return NULL; >> } >> diff -r 3c90a88a5199 -r 0c52e4f6c421 src/Virt_ComputerSystem.c >> --- a/src/Virt_ComputerSystem.c Mon Jul 18 11:13:40 2011 -0300 >> +++ b/src/Virt_ComputerSystem.c Wed Jul 20 18:03:54 2011 +0800 >> @@ -104,7 +104,7 @@ >> "Virtual System (Console on %s://%s:%s)", >> domain->dev_graphics[0].dev.graphics.type, >> host, >> - domain->dev_graphics[0].dev.graphics.port); >> + domain->dev_graphics[0].dev.graphics.dev.vnc.port); > > Which is here, I don't know why the reply screwed all the indentation > up, but you can find it on your original message. > > Best regards, > -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From cvincent at linux.vnet.ibm.com Fri Jul 22 00:46:22 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Thu, 21 Jul 2011 20:46:22 -0400 Subject: [Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData does not conform to profile In-Reply-To: References: Message-ID: <4E28C85E.1010408@linux.vnet.ibm.com> We do have a schema update planned for this year. I think the origianl plan was just to update the schema but perhaps we should rebase some of the profiles as a follow on. If everyone agrees we should rebase the profiles as part of the schema update, then I'm okay with this as a 'one-off' change for now. Comments? On 07/21/2011 11:52 AM, Gareth S Bestor wrote: > > } else if (dev->type == CIM_RES_TYPE_MEM) { > - const char *units = "KiloBytes"; > + const char *units = "byte*2^10"; > > > If we're doing this sorta change here then we should probably do it > everywhere, since users may be checking AllocationUnits between CIM > classes. Specifically, these should match the units being returned from > memory pool capabilities, and we need to check these new units will be > correctly parsed when passed as embedded instances (eg DefineSystem(), > ModifyResourceSettings(), etc)... Alternatively, we might want to > consider going thru the entire libvirt-cim suite and upgrading all > classes from DSP0004v2.4 to DSP0004 2.5+ conformance level (ie using > Augmented BNFeverywhere its relevant) rather than having in old and new > units sprinkled around. > > Basically, doing this change here and now may have much wider implications. > > - Gareth > > Dr. Gareth S. Bestor > IBM Senior Software Engineer > Systems & Technology Group - Systems Management Standards > 971-285-6375 (mobile) > bestor at us.ibm.com > > > > *[Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData > does not conform to profile* > > > *Wayne Xia * to: List for discussion and development of libvirt CIM > 07/21/11 12:34 AM > > > Sent by: *libvirt-cim-bounces at redhat.com* > > > *Please respond to List for discussion and development of libvirt CIM * > > > > > ------------------------------------------------------------------------ > > > > # HG changeset patch > # User Wayne Xia > # Date 1311231387 -28800 > # Node ID 677867c3d2a16a97591bde2828808f9f39b859a7 > # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 > changed a bit to make it conform to CIM profile > > According to the discuss and profile, the reserved property means the > memory actually allocated to support the VM running, and the unit > should be byte*2^10. This patch added some code to retrieve VM's state, > and the report the memory status according to that. > https://bugzilla.linux.ibm.com/show_bug.cgi?id=72759 > > Signed-off-by: Wayne Xia > > diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300 > +++ b/libxkutil/device_parsing.c Thu Jul 21 14:56:27 2011 +0800 > @@ -792,6 +792,7 @@ > } else if (dev->type == CIM_RES_TYPE_MEM) { > dev->dev.mem.size = _dev->dev.mem.size; > dev->dev.mem.maxsize = _dev->dev.mem.maxsize; > + dev->dev.mem.reserved = _dev->dev.mem.reserved; > } else if (dev->type == CIM_RES_TYPE_PROC) { > dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity; > } else if (dev->type == CIM_RES_TYPE_EMU) { > @@ -885,8 +886,22 @@ > if (xml == NULL) > return 0; > > - if (type == CIM_RES_TYPE_MEM) > + if (type == CIM_RES_TYPE_MEM) { > ret = _get_mem_device(xml, list); > + if (*list != NULL) { > + virDomainInfo dom_info; > + if (virDomainGetInfo(dom, &dom_info) == 0) { > + (*list)->dev.mem.reserved = dom_info.memory; > + if (dom_info.state == 5) { /* VM not active */ > + (*list)->dev.mem.reserved = 0; > + } > + } > + else { > + CU_DEBUG("failed to get dom state for mem"); > + ret = -1; > + } > + } > + } > else if (type == CIM_RES_TYPE_PROC) > ret = _get_proc_device(xml, list); > else > diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.h > --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300 > +++ b/libxkutil/device_parsing.h Thu Jul 21 14:56:27 2011 +0800 > @@ -71,6 +71,7 @@ > struct mem_device { > uint64_t size; > uint64_t maxsize; > + uint64_t reserved; > }; > > struct vcpu_device { > diff -r 3c90a88a5199 -r 677867c3d2a1 src/Virt_RASD.c > --- a/src/Virt_RASD.c Mon Jul 18 11:13:40 2011 -0300 > +++ b/src/Virt_RASD.c Thu Jul 21 14:56:27 2011 +0800 > @@ -576,14 +576,14 @@ > inst); > > } else if (dev->type == CIM_RES_TYPE_MEM) { > - const char *units = "KiloBytes"; > + const char *units = "byte*2^10"; > > CMSetProperty(inst, "AllocationUnits", > (CMPIValue *)units, CMPI_chars); > CMSetProperty(inst, "VirtualQuantity", > (CMPIValue *)&dev->dev.mem.size, > CMPI_uint64); > CMSetProperty(inst, "Reservation", > - (CMPIValue *)&dev->dev.mem.size, > CMPI_uint64); > + (CMPIValue *)&dev->dev.mem.reserved, > CMPI_uint64); > CMSetProperty(inst, "Limit", > (CMPIValue *)&dev->dev.mem.maxsize, > CMPI_uint64); > } else if (dev->type == CIM_RES_TYPE_PROC) { > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From bestor at us.ibm.com Fri Jul 22 01:19:50 2011 From: bestor at us.ibm.com (Gareth S Bestor) Date: Thu, 21 Jul 2011 18:19:50 -0700 Subject: [Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData does not conform to profile In-Reply-To: <4E28C85E.1010408@linux.vnet.ibm.com> Message-ID: So long as this new VM memory RASD AllocationUnits ("byte*2^10") will match that of the MemoryPool capabilities' RASDs, and the new 'augmented BNF' string is parsed ok when passed as an embedded instance to the cimom (pegasus, sfcb) then I'm okay with this one-off too. Both these are required otherwise existing usecases will break. - G Dr. Gareth S. Bestor IBM Senior Software Engineer Systems & Technology Group - Systems Management Standards 971-285-6375 (mobile) bestor at us.ibm.com Re: [Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData does not conform to profile Chip Vincent to: libvirt-cim 07/21/11 05:50 PM Sent by: libvirt-cim-bounces at redhat.com Please respond to cvincent, List for discussion and development of libvirt CIM We do have a schema update planned for this year. I think the origianl plan was just to update the schema but perhaps we should rebase some of the profiles as a follow on. If everyone agrees we should rebase the profiles as part of the schema update, then I'm okay with this as a 'one-off' change for now. Comments? On 07/21/2011 11:52 AM, Gareth S Bestor wrote: > > } else if (dev->type == CIM_RES_TYPE_MEM) { > - const char *units = "KiloBytes"; > + const char *units = "byte*2^10"; > > > If we're doing this sorta change here then we should probably do it > everywhere, since users may be checking AllocationUnits between CIM > classes. Specifically, these should match the units being returned from > memory pool capabilities, and we need to check these new units will be > correctly parsed when passed as embedded instances (eg DefineSystem(), > ModifyResourceSettings(), etc)... Alternatively, we might want to > consider going thru the entire libvirt-cim suite and upgrading all > classes from DSP0004v2.4 to DSP0004 2.5+ conformance level (ie using > Augmented BNFeverywhere its relevant) rather than having in old and new > units sprinkled around. > > Basically, doing this change here and now may have much wider implications. > > - Gareth > > Dr. Gareth S. Bestor > IBM Senior Software Engineer > Systems & Technology Group - Systems Management Standards > 971-285-6375 (mobile) > bestor at us.ibm.com > > > > *[Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData > does not conform to profile* > > > *Wayne Xia * to: List for discussion and development of libvirt CIM > 07/21/11 12:34 AM > > > Sent by: *libvirt-cim-bounces at redhat.com* > > > *Please respond to List for discussion and development of libvirt CIM * > > > > > ------------------------------------------------------------------------ > > > > # HG changeset patch > # User Wayne Xia > # Date 1311231387 -28800 > # Node ID 677867c3d2a16a97591bde2828808f9f39b859a7 > # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 > changed a bit to make it conform to CIM profile > > According to the discuss and profile, the reserved property means the > memory actually allocated to support the VM running, and the unit > should be byte*2^10. This patch added some code to retrieve VM's state, > and the report the memory status according to that. > https://bugzilla.linux.ibm.com/show_bug.cgi?id=72759 > > Signed-off-by: Wayne Xia > > diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300 > +++ b/libxkutil/device_parsing.c Thu Jul 21 14:56:27 2011 +0800 > @@ -792,6 +792,7 @@ > } else if (dev->type == CIM_RES_TYPE_MEM) { > dev->dev.mem.size = _dev->dev.mem.size; > dev->dev.mem.maxsize = _dev->dev.mem.maxsize; > + dev->dev.mem.reserved = _dev->dev.mem.reserved; > } else if (dev->type == CIM_RES_TYPE_PROC) { > dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity; > } else if (dev->type == CIM_RES_TYPE_EMU) { > @@ -885,8 +886,22 @@ > if (xml == NULL) > return 0; > > - if (type == CIM_RES_TYPE_MEM) > + if (type == CIM_RES_TYPE_MEM) { > ret = _get_mem_device(xml, list); > + if (*list != NULL) { > + virDomainInfo dom_info; > + if (virDomainGetInfo(dom, &dom_info) == 0) { > + (*list)->dev.mem.reserved = dom_info.memory; > + if (dom_info.state == 5) { /* VM not active */ > + (*list)->dev.mem.reserved = 0; > + } > + } > + else { > + CU_DEBUG("failed to get dom state for mem"); > + ret = -1; > + } > + } > + } > else if (type == CIM_RES_TYPE_PROC) > ret = _get_proc_device(xml, list); > else > diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.h > --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300 > +++ b/libxkutil/device_parsing.h Thu Jul 21 14:56:27 2011 +0800 > @@ -71,6 +71,7 @@ > struct mem_device { > uint64_t size; > uint64_t maxsize; > + uint64_t reserved; > }; > > struct vcpu_device { > diff -r 3c90a88a5199 -r 677867c3d2a1 src/Virt_RASD.c > --- a/src/Virt_RASD.c Mon Jul 18 11:13:40 2011 -0300 > +++ b/src/Virt_RASD.c Thu Jul 21 14:56:27 2011 +0800 > @@ -576,14 +576,14 @@ > inst); > > } else if (dev->type == CIM_RES_TYPE_MEM) { > - const char *units = "KiloBytes"; > + const char *units = "byte*2^10"; > > CMSetProperty(inst, "AllocationUnits", > (CMPIValue *)units, CMPI_chars); > CMSetProperty(inst, "VirtualQuantity", > (CMPIValue *)&dev->dev.mem.size, > CMPI_uint64); > CMSetProperty(inst, "Reservation", > - (CMPIValue *)&dev->dev.mem.size, > CMPI_uint64); > + (CMPIValue *)&dev->dev.mem.reserved, > CMPI_uint64); > CMSetProperty(inst, "Limit", > (CMPIValue *)&dev->dev.mem.maxsize, > CMPI_uint64); > } else if (dev->type == CIM_RES_TYPE_PROC) { > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com _______________________________________________ Libvirt-cim mailing list Libvirt-cim at redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim -------------- next part -------------- An HTML attachment was scrubbed... URL: From cvincent at linux.vnet.ibm.com Fri Jul 22 16:11:55 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Fri, 22 Jul 2011 12:11:55 -0400 Subject: [Libvirt-cim] Release of libvirt-cim-0.5.14 Message-ID: <4E29A14B.60206@linux.vnet.ibm.com> I'm happy announce the release of libvirt-cim-0.5.14. The new release is available at: ftp://libvirt.org/libvirt-cim/libvirt-cim-0.5.14.tar.gz libvirt-cim-0.5.14: * Fix crash when creating ACL filter lists (Chip Vincent) * Remove has_vnc_passwd key from infostore (Eduardo Lima) * Set PoolID for CIM_DiskResourceAlloca... (Sharad Mishra) * libxkutil: More meaningful log message (Eduardo Lima) * Add source host and directory for netfs diskpool (Sharad Mishra) * Set PoolID for CIM_NetResourceAllocationSettingData (Sharad Mishra) * libxkutil: Handle vnc password when ret... (Eduardo Lima) * Conditionally compile ACL APIs (Chip Vincent) * SwitchService will show the nic connected to VSI... (Sharad Mishra) * Make libconfig requirement optional (Eduardo Lima) * libvirt-cim.spec: Use %config(noreplace)... (Eduardo Lima) * Minor fix for MemoryPool.AllocationUnits (Chip Vincent) * Adjust FilterList.registration file permission (Chip Vincent) -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com From snmishra at us.ibm.com Mon Jul 25 20:15:45 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Mon, 25 Jul 2011 13:15:45 -0700 Subject: [Libvirt-cim] [PATCH] Fix connection leak introduced in patch 1119 Message-ID: <87404863f9a402eb1a59.1311624945@elm3b151.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1311624862 25200 # Node ID 87404863f9a402eb1a59ff717d93caa75c50b29c # Parent 7cb42b369d3776c9d727402ba0198eea573d0d40 Fix connection leak introduced in patch 1119. Signed-off-by: Sharad Mishra diff -r 7cb42b369d37 -r 87404863f9a4 src/Virt_RASD.c --- a/src/Virt_RASD.c Wed Jul 20 06:43:06 2011 -0700 +++ b/src/Virt_RASD.c Mon Jul 25 13:14:22 2011 -0700 @@ -349,6 +349,9 @@ (CMPIValue *)dev->dev.disk.cache, CMPI_chars); + virStoragePoolFree(pool); + virStorageVolFree(vol); + virConnectClose(conn); return s; } From cvincent at linux.vnet.ibm.com Tue Jul 26 00:25:48 2011 From: cvincent at linux.vnet.ibm.com (Chip Vincent) Date: Mon, 25 Jul 2011 20:25:48 -0400 Subject: [Libvirt-cim] [PATCH] Fix connection leak introduced in patch 1119 In-Reply-To: <87404863f9a402eb1a59.1311624945@elm3b151.beaverton.ibm.com> References: <87404863f9a402eb1a59.1311624945@elm3b151.beaverton.ibm.com> Message-ID: <4E2E098C.5050203@linux.vnet.ibm.com> (x86_64) libvirt-cim-0.5.14-1 tog-pegasus-2.11.0-1 libvirt-0.8.7-18 Before: # netstat -na | grep -v LISTENING | grep -c libvirt-sock 0 After: # netstat -na | grep -v LISTENING | grep -c libvirt-sock 0 -> no connection leaks. +1 and pushed! See attached run report for additional details: The results look *much* better with this patch. I only see three other 'interesting' issues: 1) Computer System Indication - needs investigation [priority = ?] 2) Profile assoc failures - libvirt-cim fix in progress [prority = high] 3) PoolID mismatches - side effect of fix 1119, which was expected. Fix will be in cimtest [priority = low] I'm working on a fix for #2 now. On 07/25/2011 04:15 PM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1311624862 25200 > # Node ID 87404863f9a402eb1a59ff717d93caa75c50b29c > # Parent 7cb42b369d3776c9d727402ba0198eea573d0d40 > Fix connection leak introduced in patch 1119. > > Signed-off-by: Sharad Mishra > > diff -r 7cb42b369d37 -r 87404863f9a4 src/Virt_RASD.c > --- a/src/Virt_RASD.c Wed Jul 20 06:43:06 2011 -0700 > +++ b/src/Virt_RASD.c Mon Jul 25 13:14:22 2011 -0700 > @@ -349,6 +349,9 @@ > (CMPIValue *)dev->dev.disk.cache, > CMPI_chars); > > + virStoragePoolFree(pool); > + virStorageVolFree(vol); > + virConnectClose(conn); > return s; > } > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Chip Vincent Open Virtualization IBM Linux Technology Center cvincent at linux.vnet.ibm.com -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: run_report.txt URL: From xiawenc at linux.vnet.ibm.com Wed Jul 27 01:01:53 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Wed, 27 Jul 2011 09:01:53 +0800 Subject: [Libvirt-cim] [PATCH] (#3) add sdl frame buffer support Message-ID: # HG changeset patch # User Wayne Xia # Date 1311670971 -28800 # Node ID d0bb7e93d02d3bd55d9b984165db0265c9865462 # Parent 792db1a6ead075375fad4a7d22143a0f978b5e48 (#3) add sdl frame buffer support. Now libvirt still supports sdl frame buffer, and it may take three parameters: display,xauth,fullscreen. This patch enable the libvirt-cim to accept these configuration and pass them in XML define to let libvirt know about it. Exposed interface could be found in the file ResourceAllocationSettingData.mof. https://bugzilla.linux.ibm.com/show_bug.cgi?id=71347 Signed-off-by: Wayne Xia (Wayne) diff -r 792db1a6ead0 -r d0bb7e93d02d libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Jul 25 19:39:08 2011 +0800 +++ b/libxkutil/device_parsing.c Tue Jul 26 17:02:51 2011 +0800 @@ -538,6 +538,11 @@ if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) goto err; } + else if (STREQC(gdev->type, "sdl")) { + gdev->dev.sdl.display = get_attr_value(node, "display"); + gdev->dev.sdl.xauth = get_attr_value(node, "xauth"); + gdev->dev.sdl.fullscreen = get_attr_value(node, "fullscreen"); + } else if (STREQC(gdev->type, "pty")) { if (node->name == NULL) goto err; diff -r 792db1a6ead0 -r d0bb7e93d02d libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Mon Jul 25 19:39:08 2011 +0800 +++ b/libxkutil/xmlgen.c Tue Jul 26 17:02:51 2011 +0800 @@ -421,8 +421,21 @@ xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); - if (STREQC(dev->type, "sdl")) - return NULL; + if (STREQC(dev->type, "sdl")) { + if (dev->dev.sdl.display) { + xmlNewProp(tmp, BAD_CAST "display", + BAD_CAST dev->dev.sdl.display); + } + if (dev->dev.sdl.xauth) { + xmlNewProp(tmp, BAD_CAST "xauth", + BAD_CAST dev->dev.sdl.xauth); + } + if (dev->dev.sdl.fullscreen) { + xmlNewProp(tmp, BAD_CAST "fullscreen", + BAD_CAST dev->dev.sdl.fullscreen); + } + return NULL; + } if (dev->dev.vnc.port) { xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); diff -r 792db1a6ead0 -r d0bb7e93d02d schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Mon Jul 25 19:39:08 2011 +0800 +++ b/schema/ResourceAllocationSettingData.mof Tue Jul 26 17:02:51 2011 +0800 @@ -219,7 +219,9 @@ [Description ("If ResourceSubType is 'vnc', this is a VNC Address. " "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If ResourceSubType " "is 'console', this is a character device path in " - "path:port format (e.g., '/dev/pts/3:0'\)")] + "path:port format (e.g., '/dev/pts/3:0'\) " + "if ResourceSubType is 'sdl', this is a combination of its params as " + "xauth:display (e.g., '/root/.Xauthority::0'\)")] string Address; [Description ("Keyboard keymapping")] @@ -228,7 +230,8 @@ [Description ("VNC password")] string Password; - [Description ("Is IPv6 only addressing is to be used")] + [Description ("Is IPv6 only addressing is to be used." + "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")] boolean IsIPv6Only; }; diff -r 792db1a6ead0 -r d0bb7e93d02d src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Jul 25 19:39:08 2011 +0800 +++ b/src/Virt_VirtualSystemManagementService.c Tue Jul 26 17:02:51 2011 +0800 @@ -1060,6 +1060,52 @@ return ret; } +static int parse_sdl_address(const char *id, + char **display, + char **xauth) +{ + int ret; + char *tmp_display = NULL; + char *tmp_xauth = NULL; + + CU_DEBUG("Entering parse_sdl_address, address is %s", id); + + ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display); + + if (ret <= 0) { + ret = sscanf(id, ":%as", &tmp_display); + if (ret <= 0) { + if (STREQC(id, ":")) { + /* do nothing, it is empty */ + } + else { + ret = 0; + goto out; + } + } + } + + if (display) { + if (tmp_display == NULL) + *display = NULL; + else + *display = strdup(tmp_display); + } + if (xauth) { + if (tmp_xauth == NULL) + *xauth = NULL; + else + *xauth = strdup(tmp_xauth); + } + ret = 1; + + out: + CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s", + *display, *xauth); + + return ret; +} + static int parse_vnc_address(const char *id, char **ip, char **port) @@ -1163,6 +1209,30 @@ msg = "GraphicsRASD field Address not valid"; goto out; } + } + else if (STREQC(dev->dev.graphics.type, "sdl")) { + if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) { + CU_DEBUG("sdl graphics Address empty, using default"); + dev->dev.graphics.dev.sdl.display = NULL; + dev->dev.graphics.dev.sdl.xauth = NULL; + } + else { + ret = parse_sdl_address(val, + &dev->dev.graphics.dev.sdl.display, + &dev->dev.graphics.dev.sdl.xauth); + if (ret != 1) { + msg = "GraphicsRASD sdl Address not valid"; + goto out; + } + } + dev->dev.graphics.dev.sdl.fullscreen = NULL; + if (cu_get_bool_prop(inst, "IsIPV6Only", &ipv6) == + CMPI_RC_OK) { + if (ipv6) + dev->dev.graphics.dev.sdl.fullscreen = strdup("yes"); + else + dev->dev.graphics.dev.sdl.fullscreen = strdup("no"); + } } else { CU_DEBUG("Unsupported graphics type %s", dev->dev.graphics.type); @@ -1171,7 +1241,8 @@ } free(dev->id); - if (STREQC(dev->dev.graphics.type, "vnc")) + if ((STREQC(dev->dev.graphics.type, "vnc"))|| + (STREQC(dev->dev.graphics.type, "sdl"))) ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); else ret = asprintf(&dev->id, "%s:%s", From xiawenc at linux.vnet.ibm.com Wed Jul 27 01:01:39 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Wed, 27 Jul 2011 09:01:39 +0800 Subject: [Libvirt-cim] [PATCH] (#3) made the graphic structure as union Message-ID: <792db1a6ead075375fad.1311728499@localhost6.localdomain6> # HG changeset patch # User Wayne Xia # Date 1311593948 -28800 # Node ID 792db1a6ead075375fad4a7d22143a0f978b5e48 # Parent 0f42cab9c45c53cc13407b16418399ed8ed4a026 (#3) made the graphic structure as union These change were made to allow SDL device properties added more clearly Signed-off-by: Wayne Xia (Wayne) diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Jul 25 13:14:22 2011 -0700 +++ b/libxkutil/device_parsing.c Mon Jul 25 19:39:08 2011 +0800 @@ -91,10 +91,10 @@ static void cleanup_graphics_device(struct graphics_device *dev) { free(dev->type); - free(dev->port); - free(dev->host); - free(dev->keymap); - free(dev->passwd); + free(dev->dev.vnc.port); + free(dev->dev.vnc.host); + free(dev->dev.vnc.keymap); + free(dev->dev.vnc.passwd); } static void cleanup_input_device(struct input_device *dev) @@ -530,12 +530,12 @@ CU_DEBUG("graphics device type = %s", gdev->type); if (STREQC(gdev->type, "vnc")) { - gdev->port = get_attr_value(node, "port"); - gdev->host = get_attr_value(node, "listen"); - gdev->keymap = get_attr_value(node, "keymap"); - gdev->passwd = get_attr_value(node, "passwd"); + gdev->dev.vnc.port = get_attr_value(node, "port"); + gdev->dev.vnc.host = get_attr_value(node, "listen"); + gdev->dev.vnc.keymap = get_attr_value(node, "keymap"); + gdev->dev.vnc.passwd = get_attr_value(node, "passwd"); - if (gdev->port == NULL || gdev->host == NULL) + if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) goto err; } else if (STREQC(gdev->type, "pty")) { @@ -550,9 +550,9 @@ for (child = node->children; child != NULL; child = child->next) { if (XSTREQ(child->name, "source")) - gdev->host = get_attr_value(child, "path"); + gdev->dev.vnc.host = get_attr_value(child, "path"); else if (XSTREQ(child->name, "target")) - gdev->port = get_attr_value(child, "port"); + gdev->dev.vnc.port = get_attr_value(child, "port"); } } else { @@ -565,7 +565,7 @@ if (STREQC(gdev->type, "vnc")) ret = asprintf(&vdev->id, "%s", gdev->type); else - ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->port); + ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->dev.vnc.port); if (ret == -1) { CU_DEBUG("Failed to create graphics is string"); @@ -806,10 +806,10 @@ DUP_FIELD(dev, _dev, dev.emu.path); } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { DUP_FIELD(dev, _dev, dev.graphics.type); - DUP_FIELD(dev, _dev, dev.graphics.port); - DUP_FIELD(dev, _dev, dev.graphics.host); - DUP_FIELD(dev, _dev, dev.graphics.keymap); - DUP_FIELD(dev, _dev, dev.graphics.passwd); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.host); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.port); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.keymap); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.passwd); } else if (dev->type == CIM_RES_TYPE_INPUT) { DUP_FIELD(dev, _dev, dev.input.type); DUP_FIELD(dev, _dev, dev.input.bus); diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Jul 25 13:14:22 2011 -0700 +++ b/libxkutil/device_parsing.h Mon Jul 25 19:39:08 2011 +0800 @@ -84,14 +84,28 @@ char *path; }; -struct graphics_device { - char *type; +//vnc_device must be larger or equal than sdl_device +struct vnc_device { char *port; char *host; char *keymap; char *passwd; }; +struct sdl_device { + char *display; + char *xauth; + char *fullscreen; +}; + +struct graphics_device { + char *type; + union { + struct vnc_device vnc; + struct sdl_device sdl; + } dev; +}; + struct input_device { char *type; char *bus; diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/xml_parse_test.c --- a/libxkutil/xml_parse_test.c Mon Jul 25 13:14:22 2011 -0700 +++ b/libxkutil/xml_parse_test.c Mon Jul 25 19:39:08 2011 +0800 @@ -116,7 +116,7 @@ FILE *d) { print_value(d, "Graphics Type", dev->dev.graphics.type); - print_value(d, "Graphics Port", dev->dev.graphics.port); + print_value(d, "Graphics Port", dev->dev.graphics.dev.vnc.port); } static void print_devices(struct domain *dominfo, diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Mon Jul 25 13:14:22 2011 -0700 +++ b/libxkutil/xmlgen.c Mon Jul 25 19:39:08 2011 +0800 @@ -424,22 +424,22 @@ if (STREQC(dev->type, "sdl")) return NULL; - if (dev->port) { - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); - if (STREQC(dev->port, "-1")) + if (dev->dev.vnc.port) { + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); + if (STREQC(dev->dev.vnc.port, "-1")) xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes"); else xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no"); } - if (dev->host) - xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); + if (dev->dev.vnc.host) + xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->dev.vnc.host); - if (dev->passwd) - xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd); + if (dev->dev.vnc.passwd) + xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->dev.vnc.passwd); - if (dev->keymap) - xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); + if (dev->dev.vnc.keymap) + xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->dev.vnc.keymap); return NULL; } @@ -459,16 +459,16 @@ tmp = xmlNewChild(pty, NULL, BAD_CAST "source", NULL); if (tmp == NULL) return XML_ERROR; - - if(dev->host) - xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host); + + if(dev->dev.vnc.host) + xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host); tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL); if (tmp == NULL) return XML_ERROR; - - if(dev->port) - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); + + if(dev->dev.vnc.port) + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); return NULL; } diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Mon Jul 25 13:14:22 2011 -0700 +++ b/src/Virt_ComputerSystem.c Mon Jul 25 19:39:08 2011 +0800 @@ -104,7 +104,7 @@ "Virtual System (Console on %s://%s:%s)", domain->dev_graphics[0].dev.graphics.type, host, - domain->dev_graphics[0].dev.graphics.port); + domain->dev_graphics[0].dev.graphics.dev.vnc.port); else ret = asprintf(&cap, "Virtual System (No console)"); diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_Device.c --- a/src/Virt_Device.c Mon Jul 25 13:14:22 2011 -0700 +++ b/src/Virt_Device.c Mon Jul 25 19:39:08 2011 +0800 @@ -194,8 +194,8 @@ else rc = asprintf(&vp_str, "%s/%s:%s", dev->type, - dev->host, - dev->port); + dev->dev.vnc.host, + dev->dev.vnc.port); if (rc == -1) return 0; diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_KVMRedirectionSAP.c --- a/src/Virt_KVMRedirectionSAP.c Mon Jul 25 13:14:22 2011 -0700 +++ b/src/Virt_KVMRedirectionSAP.c Mon Jul 25 19:39:08 2011 +0800 @@ -366,7 +366,7 @@ continue; } - ret = sscanf(dominfo->dev_graphics->dev.graphics.port, + ret = sscanf(dominfo->dev_graphics->dev.graphics.dev.vnc.port, "%d", &lport); if (ret != 1) { diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_RASD.c --- a/src/Virt_RASD.c Mon Jul 25 13:14:22 2011 -0700 +++ b/src/Virt_RASD.c Mon Jul 25 19:39:08 2011 +0800 @@ -481,9 +481,9 @@ rc = asprintf(&addr_str, "%s", dev->dev.graphics.type); else { rc = asprintf(&addr_str, - "%s:%s", - dev->dev.graphics.host, - dev->dev.graphics.port); + "%s:%s", + dev->dev.graphics.dev.vnc.host, + dev->dev.graphics.dev.vnc.port); } CU_DEBUG("graphics Address = %s", addr_str); @@ -496,7 +496,7 @@ if (STREQC(dev->dev.graphics.type, "vnc")) { CMSetProperty(inst, "KeyMap", - (CMPIValue *)dev->dev.graphics.keymap, CMPI_chars); + (CMPIValue *)dev->dev.graphics.dev.vnc.keymap, CMPI_chars); conn = connect_by_classname(_BROKER, classname, &s); if (conn == NULL) @@ -511,7 +511,8 @@ goto out; } - if (dev->dev.graphics.passwd && strlen(dev->dev.graphics.passwd)) { + if (dev->dev.graphics.dev.vnc.passwd && + strlen(dev->dev.graphics.dev.vnc.passwd)) { CU_DEBUG("has password"); CMSetProperty(inst, "Password", (CMPIValue *)"********", CMPI_chars); diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Jul 25 13:14:22 2011 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Mon Jul 25 19:39:08 2011 +0800 @@ -370,10 +370,10 @@ } domain->dev_graphics->dev.graphics.type = strdup("vnc"); - domain->dev_graphics->dev.graphics.port = strdup("-1"); - domain->dev_graphics->dev.graphics.host = strdup("127.0.0.1"); - domain->dev_graphics->dev.graphics.keymap = strdup("en-us"); - domain->dev_graphics->dev.graphics.passwd = NULL; + domain->dev_graphics->dev.graphics.dev.vnc.port = strdup("-1"); + domain->dev_graphics->dev.graphics.dev.vnc.host = strdup("127.0.0.1"); + domain->dev_graphics->dev.graphics.dev.vnc.keymap = strdup("en-us"); + domain->dev_graphics->dev.graphics.dev.vnc.passwd = NULL; domain->dev_graphics_ct = 1; return true; @@ -1129,24 +1129,24 @@ } ret = parse_vnc_address(val, - &dev->dev.graphics.host, - &dev->dev.graphics.port); + &dev->dev.graphics.dev.vnc.host, + &dev->dev.graphics.dev.vnc.port); if (ret != 1) { msg = "GraphicsRASD field Address not valid"; goto out; } if (cu_get_str_prop(inst, "KeyMap", &val) != CMPI_RC_OK) - dev->dev.graphics.keymap = strdup("en-us"); + dev->dev.graphics.dev.vnc.keymap = strdup("en-us"); else - dev->dev.graphics.keymap = strdup(val); + dev->dev.graphics.dev.vnc.keymap = strdup(val); if (cu_get_str_prop(inst, "Password", &val) != CMPI_RC_OK) { CU_DEBUG("vnc password is not set"); - dev->dev.graphics.passwd = NULL; + dev->dev.graphics.dev.vnc.passwd = NULL; } else { CU_DEBUG("vnc password is set"); - dev->dev.graphics.passwd = strdup(val); + dev->dev.graphics.dev.vnc.passwd = strdup(val); } } else if (STREQC(dev->dev.graphics.type, "console") || @@ -1157,8 +1157,8 @@ } ret = parse_console_address(val, - &dev->dev.graphics.host, - &dev->dev.graphics.port); + &dev->dev.graphics.dev.vnc.host, + &dev->dev.graphics.dev.vnc.port); if (ret != 1) { msg = "GraphicsRASD field Address not valid"; goto out; @@ -1175,7 +1175,7 @@ ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); else ret = asprintf(&dev->id, "%s:%s", - dev->dev.graphics.type, dev->dev.graphics.port); + dev->dev.graphics.type, dev->dev.graphics.dev.vnc.port); if (ret == -1) { msg = "Failed to create graphics is string"; From snmishra at us.ibm.com Wed Jul 27 20:56:53 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Wed, 27 Jul 2011 13:56:53 -0700 Subject: [Libvirt-cim] [PATCH] New entry "poolid" was not getting DUPed Message-ID: <5dc300d4dfd7b9741a60.1311800213@elm3b151.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1311797923 25200 # Node ID 5dc300d4dfd7b9741a6086e4e5b8da632bcdcd2d # Parent 0f42cab9c45c53cc13407b16418399ed8ed4a026 New entry "poolid" was not getting DUPed. A recent patch added support for network poolid, but missed to add DUP for it. This patch fixes the issue. Signed-off-by: Sharad Mishra diff -r 0f42cab9c45c -r 5dc300d4dfd7 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Jul 25 13:14:22 2011 -0700 +++ b/libxkutil/device_parsing.c Wed Jul 27 13:18:43 2011 -0700 @@ -775,6 +775,7 @@ DUP_FIELD(dev, _dev, dev.net.type); DUP_FIELD(dev, _dev, dev.net.source); DUP_FIELD(dev, _dev, dev.net.model); + DUP_FIELD(dev, _dev, dev.net.poolid); DUP_FIELD(dev, _dev, dev.net.device); DUP_FIELD(dev, _dev, dev.net.net_mode); DUP_FIELD(dev, _dev, dev.net.filter_ref); From eblima at linux.vnet.ibm.com Thu Jul 28 17:54:43 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Thu, 28 Jul 2011 14:54:43 -0300 Subject: [Libvirt-cim] [PATCH] New entry "poolid" was not getting DUPed In-Reply-To: <5dc300d4dfd7b9741a60.1311800213@elm3b151.beaverton.ibm.com> References: <5dc300d4dfd7b9741a60.1311800213@elm3b151.beaverton.ibm.com> Message-ID: <4E31A263.5070500@linux.vnet.ibm.com> On 07/27/2011 05:56 PM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1311797923 25200 > # Node ID 5dc300d4dfd7b9741a6086e4e5b8da632bcdcd2d > # Parent 0f42cab9c45c53cc13407b16418399ed8ed4a026 > New entry "poolid" was not getting DUPed. > > A recent patch added support for network poolid, > but missed to add DUP for it. This patch fixes the > issue. > > Signed-off-by: Sharad Mishra > > diff -r 0f42cab9c45c -r 5dc300d4dfd7 libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Mon Jul 25 13:14:22 2011 -0700 > +++ b/libxkutil/device_parsing.c Wed Jul 27 13:18:43 2011 -0700 > @@ -775,6 +775,7 @@ > DUP_FIELD(dev, _dev, dev.net.type); > DUP_FIELD(dev, _dev, dev.net.source); > DUP_FIELD(dev, _dev, dev.net.model); > + DUP_FIELD(dev, _dev, dev.net.poolid); > DUP_FIELD(dev, _dev, dev.net.device); > DUP_FIELD(dev, _dev, dev.net.net_mode); > DUP_FIELD(dev, _dev, dev.net.filter_ref); > ACK -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From snmishra at us.ibm.com Thu Jul 28 15:23:15 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Thu, 28 Jul 2011 08:23:15 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] Update RASDIndication test to use "vnc" instead of "graphics" Message-ID: <3c23103a2ca19d6cf66d.1311866595@elm3b151.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1311864875 25200 # Node ID 3c23103a2ca19d6cf66d84a7d87f4dd93e2d609f # Parent 3bc1a0fc5683d705c022014364cacf6d5860ba28 [TEST] Update RASDIndication test to use "vnc" instead of "graphics" Graphics RASDs now include support for serial/consoel devices, which includes support for unqiue InstanceIDs. This patch updates the test to look for /vnc where is used to just look for graphics Signed-off-by: Sharad Mishra diff -r 3bc1a0fc5683 -r 3c23103a2ca1 suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py --- a/suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py Tue Jul 12 16:02:27 2011 -0300 +++ b/suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py Thu Jul 28 07:54:35 2011 -0700 @@ -108,7 +108,7 @@ elif ind_name == 'delete': cn = 'GraphicsResourceAllocationSettingData' - inst_id = '%s/%s' % (test_dom, "graphics") + inst_id = '%s/%s' % (test_dom, "vnc") classname = get_typed_class(virt, cn) nrasd = get_rasd_rec(virt, cn, s_sysname, inst_id) From eblima at linux.vnet.ibm.com Thu Jul 28 18:24:24 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Thu, 28 Jul 2011 15:24:24 -0300 Subject: [Libvirt-cim] [PATCH] (#3) made the graphic structure as union In-Reply-To: <792db1a6ead075375fad.1311728499@localhost6.localdomain6> References: <792db1a6ead075375fad.1311728499@localhost6.localdomain6> Message-ID: <4E31A958.3070001@linux.vnet.ibm.com> On 07/26/2011 10:01 PM, Wayne Xia wrote: > # HG changeset patch > # User Wayne Xia > # Date 1311593948 -28800 > # Node ID 792db1a6ead075375fad4a7d22143a0f978b5e48 > # Parent 0f42cab9c45c53cc13407b16418399ed8ed4a026 > (#3) made the graphic structure as union > > These change were made to allow SDL device properties added more clearly > > Signed-off-by: Wayne Xia (Wayne) > > diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Mon Jul 25 13:14:22 2011 -0700 > +++ b/libxkutil/device_parsing.c Mon Jul 25 19:39:08 2011 +0800 > @@ -91,10 +91,10 @@ > static void cleanup_graphics_device(struct graphics_device *dev) > { > free(dev->type); > - free(dev->port); > - free(dev->host); > - free(dev->keymap); > - free(dev->passwd); > + free(dev->dev.vnc.port); > + free(dev->dev.vnc.host); > + free(dev->dev.vnc.keymap); > + free(dev->dev.vnc.passwd); > } > Hi Wayne, sorry for the delay. I know that the compiler would take care of this, but just to follow the 'convention' present in other places of the code, whenever you have an union, please provide a dedicate cleanup function for each structure. You can take a look on pool_parsing for example: if (dev->type == sdl) clenup_sdl_device(); else if (dev->type = vnc) cleanup_vnc_device(); Also, it won't show in this email but I see a few places where your patch introduces trailing whitespaces. If you happen to use vim, you can make it show them with the following setting in your vimrc: highlight WhitespaceEOL ctermbg=red guibg=red match WhitespaceEOL /\s\+$\| \+\ze\t/ With that you will notice there are many other places in the code which will get highlighted. Yeah, not everyone pay attention to those details, but I particularly like to keep the code clean. If you are changing a line with trailing whitespaces, feel free to change it and leave others as is. Hopefully we will fix that someday. > static void cleanup_input_device(struct input_device *dev) > @@ -530,12 +530,12 @@ > CU_DEBUG("graphics device type = %s", gdev->type); > > if (STREQC(gdev->type, "vnc")) { > - gdev->port = get_attr_value(node, "port"); > - gdev->host = get_attr_value(node, "listen"); > - gdev->keymap = get_attr_value(node, "keymap"); > - gdev->passwd = get_attr_value(node, "passwd"); > + gdev->dev.vnc.port = get_attr_value(node, "port"); > + gdev->dev.vnc.host = get_attr_value(node, "listen"); > + gdev->dev.vnc.keymap = get_attr_value(node, "keymap"); > + gdev->dev.vnc.passwd = get_attr_value(node, "passwd"); > > - if (gdev->port == NULL || gdev->host == NULL) > + if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) > goto err; > } > else if (STREQC(gdev->type, "pty")) { > @@ -550,9 +550,9 @@ > for (child = node->children; child != NULL; > child = child->next) { > if (XSTREQ(child->name, "source")) > - gdev->host = get_attr_value(child, "path"); > + gdev->dev.vnc.host = get_attr_value(child, "path"); > else if (XSTREQ(child->name, "target")) > - gdev->port = get_attr_value(child, "port"); > + gdev->dev.vnc.port = get_attr_value(child, "port"); > } > } > else { > @@ -565,7 +565,7 @@ > if (STREQC(gdev->type, "vnc")) > ret = asprintf(&vdev->id, "%s", gdev->type); > else > - ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->port); > + ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->dev.vnc.port); > > if (ret == -1) { > CU_DEBUG("Failed to create graphics is string"); > @@ -806,10 +806,10 @@ > DUP_FIELD(dev, _dev, dev.emu.path); > } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { > DUP_FIELD(dev, _dev, dev.graphics.type); > - DUP_FIELD(dev, _dev, dev.graphics.port); > - DUP_FIELD(dev, _dev, dev.graphics.host); > - DUP_FIELD(dev, _dev, dev.graphics.keymap); > - DUP_FIELD(dev, _dev, dev.graphics.passwd); > + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.host); > + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.port); > + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.keymap); > + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.passwd); > } else if (dev->type == CIM_RES_TYPE_INPUT) { > DUP_FIELD(dev, _dev, dev.input.type); > DUP_FIELD(dev, _dev, dev.input.bus); > diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/device_parsing.h > --- a/libxkutil/device_parsing.h Mon Jul 25 13:14:22 2011 -0700 > +++ b/libxkutil/device_parsing.h Mon Jul 25 19:39:08 2011 +0800 > @@ -84,14 +84,28 @@ > char *path; > }; > > -struct graphics_device { > - char *type; > +//vnc_device must be larger or equal than sdl_device > +struct vnc_device { > char *port; > char *host; > char *keymap; > char *passwd; > }; > > +struct sdl_device { > + char *display; > + char *xauth; > + char *fullscreen; > +}; > + > +struct graphics_device { > + char *type; > + union { > + struct vnc_device vnc; > + struct sdl_device sdl; > + } dev; > +}; > + > struct input_device { > char *type; > char *bus; > diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/xml_parse_test.c > --- a/libxkutil/xml_parse_test.c Mon Jul 25 13:14:22 2011 -0700 > +++ b/libxkutil/xml_parse_test.c Mon Jul 25 19:39:08 2011 +0800 > @@ -116,7 +116,7 @@ > FILE *d) > { > print_value(d, "Graphics Type", dev->dev.graphics.type); > - print_value(d, "Graphics Port", dev->dev.graphics.port); > + print_value(d, "Graphics Port", dev->dev.graphics.dev.vnc.port); > } > > static void print_devices(struct domain *dominfo, > diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/xmlgen.c > --- a/libxkutil/xmlgen.c Mon Jul 25 13:14:22 2011 -0700 > +++ b/libxkutil/xmlgen.c Mon Jul 25 19:39:08 2011 +0800 > @@ -424,22 +424,22 @@ > if (STREQC(dev->type, "sdl")) > return NULL; > > - if (dev->port) { > - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); > - if (STREQC(dev->port, "-1")) > + if (dev->dev.vnc.port) { > + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); > + if (STREQC(dev->dev.vnc.port, "-1")) > xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes"); > else > xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no"); > } > > - if (dev->host) > - xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); > + if (dev->dev.vnc.host) > + xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->dev.vnc.host); > > - if (dev->passwd) > - xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd); > + if (dev->dev.vnc.passwd) > + xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->dev.vnc.passwd); > > - if (dev->keymap) > - xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); > + if (dev->dev.vnc.keymap) > + xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->dev.vnc.keymap); > > return NULL; > } > @@ -459,16 +459,16 @@ > tmp = xmlNewChild(pty, NULL, BAD_CAST "source", NULL); > if (tmp == NULL) > return XML_ERROR; > - > - if(dev->host) > - xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host); > + > + if(dev->dev.vnc.host) > + xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host); > > tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL); > if (tmp == NULL) > return XML_ERROR; > - > - if(dev->port) > - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); > + > + if(dev->dev.vnc.port) > + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); > > return NULL; > } > diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_ComputerSystem.c > --- a/src/Virt_ComputerSystem.c Mon Jul 25 13:14:22 2011 -0700 > +++ b/src/Virt_ComputerSystem.c Mon Jul 25 19:39:08 2011 +0800 > @@ -104,7 +104,7 @@ > "Virtual System (Console on %s://%s:%s)", > domain->dev_graphics[0].dev.graphics.type, > host, > - domain->dev_graphics[0].dev.graphics.port); > + domain->dev_graphics[0].dev.graphics.dev.vnc.port); > else > ret = asprintf(&cap, > "Virtual System (No console)"); > diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_Device.c > --- a/src/Virt_Device.c Mon Jul 25 13:14:22 2011 -0700 > +++ b/src/Virt_Device.c Mon Jul 25 19:39:08 2011 +0800 > @@ -194,8 +194,8 @@ > else > rc = asprintf(&vp_str, "%s/%s:%s", > dev->type, > - dev->host, > - dev->port); > + dev->dev.vnc.host, > + dev->dev.vnc.port); > if (rc == -1) > return 0; > > diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_KVMRedirectionSAP.c > --- a/src/Virt_KVMRedirectionSAP.c Mon Jul 25 13:14:22 2011 -0700 > +++ b/src/Virt_KVMRedirectionSAP.c Mon Jul 25 19:39:08 2011 +0800 > @@ -366,7 +366,7 @@ > continue; > } > > - ret = sscanf(dominfo->dev_graphics->dev.graphics.port, > + ret = sscanf(dominfo->dev_graphics->dev.graphics.dev.vnc.port, > "%d", > &lport); > if (ret != 1) { > diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_RASD.c > --- a/src/Virt_RASD.c Mon Jul 25 13:14:22 2011 -0700 > +++ b/src/Virt_RASD.c Mon Jul 25 19:39:08 2011 +0800 > @@ -481,9 +481,9 @@ > rc = asprintf(&addr_str, "%s", dev->dev.graphics.type); > else { > rc = asprintf(&addr_str, > - "%s:%s", > - dev->dev.graphics.host, > - dev->dev.graphics.port); > + "%s:%s", > + dev->dev.graphics.dev.vnc.host, > + dev->dev.graphics.dev.vnc.port); > } > > CU_DEBUG("graphics Address = %s", addr_str); > @@ -496,7 +496,7 @@ > > if (STREQC(dev->dev.graphics.type, "vnc")) { > CMSetProperty(inst, "KeyMap", > - (CMPIValue *)dev->dev.graphics.keymap, CMPI_chars); > + (CMPIValue *)dev->dev.graphics.dev.vnc.keymap, CMPI_chars); > > conn = connect_by_classname(_BROKER, classname,&s); > if (conn == NULL) > @@ -511,7 +511,8 @@ > goto out; > } > > - if (dev->dev.graphics.passwd&& strlen(dev->dev.graphics.passwd)) { > + if (dev->dev.graphics.dev.vnc.passwd&& > + strlen(dev->dev.graphics.dev.vnc.passwd)) { > CU_DEBUG("has password"); > CMSetProperty(inst, "Password", > (CMPIValue *)"********", CMPI_chars); > diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c Mon Jul 25 13:14:22 2011 -0700 > +++ b/src/Virt_VirtualSystemManagementService.c Mon Jul 25 19:39:08 2011 +0800 > @@ -370,10 +370,10 @@ > } > > domain->dev_graphics->dev.graphics.type = strdup("vnc"); > - domain->dev_graphics->dev.graphics.port = strdup("-1"); > - domain->dev_graphics->dev.graphics.host = strdup("127.0.0.1"); > - domain->dev_graphics->dev.graphics.keymap = strdup("en-us"); > - domain->dev_graphics->dev.graphics.passwd = NULL; > + domain->dev_graphics->dev.graphics.dev.vnc.port = strdup("-1"); > + domain->dev_graphics->dev.graphics.dev.vnc.host = strdup("127.0.0.1"); > + domain->dev_graphics->dev.graphics.dev.vnc.keymap = strdup("en-us"); > + domain->dev_graphics->dev.graphics.dev.vnc.passwd = NULL; > domain->dev_graphics_ct = 1; > > return true; > @@ -1129,24 +1129,24 @@ > } > > ret = parse_vnc_address(val, > -&dev->dev.graphics.host, > -&dev->dev.graphics.port); > +&dev->dev.graphics.dev.vnc.host, > +&dev->dev.graphics.dev.vnc.port); > if (ret != 1) { > msg = "GraphicsRASD field Address not valid"; > goto out; > } > > if (cu_get_str_prop(inst, "KeyMap",&val) != CMPI_RC_OK) > - dev->dev.graphics.keymap = strdup("en-us"); > + dev->dev.graphics.dev.vnc.keymap = strdup("en-us"); > else > - dev->dev.graphics.keymap = strdup(val); > + dev->dev.graphics.dev.vnc.keymap = strdup(val); > > if (cu_get_str_prop(inst, "Password",&val) != CMPI_RC_OK) { > CU_DEBUG("vnc password is not set"); > - dev->dev.graphics.passwd = NULL; > + dev->dev.graphics.dev.vnc.passwd = NULL; > } else { > CU_DEBUG("vnc password is set"); > - dev->dev.graphics.passwd = strdup(val); > + dev->dev.graphics.dev.vnc.passwd = strdup(val); > } > } > else if (STREQC(dev->dev.graphics.type, "console") || > @@ -1157,8 +1157,8 @@ > } > > ret = parse_console_address(val, > -&dev->dev.graphics.host, > -&dev->dev.graphics.port); > +&dev->dev.graphics.dev.vnc.host, > +&dev->dev.graphics.dev.vnc.port); > if (ret != 1) { > msg = "GraphicsRASD field Address not valid"; > goto out; > @@ -1175,7 +1175,7 @@ > ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); > else > ret = asprintf(&dev->id, "%s:%s", > - dev->dev.graphics.type, dev->dev.graphics.port); > + dev->dev.graphics.type, dev->dev.graphics.dev.vnc.port); > > if (ret == -1) { > msg = "Failed to create graphics is string"; > I have applied and tested this patch. It works fine, please provide that small fix in the cleanup function and it will be ready. Best regards, -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From eblima at linux.vnet.ibm.com Thu Jul 28 18:25:38 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Thu, 28 Jul 2011 15:25:38 -0300 Subject: [Libvirt-cim] [PATCH] [TEST] Update RASDIndication test to use "vnc" instead of "graphics" In-Reply-To: <3c23103a2ca19d6cf66d.1311866595@elm3b151.beaverton.ibm.com> References: <3c23103a2ca19d6cf66d.1311866595@elm3b151.beaverton.ibm.com> Message-ID: <4E31A9A2.6070207@linux.vnet.ibm.com> On 07/28/2011 12:23 PM, Sharad Mishra wrote: > # HG changeset patch > # User Sharad Mishra > # Date 1311864875 25200 > # Node ID 3c23103a2ca19d6cf66d84a7d87f4dd93e2d609f > # Parent 3bc1a0fc5683d705c022014364cacf6d5860ba28 > [TEST] Update RASDIndication test to use "vnc" instead of "graphics" > > Graphics RASDs now include support for serial/consoel devices, which *console > includes support for unqiue InstanceIDs. This patch updates the test *unique > to look for/vnc where is used to just look for graphics > > Signed-off-by: Sharad Mishra > > diff -r 3bc1a0fc5683 -r 3c23103a2ca1 suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py > --- a/suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py Tue Jul 12 16:02:27 2011 -0300 > +++ b/suites/libvirt-cim/cimtest/RASDIndications/02_guest_add_mod_rem_rasd_ind.py Thu Jul 28 07:54:35 2011 -0700 > @@ -108,7 +108,7 @@ > > elif ind_name == 'delete': > cn = 'GraphicsResourceAllocationSettingData' > - inst_id = '%s/%s' % (test_dom, "graphics") > + inst_id = '%s/%s' % (test_dom, "vnc") > classname = get_typed_class(virt, cn) > nrasd = get_rasd_rec(virt, cn, s_sysname, inst_id) > ACK -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From eblima at linux.vnet.ibm.com Thu Jul 28 18:45:50 2011 From: eblima at linux.vnet.ibm.com (Eduardo Lima (Etrunko)) Date: Thu, 28 Jul 2011 15:45:50 -0300 Subject: [Libvirt-cim] [PATCH] (#3) add sdl frame buffer support In-Reply-To: References: Message-ID: <4E31AE5E.8000200@linux.vnet.ibm.com> On 07/26/2011 10:01 PM, Wayne Xia wrote: > # HG changeset patch > # User Wayne Xia > # Date 1311670971 -28800 > # Node ID d0bb7e93d02d3bd55d9b984165db0265c9865462 > # Parent 792db1a6ead075375fad4a7d22143a0f978b5e48 > (#3) add sdl frame buffer support. > > Now libvirt still supports sdl frame buffer, and it may take three > parameters: display,xauth,fullscreen. This patch enable the libvirt-cim > to accept these configuration and pass them in XML define to let > libvirt know about it. Exposed interface could be found in the file > ResourceAllocationSettingData.mof. > https://bugzilla.linux.ibm.com/show_bug.cgi?id=71347 > > Signed-off-by: Wayne Xia (Wayne) > > diff -r 792db1a6ead0 -r d0bb7e93d02d libxkutil/device_parsing.c > --- a/libxkutil/device_parsing.c Mon Jul 25 19:39:08 2011 +0800 > +++ b/libxkutil/device_parsing.c Tue Jul 26 17:02:51 2011 +0800 > @@ -538,6 +538,11 @@ > if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) > goto err; > } > + else if (STREQC(gdev->type, "sdl")) { > + gdev->dev.sdl.display = get_attr_value(node, "display"); > + gdev->dev.sdl.xauth = get_attr_value(node, "xauth"); > + gdev->dev.sdl.fullscreen = get_attr_value(node, "fullscreen"); > + } > else if (STREQC(gdev->type, "pty")) { > if (node->name == NULL) > goto err; > diff -r 792db1a6ead0 -r d0bb7e93d02d libxkutil/xmlgen.c > --- a/libxkutil/xmlgen.c Mon Jul 25 19:39:08 2011 +0800 > +++ b/libxkutil/xmlgen.c Tue Jul 26 17:02:51 2011 +0800 > @@ -421,8 +421,21 @@ > > xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); > > - if (STREQC(dev->type, "sdl")) > - return NULL; > + if (STREQC(dev->type, "sdl")) { > + if (dev->dev.sdl.display) { > + xmlNewProp(tmp, BAD_CAST "display", > + BAD_CAST dev->dev.sdl.display); > + } > + if (dev->dev.sdl.xauth) { > + xmlNewProp(tmp, BAD_CAST "xauth", > + BAD_CAST dev->dev.sdl.xauth); > + } > + if (dev->dev.sdl.fullscreen) { > + xmlNewProp(tmp, BAD_CAST "fullscreen", > + BAD_CAST dev->dev.sdl.fullscreen); > + } > + return NULL; > + } > > if (dev->dev.vnc.port) { > xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); > diff -r 792db1a6ead0 -r d0bb7e93d02d schema/ResourceAllocationSettingData.mof > --- a/schema/ResourceAllocationSettingData.mof Mon Jul 25 19:39:08 2011 +0800 > +++ b/schema/ResourceAllocationSettingData.mof Tue Jul 26 17:02:51 2011 +0800 > @@ -219,7 +219,9 @@ > [Description ("If ResourceSubType is 'vnc', this is a VNC Address. " > "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If ResourceSubType " > "is 'console', this is a character device path in " > - "path:port format (e.g., '/dev/pts/3:0'\)")] > + "path:port format (e.g., '/dev/pts/3:0'\) " > + "if ResourceSubType is 'sdl', this is a combination of its params as " > + "xauth:display (e.g., '/root/.Xauthority::0'\)")] > string Address; > > [Description ("Keyboard keymapping")] > @@ -228,7 +230,8 @@ > [Description ("VNC password")] > string Password; > > - [Description ("Is IPv6 only addressing is to be used")] > + [Description ("Is IPv6 only addressing is to be used." > + "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")] > boolean IsIPv6Only; > }; Would be nice to hear comments about this 'change' in the schema from the CIM experts. > > diff -r 792db1a6ead0 -r d0bb7e93d02d src/Virt_VirtualSystemManagementService.c > --- a/src/Virt_VirtualSystemManagementService.c Mon Jul 25 19:39:08 2011 +0800 > +++ b/src/Virt_VirtualSystemManagementService.c Tue Jul 26 17:02:51 2011 +0800 > @@ -1060,6 +1060,52 @@ > return ret; > } > > +static int parse_sdl_address(const char *id, > + char **display, > + char **xauth) > +{ > + int ret; > + char *tmp_display = NULL; > + char *tmp_xauth = NULL; > + > + CU_DEBUG("Entering parse_sdl_address, address is %s", id); > + > + ret = sscanf(id, "%a[^:]:%as",&tmp_xauth,&tmp_display); > + > + if (ret<= 0) { > + ret = sscanf(id, ":%as",&tmp_display); > + if (ret<= 0) { > + if (STREQC(id, ":")) { > + /* do nothing, it is empty */ > + } > + else { > + ret = 0; > + goto out; > + } > + } > + } > + > + if (display) { > + if (tmp_display == NULL) > + *display = NULL; > + else > + *display = strdup(tmp_display); > + } > + if (xauth) { > + if (tmp_xauth == NULL) > + *xauth = NULL; > + else > + *xauth = strdup(tmp_xauth); > + } > + ret = 1; > + > + out: > + CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s", > + *display, *xauth); > + > + return ret; > +} > + > static int parse_vnc_address(const char *id, > char **ip, > char **port) > @@ -1163,6 +1209,30 @@ > msg = "GraphicsRASD field Address not valid"; > goto out; > } > + } > + else if (STREQC(dev->dev.graphics.type, "sdl")) { > + if (cu_get_str_prop(inst, "Address",&val) != CMPI_RC_OK) { > + CU_DEBUG("sdl graphics Address empty, using default"); > + dev->dev.graphics.dev.sdl.display = NULL; > + dev->dev.graphics.dev.sdl.xauth = NULL; > + } > + else { > + ret = parse_sdl_address(val, > +&dev->dev.graphics.dev.sdl.display, > +&dev->dev.graphics.dev.sdl.xauth); > + if (ret != 1) { > + msg = "GraphicsRASD sdl Address not valid"; > + goto out; > + } > + } > + dev->dev.graphics.dev.sdl.fullscreen = NULL; > + if (cu_get_bool_prop(inst, "IsIPV6Only",&ipv6) == > + CMPI_RC_OK) { > + if (ipv6) > + dev->dev.graphics.dev.sdl.fullscreen = strdup("yes"); > + else > + dev->dev.graphics.dev.sdl.fullscreen = strdup("no"); > + } > } else { > CU_DEBUG("Unsupported graphics type %s", > dev->dev.graphics.type); > @@ -1171,7 +1241,8 @@ > } > > free(dev->id); > - if (STREQC(dev->dev.graphics.type, "vnc")) > + if ((STREQC(dev->dev.graphics.type, "vnc"))|| > + (STREQC(dev->dev.graphics.type, "sdl"))) > ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); > else > ret = asprintf(&dev->id, "%s:%s", > I think this one looks good, but as it depends on the previous "made graphics structure union", it should wait until the former gets accepted. -- Eduardo de Barros Lima Software Engineer, Open Virtualization Linux Technology Center - IBM/Brazil eblima at br.ibm.com From snmishra at us.ibm.com Thu Jul 28 18:36:27 2011 From: snmishra at us.ibm.com (Sharad Mishra) Date: Thu, 28 Jul 2011 11:36:27 -0700 Subject: [Libvirt-cim] [PATCH] [TEST] Reduce the length of bridge name Message-ID: <8c23ed99a218f1d1eea5.1311878187@elm3b151.beaverton.ibm.com> # HG changeset patch # User Sharad Mishra # Date 1311878184 25200 # Node ID 8c23ed99a218f1d1eea5c662b2fa3c211fe6d531 # Parent 3bc1a0fc5683d705c022014364cacf6d5860ba28 [TEST] Reduce the length of bridge name. Lately I have seen this (VirtualSystemManagementService - 06_addresource.py) test fails with following error - # virsh -c qemu:///system net-create /home/net.xml error: Failed to create network from /home/net.xml error: cannot create dummy tap device 'testbridge55-nic' to set mac address on bridge 'testbridge55': Invalid argument Reducing the size of bridge name fixed this issue. I looked on the net but could not find more info on when this behaviour changed in libvirt. Signed-off-by: Sharad Mishra diff -r 3bc1a0fc5683 -r 8c23ed99a218 suites/libvirt-cim/lib/XenKvmLib/const.py --- a/suites/libvirt-cim/lib/XenKvmLib/const.py Tue Jul 12 16:02:27 2011 -0300 +++ b/suites/libvirt-cim/lib/XenKvmLib/const.py Thu Jul 28 11:36:24 2011 -0700 @@ -58,7 +58,7 @@ # vxml.NetXML -default_bridge_name = 'testbridge' +default_bridge_name = 'testbr' default_network_name = 'cimtest-networkpool' default_net_type = 'network' From xiawenc at linux.vnet.ibm.com Fri Jul 29 06:02:01 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Fri, 29 Jul 2011 14:02:01 +0800 Subject: [Libvirt-cim] [PATCH] (#3) made the graphic structure as union In-Reply-To: <4E31A958.3070001@linux.vnet.ibm.com> References: <792db1a6ead075375fad.1311728499@localhost6.localdomain6> <4E31A958.3070001@linux.vnet.ibm.com> Message-ID: <4E324CD9.3090802@linux.vnet.ibm.com> ? 2011-7-29 2:24, Eduardo Lima (Etrunko) ??: > On 07/26/2011 10:01 PM, Wayne Xia wrote: >> # HG changeset patch >> # User Wayne Xia >> # Date 1311593948 -28800 >> # Node ID 792db1a6ead075375fad4a7d22143a0f978b5e48 >> # Parent 0f42cab9c45c53cc13407b16418399ed8ed4a026 >> (#3) made the graphic structure as union >> >> These change were made to allow SDL device properties added more clearly >> >> Signed-off-by: Wayne Xia (Wayne) >> >> diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/device_parsing.c >> --- a/libxkutil/device_parsing.c Mon Jul 25 13:14:22 2011 -0700 >> +++ b/libxkutil/device_parsing.c Mon Jul 25 19:39:08 2011 +0800 >> @@ -91,10 +91,10 @@ >> static void cleanup_graphics_device(struct graphics_device *dev) >> { >> free(dev->type); >> - free(dev->port); >> - free(dev->host); >> - free(dev->keymap); >> - free(dev->passwd); >> + free(dev->dev.vnc.port); >> + free(dev->dev.vnc.host); >> + free(dev->dev.vnc.keymap); >> + free(dev->dev.vnc.passwd); >> } >> > > Hi Wayne, sorry for the delay. > > I know that the compiler would take care of this, but just to follow the > 'convention' present in other places of the code, whenever you have an > union, please provide a dedicate cleanup function for each structure. > You can take a look on pool_parsing for example: > > if (dev->type == sdl) > clenup_sdl_device(); > else if (dev->type = vnc) > cleanup_vnc_device(); > > Also, it won't show in this email but I see a few places where your > patch introduces trailing whitespaces. If you happen to use vim, you can > make it show them with the following setting in your vimrc: > > highlight WhitespaceEOL ctermbg=red guibg=red > match WhitespaceEOL /\s\+$\| \+\ze\t/ > > With that you will notice there are many other places in the code which > will get highlighted. Yeah, not everyone pay attention to those details, > but I particularly like to keep the code clean. If you are changing a > line with trailing whitespaces, feel free to change it and leave others > as is. Hopefully we will fix that someday. > > thanks for the tip, patch on the way >> static void cleanup_input_device(struct input_device *dev) >> @@ -530,12 +530,12 @@ >> CU_DEBUG("graphics device type = %s", gdev->type); >> >> if (STREQC(gdev->type, "vnc")) { >> - gdev->port = get_attr_value(node, "port"); >> - gdev->host = get_attr_value(node, "listen"); >> - gdev->keymap = get_attr_value(node, "keymap"); >> - gdev->passwd = get_attr_value(node, "passwd"); >> + gdev->dev.vnc.port = get_attr_value(node, "port"); >> + gdev->dev.vnc.host = get_attr_value(node, "listen"); >> + gdev->dev.vnc.keymap = get_attr_value(node, "keymap"); >> + gdev->dev.vnc.passwd = get_attr_value(node, "passwd"); >> >> - if (gdev->port == NULL || gdev->host == NULL) >> + if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) >> goto err; >> } >> else if (STREQC(gdev->type, "pty")) { >> @@ -550,9 +550,9 @@ >> for (child = node->children; child != NULL; >> child = child->next) { >> if (XSTREQ(child->name, "source")) >> - gdev->host = get_attr_value(child, "path"); >> + gdev->dev.vnc.host = get_attr_value(child, "path"); >> else if (XSTREQ(child->name, "target")) >> - gdev->port = get_attr_value(child, "port"); >> + gdev->dev.vnc.port = get_attr_value(child, "port"); >> } >> } >> else { >> @@ -565,7 +565,7 @@ >> if (STREQC(gdev->type, "vnc")) >> ret = asprintf(&vdev->id, "%s", gdev->type); >> else >> - ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->port); >> + ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->dev.vnc.port); >> >> if (ret == -1) { >> CU_DEBUG("Failed to create graphics is string"); >> @@ -806,10 +806,10 @@ >> DUP_FIELD(dev, _dev, dev.emu.path); >> } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { >> DUP_FIELD(dev, _dev, dev.graphics.type); >> - DUP_FIELD(dev, _dev, dev.graphics.port); >> - DUP_FIELD(dev, _dev, dev.graphics.host); >> - DUP_FIELD(dev, _dev, dev.graphics.keymap); >> - DUP_FIELD(dev, _dev, dev.graphics.passwd); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.host); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.port); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.keymap); >> + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.passwd); >> } else if (dev->type == CIM_RES_TYPE_INPUT) { >> DUP_FIELD(dev, _dev, dev.input.type); >> DUP_FIELD(dev, _dev, dev.input.bus); >> diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/device_parsing.h >> --- a/libxkutil/device_parsing.h Mon Jul 25 13:14:22 2011 -0700 >> +++ b/libxkutil/device_parsing.h Mon Jul 25 19:39:08 2011 +0800 >> @@ -84,14 +84,28 @@ >> char *path; >> }; >> >> -struct graphics_device { >> - char *type; >> +//vnc_device must be larger or equal than sdl_device >> +struct vnc_device { >> char *port; >> char *host; >> char *keymap; >> char *passwd; >> }; >> >> +struct sdl_device { >> + char *display; >> + char *xauth; >> + char *fullscreen; >> +}; >> + >> +struct graphics_device { >> + char *type; >> + union { >> + struct vnc_device vnc; >> + struct sdl_device sdl; >> + } dev; >> +}; >> + >> struct input_device { >> char *type; >> char *bus; >> diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/xml_parse_test.c >> --- a/libxkutil/xml_parse_test.c Mon Jul 25 13:14:22 2011 -0700 >> +++ b/libxkutil/xml_parse_test.c Mon Jul 25 19:39:08 2011 +0800 >> @@ -116,7 +116,7 @@ >> FILE *d) >> { >> print_value(d, "Graphics Type", dev->dev.graphics.type); >> - print_value(d, "Graphics Port", dev->dev.graphics.port); >> + print_value(d, "Graphics Port", dev->dev.graphics.dev.vnc.port); >> } >> >> static void print_devices(struct domain *dominfo, >> diff -r 0f42cab9c45c -r 792db1a6ead0 libxkutil/xmlgen.c >> --- a/libxkutil/xmlgen.c Mon Jul 25 13:14:22 2011 -0700 >> +++ b/libxkutil/xmlgen.c Mon Jul 25 19:39:08 2011 +0800 >> @@ -424,22 +424,22 @@ >> if (STREQC(dev->type, "sdl")) >> return NULL; >> >> - if (dev->port) { >> - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); >> - if (STREQC(dev->port, "-1")) >> + if (dev->dev.vnc.port) { >> + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); >> + if (STREQC(dev->dev.vnc.port, "-1")) >> xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes"); >> else >> xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no"); >> } >> >> - if (dev->host) >> - xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); >> + if (dev->dev.vnc.host) >> + xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->dev.vnc.host); >> >> - if (dev->passwd) >> - xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd); >> + if (dev->dev.vnc.passwd) >> + xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->dev.vnc.passwd); >> >> - if (dev->keymap) >> - xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); >> + if (dev->dev.vnc.keymap) >> + xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->dev.vnc.keymap); >> >> return NULL; >> } >> @@ -459,16 +459,16 @@ >> tmp = xmlNewChild(pty, NULL, BAD_CAST "source", NULL); >> if (tmp == NULL) >> return XML_ERROR; >> - >> - if(dev->host) >> - xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host); >> + >> + if(dev->dev.vnc.host) >> + xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host); >> >> tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL); >> if (tmp == NULL) >> return XML_ERROR; >> - >> - if(dev->port) >> - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); >> + >> + if(dev->dev.vnc.port) >> + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); >> >> return NULL; >> } >> diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_ComputerSystem.c >> --- a/src/Virt_ComputerSystem.c Mon Jul 25 13:14:22 2011 -0700 >> +++ b/src/Virt_ComputerSystem.c Mon Jul 25 19:39:08 2011 +0800 >> @@ -104,7 +104,7 @@ >> "Virtual System (Console on %s://%s:%s)", >> domain->dev_graphics[0].dev.graphics.type, >> host, >> - domain->dev_graphics[0].dev.graphics.port); >> + domain->dev_graphics[0].dev.graphics.dev.vnc.port); >> else >> ret = asprintf(&cap, >> "Virtual System (No console)"); >> diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_Device.c >> --- a/src/Virt_Device.c Mon Jul 25 13:14:22 2011 -0700 >> +++ b/src/Virt_Device.c Mon Jul 25 19:39:08 2011 +0800 >> @@ -194,8 +194,8 @@ >> else >> rc = asprintf(&vp_str, "%s/%s:%s", >> dev->type, >> - dev->host, >> - dev->port); >> + dev->dev.vnc.host, >> + dev->dev.vnc.port); >> if (rc == -1) >> return 0; >> >> diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_KVMRedirectionSAP.c >> --- a/src/Virt_KVMRedirectionSAP.c Mon Jul 25 13:14:22 2011 -0700 >> +++ b/src/Virt_KVMRedirectionSAP.c Mon Jul 25 19:39:08 2011 +0800 >> @@ -366,7 +366,7 @@ >> continue; >> } >> >> - ret = sscanf(dominfo->dev_graphics->dev.graphics.port, >> + ret = sscanf(dominfo->dev_graphics->dev.graphics.dev.vnc.port, >> "%d", >> &lport); >> if (ret != 1) { >> diff -r 0f42cab9c45c -r 792db1a6ead0 src/Virt_RASD.c >> --- a/src/Virt_RASD.c Mon Jul 25 13:14:22 2011 -0700 >> +++ b/src/Virt_RASD.c Mon Jul 25 19:39:08 2011 +0800 >> @@ -481,9 +481,9 @@ >> rc = asprintf(&addr_str, "%s", dev->dev.graphics.type); >> else { >> rc = asprintf(&addr_str, >> - "%s:%s", >> - dev->dev.graphics.host, >> - dev->dev.graphics.port); >> + "%s:%s", >> + dev->dev.graphics.dev.vnc.host, >> + dev->dev.graphics.dev.vnc.port); >> } >> >> CU_DEBUG("graphics Address = %s", addr_str); >> @@ -496,7 +496,7 @@ >> >> if (STREQC(dev->dev.graphics.type, "vnc")) { >> CMSetProperty(inst, "KeyMap", >> - (CMPIValue *)dev->dev.graphics.keymap, CMPI_chars); >> + (CMPIValue *)dev->dev.graphics.dev.vnc.keymap, CMPI_chars); >> >> conn = connect_by_classname(_BROKER, classname,&s); >> if (conn == NULL) >> @@ -511,7 +511,8 @@ >> goto out; >> } >> >> - if (dev->dev.graphics.passwd&& strlen(dev->dev.graphics.passwd)) { >> + if (dev->dev.graphics.dev.vnc.passwd&& >> + strlen(dev->dev.graphics.dev.vnc.passwd)) { >> CU_DEBUG("has password"); >> CMSetProperty(inst, "Password", >> (CMPIValue *)"********", CMPI_chars); >> diff -r 0f42cab9c45c -r 792db1a6ead0 >> src/Virt_VirtualSystemManagementService.c >> --- a/src/Virt_VirtualSystemManagementService.c Mon Jul 25 13:14:22 >> 2011 -0700 >> +++ b/src/Virt_VirtualSystemManagementService.c Mon Jul 25 19:39:08 >> 2011 +0800 >> @@ -370,10 +370,10 @@ >> } >> >> domain->dev_graphics->dev.graphics.type = strdup("vnc"); >> - domain->dev_graphics->dev.graphics.port = strdup("-1"); >> - domain->dev_graphics->dev.graphics.host = strdup("127.0.0.1"); >> - domain->dev_graphics->dev.graphics.keymap = strdup("en-us"); >> - domain->dev_graphics->dev.graphics.passwd = NULL; >> + domain->dev_graphics->dev.graphics.dev.vnc.port = strdup("-1"); >> + domain->dev_graphics->dev.graphics.dev.vnc.host = strdup("127.0.0.1"); >> + domain->dev_graphics->dev.graphics.dev.vnc.keymap = strdup("en-us"); >> + domain->dev_graphics->dev.graphics.dev.vnc.passwd = NULL; >> domain->dev_graphics_ct = 1; >> >> return true; >> @@ -1129,24 +1129,24 @@ >> } >> >> ret = parse_vnc_address(val, >> -&dev->dev.graphics.host, >> -&dev->dev.graphics.port); >> +&dev->dev.graphics.dev.vnc.host, >> +&dev->dev.graphics.dev.vnc.port); >> if (ret != 1) { >> msg = "GraphicsRASD field Address not valid"; >> goto out; >> } >> >> if (cu_get_str_prop(inst, "KeyMap",&val) != CMPI_RC_OK) >> - dev->dev.graphics.keymap = strdup("en-us"); >> + dev->dev.graphics.dev.vnc.keymap = strdup("en-us"); >> else >> - dev->dev.graphics.keymap = strdup(val); >> + dev->dev.graphics.dev.vnc.keymap = strdup(val); >> >> if (cu_get_str_prop(inst, "Password",&val) != CMPI_RC_OK) { >> CU_DEBUG("vnc password is not set"); >> - dev->dev.graphics.passwd = NULL; >> + dev->dev.graphics.dev.vnc.passwd = NULL; >> } else { >> CU_DEBUG("vnc password is set"); >> - dev->dev.graphics.passwd = strdup(val); >> + dev->dev.graphics.dev.vnc.passwd = strdup(val); >> } >> } >> else if (STREQC(dev->dev.graphics.type, "console") || >> @@ -1157,8 +1157,8 @@ >> } >> >> ret = parse_console_address(val, >> -&dev->dev.graphics.host, >> -&dev->dev.graphics.port); >> +&dev->dev.graphics.dev.vnc.host, >> +&dev->dev.graphics.dev.vnc.port); >> if (ret != 1) { >> msg = "GraphicsRASD field Address not valid"; >> goto out; >> @@ -1175,7 +1175,7 @@ >> ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); >> else >> ret = asprintf(&dev->id, "%s:%s", >> - dev->dev.graphics.type, dev->dev.graphics.port); >> + dev->dev.graphics.type, dev->dev.graphics.dev.vnc.port); >> >> if (ret == -1) { >> msg = "Failed to create graphics is string"; >> > > I have applied and tested this patch. It works fine, please provide that > small fix in the cleanup function and it will be ready. > > Best regards, > -- Best Regards Wayne Xia mail:xiawenc at linux.vnet.ibm.com tel:86-010-82450803 From xiawenc at linux.vnet.ibm.com Fri Jul 29 07:05:48 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Fri, 29 Jul 2011 15:05:48 +0800 Subject: [Libvirt-cim] [PATCH 0 of 2] Add SDL frame buffer support in libvirt-cim, V4 Message-ID: these patches would add support of SDL frame buffer configuration. From xiawenc at linux.vnet.ibm.com Fri Jul 29 07:05:49 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Fri, 29 Jul 2011 15:05:49 +0800 Subject: [Libvirt-cim] [PATCH 1 of 2] (#4) made the graphic structure as union In-Reply-To: References: Message-ID: <640ea61807cff06e1d15.1311923149@localhost6.localdomain6> # HG changeset patch # User Wayne Xia # Date 1311593948 -28800 # Node ID 640ea61807cff06e1d15fd1885a8daaf6f2ffa3a # Parent 0f42cab9c45c53cc13407b16418399ed8ed4a026 (#4) made the graphic structure as union These change were made to allow SDL device properties added more clearly #4 remove tailing space, and added different free functions for graphic device Signed-off-by: Wayne Xia (Wayne) diff -r 0f42cab9c45c -r 640ea61807cf libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Jul 25 13:14:22 2011 -0700 +++ b/libxkutil/device_parsing.c Mon Jul 25 19:39:08 2011 +0800 @@ -88,13 +88,31 @@ free(dev->path); } +static void cleanup_vnc_device(struct graphics_device *dev) +{ + free(dev->type); + free(dev->dev.vnc.port); + free(dev->dev.vnc.host); + free(dev->dev.vnc.keymap); + free(dev->dev.vnc.passwd); +} + +static void cleanup_sdl_device(struct graphics_device *dev) +{ + free(dev->type); + free(dev->dev.sdl.display); + free(dev->dev.sdl.xauth); + free(dev->dev.sdl.fullscreen); +} + static void cleanup_graphics_device(struct graphics_device *dev) { - free(dev->type); - free(dev->port); - free(dev->host); - free(dev->keymap); - free(dev->passwd); + if (STREQC(dev->type, "sdl")) { + cleanup_sdl_device(dev); + } + else { + cleanup_vnc_device(dev); + } } static void cleanup_input_device(struct input_device *dev) @@ -530,12 +548,12 @@ CU_DEBUG("graphics device type = %s", gdev->type); if (STREQC(gdev->type, "vnc")) { - gdev->port = get_attr_value(node, "port"); - gdev->host = get_attr_value(node, "listen"); - gdev->keymap = get_attr_value(node, "keymap"); - gdev->passwd = get_attr_value(node, "passwd"); + gdev->dev.vnc.port = get_attr_value(node, "port"); + gdev->dev.vnc.host = get_attr_value(node, "listen"); + gdev->dev.vnc.keymap = get_attr_value(node, "keymap"); + gdev->dev.vnc.passwd = get_attr_value(node, "passwd"); - if (gdev->port == NULL || gdev->host == NULL) + if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) goto err; } else if (STREQC(gdev->type, "pty")) { @@ -550,9 +568,9 @@ for (child = node->children; child != NULL; child = child->next) { if (XSTREQ(child->name, "source")) - gdev->host = get_attr_value(child, "path"); + gdev->dev.vnc.host = get_attr_value(child, "path"); else if (XSTREQ(child->name, "target")) - gdev->port = get_attr_value(child, "port"); + gdev->dev.vnc.port = get_attr_value(child, "port"); } } else { @@ -565,7 +583,7 @@ if (STREQC(gdev->type, "vnc")) ret = asprintf(&vdev->id, "%s", gdev->type); else - ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->port); + ret = asprintf(&vdev->id, "%s:%s", gdev->type, gdev->dev.vnc.port); if (ret == -1) { CU_DEBUG("Failed to create graphics is string"); @@ -806,10 +824,10 @@ DUP_FIELD(dev, _dev, dev.emu.path); } else if (dev->type == CIM_RES_TYPE_GRAPHICS) { DUP_FIELD(dev, _dev, dev.graphics.type); - DUP_FIELD(dev, _dev, dev.graphics.port); - DUP_FIELD(dev, _dev, dev.graphics.host); - DUP_FIELD(dev, _dev, dev.graphics.keymap); - DUP_FIELD(dev, _dev, dev.graphics.passwd); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.host); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.port); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.keymap); + DUP_FIELD(dev, _dev, dev.graphics.dev.vnc.passwd); } else if (dev->type == CIM_RES_TYPE_INPUT) { DUP_FIELD(dev, _dev, dev.input.type); DUP_FIELD(dev, _dev, dev.input.bus); diff -r 0f42cab9c45c -r 640ea61807cf libxkutil/device_parsing.h --- a/libxkutil/device_parsing.h Mon Jul 25 13:14:22 2011 -0700 +++ b/libxkutil/device_parsing.h Mon Jul 25 19:39:08 2011 +0800 @@ -84,14 +84,28 @@ char *path; }; -struct graphics_device { - char *type; +//vnc_device must be larger or equal than sdl_device +struct vnc_device { char *port; char *host; char *keymap; char *passwd; }; +struct sdl_device { + char *display; + char *xauth; + char *fullscreen; +}; + +struct graphics_device { + char *type; + union { + struct vnc_device vnc; + struct sdl_device sdl; + } dev; +}; + struct input_device { char *type; char *bus; diff -r 0f42cab9c45c -r 640ea61807cf libxkutil/xml_parse_test.c --- a/libxkutil/xml_parse_test.c Mon Jul 25 13:14:22 2011 -0700 +++ b/libxkutil/xml_parse_test.c Mon Jul 25 19:39:08 2011 +0800 @@ -116,7 +116,7 @@ FILE *d) { print_value(d, "Graphics Type", dev->dev.graphics.type); - print_value(d, "Graphics Port", dev->dev.graphics.port); + print_value(d, "Graphics Port", dev->dev.graphics.dev.vnc.port); } static void print_devices(struct domain *dominfo, diff -r 0f42cab9c45c -r 640ea61807cf libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Mon Jul 25 13:14:22 2011 -0700 +++ b/libxkutil/xmlgen.c Mon Jul 25 19:39:08 2011 +0800 @@ -424,22 +424,22 @@ if (STREQC(dev->type, "sdl")) return NULL; - if (dev->port) { - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); - if (STREQC(dev->port, "-1")) + if (dev->dev.vnc.port) { + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); + if (STREQC(dev->dev.vnc.port, "-1")) xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "yes"); else xmlNewProp(tmp, BAD_CAST "autoport", BAD_CAST "no"); } - if (dev->host) - xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->host); + if (dev->dev.vnc.host) + xmlNewProp(tmp, BAD_CAST "listen", BAD_CAST dev->dev.vnc.host); - if (dev->passwd) - xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->passwd); + if (dev->dev.vnc.passwd) + xmlNewProp(tmp, BAD_CAST "passwd", BAD_CAST dev->dev.vnc.passwd); - if (dev->keymap) - xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->keymap); + if (dev->dev.vnc.keymap) + xmlNewProp(tmp, BAD_CAST "keymap", BAD_CAST dev->dev.vnc.keymap); return NULL; } @@ -459,16 +459,16 @@ tmp = xmlNewChild(pty, NULL, BAD_CAST "source", NULL); if (tmp == NULL) return XML_ERROR; - - if(dev->host) - xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->host); + + if(dev->dev.vnc.host) + xmlNewProp(tmp, BAD_CAST "path", BAD_CAST dev->dev.vnc.host); tmp = xmlNewChild(pty, NULL, BAD_CAST "target", NULL); if (tmp == NULL) return XML_ERROR; - - if(dev->port) - xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->port); + + if(dev->dev.vnc.port) + xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); return NULL; } diff -r 0f42cab9c45c -r 640ea61807cf src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Mon Jul 25 13:14:22 2011 -0700 +++ b/src/Virt_ComputerSystem.c Mon Jul 25 19:39:08 2011 +0800 @@ -104,7 +104,7 @@ "Virtual System (Console on %s://%s:%s)", domain->dev_graphics[0].dev.graphics.type, host, - domain->dev_graphics[0].dev.graphics.port); + domain->dev_graphics[0].dev.graphics.dev.vnc.port); else ret = asprintf(&cap, "Virtual System (No console)"); diff -r 0f42cab9c45c -r 640ea61807cf src/Virt_Device.c --- a/src/Virt_Device.c Mon Jul 25 13:14:22 2011 -0700 +++ b/src/Virt_Device.c Mon Jul 25 19:39:08 2011 +0800 @@ -194,8 +194,8 @@ else rc = asprintf(&vp_str, "%s/%s:%s", dev->type, - dev->host, - dev->port); + dev->dev.vnc.host, + dev->dev.vnc.port); if (rc == -1) return 0; diff -r 0f42cab9c45c -r 640ea61807cf src/Virt_KVMRedirectionSAP.c --- a/src/Virt_KVMRedirectionSAP.c Mon Jul 25 13:14:22 2011 -0700 +++ b/src/Virt_KVMRedirectionSAP.c Mon Jul 25 19:39:08 2011 +0800 @@ -366,7 +366,7 @@ continue; } - ret = sscanf(dominfo->dev_graphics->dev.graphics.port, + ret = sscanf(dominfo->dev_graphics->dev.graphics.dev.vnc.port, "%d", &lport); if (ret != 1) { diff -r 0f42cab9c45c -r 640ea61807cf src/Virt_RASD.c --- a/src/Virt_RASD.c Mon Jul 25 13:14:22 2011 -0700 +++ b/src/Virt_RASD.c Mon Jul 25 19:39:08 2011 +0800 @@ -481,9 +481,9 @@ rc = asprintf(&addr_str, "%s", dev->dev.graphics.type); else { rc = asprintf(&addr_str, - "%s:%s", - dev->dev.graphics.host, - dev->dev.graphics.port); + "%s:%s", + dev->dev.graphics.dev.vnc.host, + dev->dev.graphics.dev.vnc.port); } CU_DEBUG("graphics Address = %s", addr_str); @@ -496,7 +496,7 @@ if (STREQC(dev->dev.graphics.type, "vnc")) { CMSetProperty(inst, "KeyMap", - (CMPIValue *)dev->dev.graphics.keymap, CMPI_chars); + (CMPIValue *)dev->dev.graphics.dev.vnc.keymap, CMPI_chars); conn = connect_by_classname(_BROKER, classname, &s); if (conn == NULL) @@ -511,7 +511,8 @@ goto out; } - if (dev->dev.graphics.passwd && strlen(dev->dev.graphics.passwd)) { + if (dev->dev.graphics.dev.vnc.passwd && + strlen(dev->dev.graphics.dev.vnc.passwd)) { CU_DEBUG("has password"); CMSetProperty(inst, "Password", (CMPIValue *)"********", CMPI_chars); diff -r 0f42cab9c45c -r 640ea61807cf src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Jul 25 13:14:22 2011 -0700 +++ b/src/Virt_VirtualSystemManagementService.c Mon Jul 25 19:39:08 2011 +0800 @@ -370,10 +370,10 @@ } domain->dev_graphics->dev.graphics.type = strdup("vnc"); - domain->dev_graphics->dev.graphics.port = strdup("-1"); - domain->dev_graphics->dev.graphics.host = strdup("127.0.0.1"); - domain->dev_graphics->dev.graphics.keymap = strdup("en-us"); - domain->dev_graphics->dev.graphics.passwd = NULL; + domain->dev_graphics->dev.graphics.dev.vnc.port = strdup("-1"); + domain->dev_graphics->dev.graphics.dev.vnc.host = strdup("127.0.0.1"); + domain->dev_graphics->dev.graphics.dev.vnc.keymap = strdup("en-us"); + domain->dev_graphics->dev.graphics.dev.vnc.passwd = NULL; domain->dev_graphics_ct = 1; return true; @@ -1129,24 +1129,24 @@ } ret = parse_vnc_address(val, - &dev->dev.graphics.host, - &dev->dev.graphics.port); + &dev->dev.graphics.dev.vnc.host, + &dev->dev.graphics.dev.vnc.port); if (ret != 1) { msg = "GraphicsRASD field Address not valid"; goto out; } if (cu_get_str_prop(inst, "KeyMap", &val) != CMPI_RC_OK) - dev->dev.graphics.keymap = strdup("en-us"); + dev->dev.graphics.dev.vnc.keymap = strdup("en-us"); else - dev->dev.graphics.keymap = strdup(val); + dev->dev.graphics.dev.vnc.keymap = strdup(val); if (cu_get_str_prop(inst, "Password", &val) != CMPI_RC_OK) { CU_DEBUG("vnc password is not set"); - dev->dev.graphics.passwd = NULL; + dev->dev.graphics.dev.vnc.passwd = NULL; } else { CU_DEBUG("vnc password is set"); - dev->dev.graphics.passwd = strdup(val); + dev->dev.graphics.dev.vnc.passwd = strdup(val); } } else if (STREQC(dev->dev.graphics.type, "console") || @@ -1157,8 +1157,8 @@ } ret = parse_console_address(val, - &dev->dev.graphics.host, - &dev->dev.graphics.port); + &dev->dev.graphics.dev.vnc.host, + &dev->dev.graphics.dev.vnc.port); if (ret != 1) { msg = "GraphicsRASD field Address not valid"; goto out; @@ -1175,7 +1175,7 @@ ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); else ret = asprintf(&dev->id, "%s:%s", - dev->dev.graphics.type, dev->dev.graphics.port); + dev->dev.graphics.type, dev->dev.graphics.dev.vnc.port); if (ret == -1) { msg = "Failed to create graphics is string"; From xiawenc at linux.vnet.ibm.com Fri Jul 29 07:05:50 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Fri, 29 Jul 2011 15:05:50 +0800 Subject: [Libvirt-cim] [PATCH 2 of 2] (#4) add sdl frame buffer support In-Reply-To: References: Message-ID: # HG changeset patch # User Wayne Xia # Date 1311670971 -28800 # Node ID f170cdc0acb579c417327e8179c2f23d09b34281 # Parent 640ea61807cff06e1d15fd1885a8daaf6f2ffa3a (#4) add sdl frame buffer support. Now libvirt still supports sdl frame buffer, and it may take three parameters: display,xauth,fullscreen. This patch enable the libvirt-cim to accept these configuration and pass them in XML define to let libvirt know about it. Exposed interface could be found in the file ResourceAllocationSettingData.mof. #4 removed the link in the comments. Signed-off-by: Wayne Xia (Wayne) diff -r 640ea61807cf -r f170cdc0acb5 libxkutil/device_parsing.c --- a/libxkutil/device_parsing.c Mon Jul 25 19:39:08 2011 +0800 +++ b/libxkutil/device_parsing.c Tue Jul 26 17:02:51 2011 +0800 @@ -556,6 +556,11 @@ if (gdev->dev.vnc.port == NULL || gdev->dev.vnc.host == NULL) goto err; } + else if (STREQC(gdev->type, "sdl")) { + gdev->dev.sdl.display = get_attr_value(node, "display"); + gdev->dev.sdl.xauth = get_attr_value(node, "xauth"); + gdev->dev.sdl.fullscreen = get_attr_value(node, "fullscreen"); + } else if (STREQC(gdev->type, "pty")) { if (node->name == NULL) goto err; diff -r 640ea61807cf -r f170cdc0acb5 libxkutil/xmlgen.c --- a/libxkutil/xmlgen.c Mon Jul 25 19:39:08 2011 +0800 +++ b/libxkutil/xmlgen.c Tue Jul 26 17:02:51 2011 +0800 @@ -421,8 +421,21 @@ xmlNewProp(tmp, BAD_CAST "type", BAD_CAST dev->type); - if (STREQC(dev->type, "sdl")) - return NULL; + if (STREQC(dev->type, "sdl")) { + if (dev->dev.sdl.display) { + xmlNewProp(tmp, BAD_CAST "display", + BAD_CAST dev->dev.sdl.display); + } + if (dev->dev.sdl.xauth) { + xmlNewProp(tmp, BAD_CAST "xauth", + BAD_CAST dev->dev.sdl.xauth); + } + if (dev->dev.sdl.fullscreen) { + xmlNewProp(tmp, BAD_CAST "fullscreen", + BAD_CAST dev->dev.sdl.fullscreen); + } + return NULL; + } if (dev->dev.vnc.port) { xmlNewProp(tmp, BAD_CAST "port", BAD_CAST dev->dev.vnc.port); diff -r 640ea61807cf -r f170cdc0acb5 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Mon Jul 25 19:39:08 2011 +0800 +++ b/schema/ResourceAllocationSettingData.mof Tue Jul 26 17:02:51 2011 +0800 @@ -219,7 +219,9 @@ [Description ("If ResourceSubType is 'vnc', this is a VNC Address. " "IPv4 in a.b.c.d:port or IPv6 in [ip]:port format. If ResourceSubType " "is 'console', this is a character device path in " - "path:port format (e.g., '/dev/pts/3:0'\)")] + "path:port format (e.g., '/dev/pts/3:0'\) " + "if ResourceSubType is 'sdl', this is a combination of its params as " + "xauth:display (e.g., '/root/.Xauthority::0'\)")] string Address; [Description ("Keyboard keymapping")] @@ -228,7 +230,8 @@ [Description ("VNC password")] string Password; - [Description ("Is IPv6 only addressing is to be used")] + [Description ("Is IPv6 only addressing is to be used." + "if ResourceSubType is 'sdl', this means whether sdl is fullscreen")] boolean IsIPv6Only; }; diff -r 640ea61807cf -r f170cdc0acb5 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Jul 25 19:39:08 2011 +0800 +++ b/src/Virt_VirtualSystemManagementService.c Tue Jul 26 17:02:51 2011 +0800 @@ -1060,6 +1060,52 @@ return ret; } +static int parse_sdl_address(const char *id, + char **display, + char **xauth) +{ + int ret; + char *tmp_display = NULL; + char *tmp_xauth = NULL; + + CU_DEBUG("Entering parse_sdl_address, address is %s", id); + + ret = sscanf(id, "%a[^:]:%as", &tmp_xauth, &tmp_display); + + if (ret <= 0) { + ret = sscanf(id, ":%as", &tmp_display); + if (ret <= 0) { + if (STREQC(id, ":")) { + /* do nothing, it is empty */ + } + else { + ret = 0; + goto out; + } + } + } + + if (display) { + if (tmp_display == NULL) + *display = NULL; + else + *display = strdup(tmp_display); + } + if (xauth) { + if (tmp_xauth == NULL) + *xauth = NULL; + else + *xauth = strdup(tmp_xauth); + } + ret = 1; + + out: + CU_DEBUG("Exiting parse_sdl_address, display is %s, xauth is %s", + *display, *xauth); + + return ret; +} + static int parse_vnc_address(const char *id, char **ip, char **port) @@ -1163,6 +1209,30 @@ msg = "GraphicsRASD field Address not valid"; goto out; } + } + else if (STREQC(dev->dev.graphics.type, "sdl")) { + if (cu_get_str_prop(inst, "Address", &val) != CMPI_RC_OK) { + CU_DEBUG("sdl graphics Address empty, using default"); + dev->dev.graphics.dev.sdl.display = NULL; + dev->dev.graphics.dev.sdl.xauth = NULL; + } + else { + ret = parse_sdl_address(val, + &dev->dev.graphics.dev.sdl.display, + &dev->dev.graphics.dev.sdl.xauth); + if (ret != 1) { + msg = "GraphicsRASD sdl Address not valid"; + goto out; + } + } + dev->dev.graphics.dev.sdl.fullscreen = NULL; + if (cu_get_bool_prop(inst, "IsIPV6Only", &ipv6) == + CMPI_RC_OK) { + if (ipv6) + dev->dev.graphics.dev.sdl.fullscreen = strdup("yes"); + else + dev->dev.graphics.dev.sdl.fullscreen = strdup("no"); + } } else { CU_DEBUG("Unsupported graphics type %s", dev->dev.graphics.type); @@ -1171,7 +1241,8 @@ } free(dev->id); - if (STREQC(dev->dev.graphics.type, "vnc")) + if ((STREQC(dev->dev.graphics.type, "vnc"))|| + (STREQC(dev->dev.graphics.type, "sdl"))) ret = asprintf(&dev->id, "%s", dev->dev.graphics.type); else ret = asprintf(&dev->id, "%s:%s", From xiawenc at linux.vnet.ibm.com Fri Jul 29 07:56:54 2011 From: xiawenc at linux.vnet.ibm.com (Wayne Xia) Date: Fri, 29 Jul 2011 15:56:54 +0800 Subject: [Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData does not conform to profile In-Reply-To: References: Message-ID: <4E3267C6.3060108@linux.vnet.ibm.com> ? 2011-7-22 9:19, Gareth S Bestor ??: > > So long as this new VM memory RASD AllocationUnits ("byte*2^10") will > match that of the MemoryPool capabilities' RASDs, and the new 'augmented > BNF' string is parsed ok when passed as an embedded instance to the > cimom (pegasus, sfcb) then I'm okay with this one-off too. Both these > are required otherwise existing usecases will break. > > - G Searching the project , I do find another place using the old string: Virt_SettingsDefineCapabilities.c:354: CMSetProperty(inst, "AllocationUnits", (CMPIValue *)"KiloBytes", CMPI_chars); After this is changed, I thought the libvirt-cim would have no more "KiloBytes". But I don't understand the BNF' string you refered, could u give more tips about that? > > Dr. Gareth S. Bestor > IBM Senior Software Engineer > Systems & Technology Group - Systems Management Standards > 971-285-6375 (mobile) > bestor at us.ibm.com > > > > *Re: [Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData > does not conform to profile* > > > *Chip Vincent * to: libvirt-cim > 07/21/11 05:50 PM > > > Sent by: *libvirt-cim-bounces at redhat.com* > > > *Please respond to cvincent, List for discussion and development of > libvirt CIM * > > > > > > > > We do have a schema update planned for this year. I think the origianl > plan was just to update the schema but perhaps we should rebase some of > the profiles as a follow on. If everyone agrees we should rebase the > profiles as part of the schema update, then I'm okay with this as a > 'one-off' change for now. > > Comments? > > On 07/21/2011 11:52 AM, Gareth S Bestor wrote: > > > > } else if (dev->type == CIM_RES_TYPE_MEM) { > > - const char *units = "KiloBytes"; > > + const char *units = "byte*2^10"; > > > > > > If we're doing this sorta change here then we should probably do it > > everywhere, since users may be checking AllocationUnits between CIM > > classes. Specifically, these should match the units being returned from > > memory pool capabilities, and we need to check these new units will be > > correctly parsed when passed as embedded instances (eg DefineSystem(), > > ModifyResourceSettings(), etc)... Alternatively, we might want to > > consider going thru the entire libvirt-cim suite and upgrading all > > classes from DSP0004v2.4 to DSP0004 2.5+ conformance level (ie using > > Augmented BNFeverywhere its relevant) rather than having in old and new > > units sprinkled around. > > > > Basically, doing this change here and now may have much wider > implications. > > > > - Gareth > > > > Dr. Gareth S. Bestor > > IBM Senior Software Engineer > > Systems & Technology Group - Systems Management Standards > > 971-285-6375 (mobile) > > bestor at us.ibm.com > > > > > > > > *[Libvirt-cim] [PATCH] bug fix: KVM_MemResourceAllocationSettingData > > does not conform to profile* > > > > > > *Wayne Xia * to: List for discussion and development of libvirt CIM > > 07/21/11 12:34 AM > > > > > > Sent by: *libvirt-cim-bounces at redhat.com* > > > > > > *Please respond to List for discussion and development of libvirt CIM * > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > > > # HG changeset patch > > # User Wayne Xia > > # Date 1311231387 -28800 > > # Node ID 677867c3d2a16a97591bde2828808f9f39b859a7 > > # Parent 3c90a88a5199a4ed931a4a76097cff8f55deae41 > > changed a bit to make it conform to CIM profile > > > > According to the discuss and profile, the reserved property means the > > memory actually allocated to support the VM running, and the unit > > should be byte*2^10. This patch added some code to retrieve VM's state, > > and the report the memory status according to that. > > https://bugzilla.linux.ibm.com/show_bug.cgi?id=72759 > > > > Signed-off-by: Wayne Xia > > > > diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.c > > --- a/libxkutil/device_parsing.c Mon Jul 18 11:13:40 2011 -0300 > > +++ b/libxkutil/device_parsing.c Thu Jul 21 14:56:27 2011 +0800 > > @@ -792,6 +792,7 @@ > > } else if (dev->type == CIM_RES_TYPE_MEM) { > > dev->dev.mem.size = _dev->dev.mem.size; > > dev->dev.mem.maxsize = _dev->dev.mem.maxsize; > > + dev->dev.mem.reserved = _dev->dev.mem.reserved; > > } else if (dev->type == CIM_RES_TYPE_PROC) { > > dev->dev.vcpu.quantity = _dev->dev.vcpu.quantity; > > } else if (dev->type == CIM_RES_TYPE_EMU) { > > @@ -885,8 +886,22 @@ > > if (xml == NULL) > > return 0; > > > > - if (type == CIM_RES_TYPE_MEM) > > + if (type == CIM_RES_TYPE_MEM) { > > ret = _get_mem_device(xml, list); > > + if (*list != NULL) { > > + virDomainInfo dom_info; > > + if (virDomainGetInfo(dom, &dom_info) == 0) { > > + (*list)->dev.mem.reserved = dom_info.memory; > > + if (dom_info.state == 5) { /* VM not active */ > > + (*list)->dev.mem.reserved = 0; > > + } > > + } > > + else { > > + CU_DEBUG("failed to get dom state for mem"); > > + ret = -1; > > + } > > + } > > + } > > else if (type == CIM_RES_TYPE_PROC) > > ret = _get_proc_device(xml, list); > > else > > diff -r 3c90a88a5199 -r 677867c3d2a1 libxkutil/device_parsing.h > > --- a/libxkutil/device_parsing.h Mon Jul 18 11:13:40 2011 -0300 > > +++ b/libxkutil/device_parsing.h Thu Jul 21 14:56:27 2011 +0800 > > @@ -71,6 +71,7 @@ > > struct mem_device { > > uint64_t size; > > uint64_t maxsize; > > + uint64_t reserved; > > }; > > > > struct vcpu_device { > > diff -r 3c90a88a5199 -r 677867c3d2a1 src/Virt_RASD.c > > --- a/src/Virt_RASD.c Mon Jul 18 11:13:40 2011 -0300 > > +++ b/src/Virt_RASD.c Thu Jul 21 14:56:27 2011 +0800 > > @@ -576,14 +576,14 @@ > > inst); > > > > } else if (dev->type == CIM_RES_TYPE_MEM) { > > - const char *units = "KiloBytes"; > > + const char *units = "byte*2^10"; > > > > CMSetProperty(inst, "AllocationUnits", > > (CMPIValue *)units, CMPI_chars); > > CMSetProperty(inst, "VirtualQuantity", > > (CMPIValue *)&dev->dev.mem.size, > > CMPI_uint64); > > CMSetProperty(inst, "Reservation", > > - (CMPIValue *)&dev->dev.mem.size, > > CMPI_uint64); > > + (CMPIValue *)&dev->dev.mem.reserved, > > CMPI_uint64); > > CMSetProperty(inst, "Limit", > > (CMPIValue *)&dev->dev.mem.maxsize, > > CMPI_uint64); > > } else if (dev->type == CIM_RES_TYPE_PROC) { > > > > _______________________________________________ > > Libvirt-cim mailing list > > Libvirt-cim at redhat.com > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > > > > > _______________________________________________ > > Libvirt-cim mailing list > > Libvirt-cim at redhat.com > > https://www.redhat.com/mailman/listinfo/libvirt-cim > > -- > Chip Vincent > Open Virtualization > IBM Linux Technology Center > cvincent at linux.vnet.ibm.com > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim > > > > _______________________________________________ > Libvirt-cim mailing list > Libvirt-cim at redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-cim -- Best Regards Wayne Xia mail:xiawenc at linux.vnet.ibm.com tel:86-010-82450803