Hi,
As a reference, ComputerSystem defined as one parameter of
VirtualSystemIsMigratableToHost method,
which is parsed by passing two keys to CIMInstanceName. Below is a test
example segment.
cs_ref = CIMInstanceName(classname, keybindings = {
'Name':test_dom,
'CreationClassName':classname})
service.VirtualSystemIsMigratableToHost(ComputerSystem=cs_ref,
DestinationHost=options.ip)
If the "Name" key is set "Wrong", it will report expected error
"Missing
key (Name) in ComputerSystem".
Then does the other key "CreationClassName" need to verify also? At now,
either wrong key name
or wrong value of CreationClassName, such as "CreationClassName!@#$$$"
instead of "CreationClassName",
it can still return expected result. So is it a provider's bug?
Do we need to add some verification of "CreationClassName" key in provider
code below? Thanks!
static CMPIStatus vs_migratable_host(CMPIMethodMI *self,
const CMPIContext *ctx,
const CMPIResult *results,
const CMPIObjectPath *ref,
const CMPIArgs *argsin,
CMPIArgs *argsout)
{
CMPIStatus s;
const char *dhost = NULL;
CMPIObjectPath *system;
const char *name = NULL;
cu_get_str_arg(argsin, "DestinationHost", &dhost);
cu_get_ref_arg(argsin, "ComputerSystem", &system);
if (cu_get_str_path(system, "Name", &name) != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Missing key (Name) in ComputerSystem");
METHOD_RETURN(results, 1);
return s;
}
return vs_migratable(ref, name, dhost, results);
}
Best,
Regards
Daisy Guo Lian Yun
E-mail: yunguol(a)cn.ibm.com
IBM China Development Lab, Shanghai, China
TEL: (86)-21-61008057
Show replies by date
GY> If the "Name" key is set "Wrong", it will report expected
error
GY> "Missing key (Name) in ComputerSystem". Then does the other key
GY> "CreationClassName" need to verify also? At now, either wrong key
GY> name or wrong value of CreationClassName, such as
GY> "CreationClassName!@#$$$" instead of "CreationClassName",it
can
GY> still return expected result. So is it a provider's bug? Do we
GY> need to add some verification of "CreationClassName" key in
GY> provider code below?
I think this is probably a reasonable instance where such a check
actually adds value. Assuming you have two domains called "meep", one
a KVM domain and another a Xen domain, you could potentially pass a
reference of the Xen one to the KVM_VirtualSystemMigrationService.
This would result in moving a different domain than intended.
Granted, this would be a client error, of course, but it seems like
something we could easily help prevent from the provider side.
Thanks!
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com