[PATCH] (#2) Fix RASD provider unregistration

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1225926818 28800 # Node ID 33df023c86f12df116d577c8896e34809bbd3544 # Parent 9ff301e463a4de21ffae06ce58442da24e40c6cb (#2) Fix RASD provider unregistration. Since <>_ResourceAllocationSettingData is listed first in the mof, it doesn't get properly unregistered because <>_ProcResourceAllocationSettingData haven't been unregistered yet. Updates from 1 to 2: -Fix provider_register.sh to reverse the list when uninstalling -Move superclass definition for RASD to its own mof Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 9ff301e463a4 -r 33df023c86f1 Makefile.am --- a/Makefile.am Wed Nov 12 14:22:50 2008 -0800 +++ b/Makefile.am Wed Nov 05 15:13:38 2008 -0800 @@ -27,6 +27,7 @@ schema/ElementConformsToProfile.mof \ schema/ComputerSystemIndication.mof \ schema/ComputerSystemMigrationIndication.mof \ + schema/Virt_ResourceAllocationSettingData.mof \ schema/ResourceAllocationSettingData.mof \ schema/ResourcePoolConfigurationService.mof \ schema/ResourcePoolConfigurationCapabilities.mof \ diff -r 9ff301e463a4 -r 33df023c86f1 provider-register.sh --- a/provider-register.sh Wed Nov 12 14:22:50 2008 -0800 +++ b/provider-register.sh Wed Nov 05 15:13:38 2008 -0800 @@ -233,13 +233,25 @@ fi if test $mofmode = 1 then - mymofs="$mymofs $1" + tmp_mofs="$tmp_mofs $1" else - myregs="$myregs $1" + tmp_regs="$tmp_regs $1" fi shift done - + + mymofs=`(for d in $tmp_mofs; do echo $d; done) | tac` + if test $? != 0 + then + mymofs=$tmp_mofs + fi + + myregs=`(for d in $tmp_regs; do echo $d; done) | tac` + if test $? != 0 + then + myregs=$tmp_regs + fi + if ps -C cimserver > /dev/null 2>&1 then PROVIDERMODULES=`cat $myregs 2> /dev/null | grep -v '^[[:space:]]*#.*' | cut -d ' ' -f 4 | sort | uniq` diff -r 9ff301e463a4 -r 33df023c86f1 schema/ResourceAllocationSettingData.mof --- a/schema/ResourceAllocationSettingData.mof Wed Nov 12 14:22:50 2008 -0800 +++ b/schema/ResourceAllocationSettingData.mof Wed Nov 05 15:13:38 2008 -0800 @@ -1,16 +1,4 @@ // Copyright IBM Corp. 2007 - -class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData -{ -}; - -class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData -{ -}; - -class LXC_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData -{ -}; [Description ("Xen virtual disk configuration"), Provider("cmpi::Virt_RASD") diff -r 9ff301e463a4 -r 33df023c86f1 schema/Virt_ResourceAllocationSettingData.mof --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/schema/Virt_ResourceAllocationSettingData.mof Wed Nov 05 15:13:38 2008 -0800 @@ -0,0 +1,14 @@ +// Copyright IBM Corp. 2007 + +class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData +{ +}; + +class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData +{ +}; + +class LXC_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData +{ +}; +

KR> diff -r 9ff301e463a4 -r 33df023c86f1 provider-register.sh KR> --- a/provider-register.sh Wed Nov 12 14:22:50 2008 -0800 KR> +++ b/provider-register.sh Wed Nov 05 15:13:38 2008 -0800 KR> @@ -233,13 +233,25 @@ KR> fi KR> if test $mofmode = 1 KR> then KR> - mymofs="$mymofs $1" KR> + tmp_mofs="$tmp_mofs $1" KR> else KR> - myregs="$myregs $1" KR> + tmp_regs="$tmp_regs $1" KR> fi KR> shift KR> done KR> - KR> + KR> + mymofs=`(for d in $tmp_mofs; do echo $d; done) | tac` KR> + if test $? != 0 KR> + then KR> + mymofs=$tmp_mofs KR> + fi KR> + KR> + myregs=`(for d in $tmp_regs; do echo $d; done) | tac` KR> + if test $? != 0 KR> + then KR> + myregs=$tmp_regs KR> + fi KR> + Instead of building the temporary list forwards and then reversing it, why not just build it in reverse? If you change this line: myregs="$myregs $1" to myregs="$1 $myregs" Won't that accomplish the goal without the dual lists, extra error path, etc? -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com

Instead of building the temporary list forwards and then reversing it, why not just build it in reverse?
If you change this line:
myregs="$myregs $1"
to
myregs="$1 $myregs"
Won't that accomplish the goal without the dual lists, extra error path, etc?
Yeah, that would be a lot simpler. Not sure what I was thinking here. New version on the way. -- Kaitlin Rupert IBM Linux Technology Center kaitlin@linux.vnet.ibm.com
participants (2)
-
Dan Smith
-
Kaitlin Rupert