[PATCH] (2) Remove the embedded object parsing pieces from VirtualSystemManagmentService
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1201801531 28800
# Node ID e27208a0ac3f69df3f704ecd32fdfdc78b79dc7c
# Parent b8d69e734306e618b4efb53e23c17ffdd8bab128
(2) Remove the embedded object parsing pieces from VirtualSystemManagmentService.
Updates from set 1 to set 2:
Removed unsused sys_op from define_system()
Removed unused list from update_resource_setting()
Changed CMPIArray **out_arr to **ret_arr in rasd_refs_to_insts()
Changed ReferencedConfiguration to ReferenceConfiguration in the definesystem handler.
Remove embedded object parsing since libcmpiutil now handles this. Also update the method handlers to expect instances instead of strings as arguments.
The following methods have been updated:
DefineSystem
AddResourceSettings
ModifyResourceSettings
ModifySystemSettings
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r b8d69e734306 -r e27208a0ac3f src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Jan 30 09:27:27 2008 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Thu Jan 31 09:45:31 2008 -0800
@@ -57,69 +57,23 @@ enum ResourceAction {
RESOURCE_MOD,
};
-static int parse_str_inst_array(CMPIArray *array,
- const char *ns,
- struct inst_list *list)
-{
- int count;
- int i;
-
- count = CMGetArrayCount(array, NULL);
-
- for (i = 0; i < count; i++) {
- CMPIInstance *inst;
- CMPIData item;
- int ret;
-
- item = CMGetArrayElementAt(array, i, NULL);
- /* FIXME: Check for string here */
-
- ret = cu_parse_embedded_instance(CMGetCharPtr(item.value.string),
- _BROKER,
- ns,
- &inst);
-
- if (ret == 0)
- inst_list_add(list, inst);
- }
-
- return 1;
-}
-
static CMPIStatus define_system_parse_args(const CMPIArgs *argsin,
CMPIInstance **sys,
const char *ns,
- struct inst_list *res)
+ CMPIArray **res)
{
CMPIStatus s = {CMPI_RC_ERR_FAILED, NULL};
- const char *sys_str = NULL;
- CMPIArray *res_arr;
- int ret;
-
- if (cu_get_str_arg(argsin, "SystemSettings", &sys_str) != CMPI_RC_OK) {
+
+ if (cu_get_inst_arg(argsin, "SystemSettings", sys) != CMPI_RC_OK) {
CU_DEBUG("No SystemSettings string argument");
goto out;
}
- ret = cu_parse_embedded_instance(sys_str,
- _BROKER,
- ns,
- sys);
- if (ret) {
- CU_DEBUG("Unable to parse SystemSettings instance");
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "SystemSettings parse error");
- goto out;
- }
-
- if (cu_get_array_arg(argsin, "ResourceSettings", &res_arr) !=
+ if (cu_get_array_arg(argsin, "ResourceSettings", res) !=
CMPI_RC_OK) {
CU_DEBUG("Failed to get array arg");
goto out;
}
-
- ret = parse_str_inst_array(res_arr, ns, res);
CMSetStatus(&s, CMPI_RC_OK);
@@ -317,24 +271,34 @@ static int rasd_to_vdev(CMPIInstance *in
return 0;
}
-static int classify_resources(struct inst_list *all,
+static int classify_resources(CMPIArray *resources,
struct domain *domain)
{
int i;
uint16_t type;
+ int count;
domain->dev_disk_ct = domain->dev_net_ct = 0;
domain->dev_vcpu_ct = domain->dev_mem_ct = 0;
-
- domain->dev_disk = calloc(all->cur, sizeof(struct virt_device));
- domain->dev_vcpu = calloc(all->cur, sizeof(struct virt_device));
- domain->dev_mem = calloc(all->cur, sizeof(struct virt_device));
- domain->dev_net = calloc(all->cur, sizeof(struct virt_device));
-
- for (i = 0; i < all->cur; i++) {
+
+ count = CMGetArrayCount(resources, NULL);
+ if (count < 1)
+ return 0;
+
+ domain->dev_disk = calloc(count, sizeof(struct virt_device));
+ domain->dev_vcpu = calloc(count, sizeof(struct virt_device));
+ domain->dev_mem = calloc(count, sizeof(struct virt_device));
+ domain->dev_net = calloc(count, sizeof(struct virt_device));
+
+ for (i = 0; i < count; i++) {
CMPIObjectPath *op;
-
- op = CMGetObjectPath(all->list[i], NULL);
+ CMPIData item;
+
+ item = CMGetArrayElementAt(resources, i, NULL);
+ if (CMIsNullObject(item.value.inst))
+ return 0;
+
+ op = CMGetObjectPath(item.value.inst, NULL);
if (op == NULL)
return 0;
@@ -343,16 +307,16 @@ static int classify_resources(struct ins
return 0;
if (type == CIM_RASD_TYPE_PROC)
- rasd_to_vdev(all->list[i],
+ rasd_to_vdev(item.value.inst,
&domain->dev_vcpu[domain->dev_vcpu_ct++]);
else if (type == CIM_RASD_TYPE_MEM)
- rasd_to_vdev(all->list[i],
+ rasd_to_vdev(item.value.inst,
&domain->dev_mem[domain->dev_mem_ct++]);
else if (type == CIM_RASD_TYPE_DISK)
- rasd_to_vdev(all->list[i],
+ rasd_to_vdev(item.value.inst,
&domain->dev_disk[domain->dev_disk_ct++]);
else if (type == CIM_RASD_TYPE_NET)
- rasd_to_vdev(all->list[i],
+ rasd_to_vdev(item.value.inst,
&domain->dev_net[domain->dev_net_ct++]);
}
@@ -398,7 +362,7 @@ static CMPIInstance *connect_and_create(
}
static CMPIInstance *create_system(CMPIInstance *vssd,
- struct inst_list *resources,
+ CMPIArray *resources,
const CMPIObjectPath *ref,
CMPIStatus *s)
{
@@ -466,11 +430,8 @@ static CMPIStatus define_system(CMPIMeth
{
CMPIInstance *vssd;
CMPIInstance *sys;
- CMPIObjectPath *sys_op;
- struct inst_list res;
+ CMPIArray *res;
CMPIStatus s;
-
- inst_list_init(&res);
CU_DEBUG("DefineSystem");
@@ -478,15 +439,12 @@ static CMPIStatus define_system(CMPIMeth
if (s.rc != CMPI_RC_OK)
goto out;
- sys = create_system(vssd, &res, reference, &s);
+ sys = create_system(vssd, res, reference, &s);
if (sys == NULL)
goto out;
- inst_list_free(&res);
-
CMAddArg(argsout, "ResultingSystem", &sys, CMPI_instance);
- sys_op = CMGetObjectPath(sys, NULL);
trigger_indication(context,
"ComputerSystemCreatedIndication",
NAMESPACE(reference));
@@ -623,27 +581,14 @@ static CMPIStatus mod_system_settings(CM
const CMPIArgs *argsin,
CMPIArgs *argsout)
{
- const char *inst_str;
CMPIInstance *inst;
- if (cu_get_str_arg(argsin, "SystemSettings", &inst_str) != CMPI_RC_OK) {
+ if (cu_get_inst_arg(argsin, "SystemSettings", &inst) != CMPI_RC_OK) {
CMPIStatus s;
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Missing SystemSettings");
- return s;
- }
-
- if (cu_parse_embedded_instance(inst_str,
- _BROKER,
- NAMESPACE(reference),
- &inst)) {
- CMPIStatus s;
-
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Internal Parse Error on SystemSettings");
return s;
}
@@ -953,23 +898,30 @@ static CMPIStatus _update_resources_for(
}
static CMPIStatus _update_resource_settings(const CMPIObjectPath *ref,
- struct inst_list *list,
+ CMPIArray *resources,
resmod_fn func)
{
int i;
virConnectPtr conn = NULL;
CMPIStatus s;
+ int count;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
if (conn == NULL)
goto out;
- for (i = 0; i < list->cur; i++) {
- CMPIInstance *inst = list->list[i];
+ count = CMGetArrayCount(resources, NULL);
+
+ for (i = 0; i < count; i++) {
+ CMPIData item;
+ CMPIInstance *inst;
const char *id = NULL;
char *name = NULL;
char *devid = NULL;
virDomainPtr dom = NULL;
+
+ item = CMGetArrayElementAt(resources, i, NULL);
+ inst = item.value.inst;
if (cu_get_str_prop(inst, "InstanceID", &id) != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
@@ -1016,9 +968,6 @@ static CMPIStatus update_resource_settin
{
CMPIArray *arr;
CMPIStatus s;
- struct inst_list list;
-
- inst_list_init(&list);
if (cu_get_array_arg(argsin, "ResourceSettings", &arr) != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
@@ -1027,20 +976,16 @@ static CMPIStatus update_resource_settin
goto out;
}
- parse_str_inst_array(arr, NAMESPACE(ref), &list);
-
- s = _update_resource_settings(ref, &list, func);
-
- out:
- inst_list_free(&list);
-
+ s = _update_resource_settings(ref, arr, func);
+
+ out:
return s;
}
static CMPIStatus rasd_refs_to_insts(const CMPIContext *ctx,
const CMPIObjectPath *reference,
CMPIArray *arr,
- struct inst_list *list)
+ CMPIArray **ret_arr)
{
CMPIStatus s;
int i;
@@ -1049,6 +994,11 @@ static CMPIStatus rasd_refs_to_insts(con
c = CMGetArrayCount(arr, &s);
if (s.rc != CMPI_RC_OK)
return s;
+
+ *ret_arr = CMNewArray(_BROKER,
+ c,
+ CMPI_instance,
+ &s);
for (i = 0; i < c; i++) {
CMPIData d;
@@ -1079,7 +1029,9 @@ static CMPIStatus rasd_refs_to_insts(con
inst = get_rasd_instance(ctx, reference, _BROKER, id, type);
if (inst != NULL)
- inst_list_add(list, inst);
+ CMSetArrayElementAt(*ret_arr, i,
+ &inst,
+ CMPI_instance);
else
CU_DEBUG("Failed to get instance for `%s'",
REF2STR(ref));
@@ -1122,10 +1074,8 @@ static CMPIStatus rm_resource_settings(C
*/
CMPIArray *arr;
+ CMPIArray *resource_arr;
CMPIStatus s;
- struct inst_list list;
-
- inst_list_init(&list);
if (cu_get_array_arg(argsin, "ResourceSettings", &arr) != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
@@ -1134,23 +1084,21 @@ static CMPIStatus rm_resource_settings(C
goto out;
}
- s = rasd_refs_to_insts(context, reference, arr, &list);
+ s = rasd_refs_to_insts(context, reference, arr, &resource_arr);
if (s.rc != CMPI_RC_OK)
goto out;
- s = _update_resource_settings(reference, &list, resource_del);
- out:
- inst_list_free(&list);
-
+ s = _update_resource_settings(reference, resource_arr, resource_del);
+ out:
return s;
}
static struct method_handler DefineSystem = {
.name = "DefineSystem",
.handler = define_system,
- .args = {{"SystemSettings", CMPI_string},
- {"ResourceSettings", CMPI_stringA},
- {"ReferencedConfiguration", CMPI_string},
+ .args = {{"SystemSettings", CMPI_instance},
+ {"ResourceSettings", CMPI_instanceA},
+ {"ReferenceConfiguration", CMPI_string},
ARG_END
}
};
@@ -1167,7 +1115,7 @@ static struct method_handler AddResource
.name = "AddResourceSettings",
.handler = add_resource_settings,
.args = {{"AffectedConfiguration", CMPI_ref},
- {"ResourceSettings", CMPI_stringA},
+ {"ResourceSettings", CMPI_instanceA},
ARG_END
}
};
@@ -1175,7 +1123,7 @@ static struct method_handler ModifyResou
static struct method_handler ModifyResourceSettings = {
.name = "ModifyResourceSettings",
.handler = mod_resource_settings,
- .args = {{"ResourceSettings", CMPI_stringA},
+ .args = {{"ResourceSettings", CMPI_instanceA},
ARG_END
}
};
@@ -1183,7 +1131,7 @@ static struct method_handler ModifySyste
static struct method_handler ModifySystemSettings = {
.name = "ModifySystemSettings",
.handler = mod_system_settings,
- .args = {{"SystemSettings", CMPI_string},
+ .args = {{"SystemSettings", CMPI_instance},
ARG_END
}
};
16 years, 11 months
lowercase of instanceid in Virt_MigrationJob instance
by Guo Lian Yun
Hi,
The key name of instanceid is not case sensitive in ein or gi operation.
Generally, it's written by "InstanceID" in querying result, but
Virt_MigrationJob
instance is different, the ein output as following:
...
localhost:5988/root/virt:Virt_MigrationJob.instanceid="48814722-f6d7-4ba5-b2db-6bf3242bd281"
localhost:5988/root/virt:Virt_MigrationJob.instanceid="36529c45-8aed-425e-ad57-7f411b79d898"
...
I know it's a small problem, do you think we need to make it identify with
other instances?
Best,
Regards
Daisy Guo Lian Yun
E-mail: yunguol(a)cn.ibm.com
IBM China Development Lab, Shanghai, China
TEL: (86)-21-61008057
16 years, 11 months
[PATCH] Remove the embedded object parsing pieces from VirtualSystemManagmentService
by Kaitlin Rupert
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1201727729 28800
# Node ID f5608aab522382af73d5d57578c445590c1fdb10
# Parent b8d69e734306e618b4efb53e23c17ffdd8bab128
Remove the embedded object parsing pieces from VirtualSystemManagmentService.
Remove embedded object parsing since libcmpiutil now handles this. Also update the method handlers to expect instances instead of strings as arguments.
The following methods have been updated:
DefineSystem
AddResourceSettings
ModifyResourceSettings
ModifySystemSettings
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r b8d69e734306 -r f5608aab5223 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c Wed Jan 30 09:27:27 2008 -0800
+++ b/src/Virt_VirtualSystemManagementService.c Wed Jan 30 13:15:29 2008 -0800
@@ -57,69 +57,23 @@ enum ResourceAction {
RESOURCE_MOD,
};
-static int parse_str_inst_array(CMPIArray *array,
- const char *ns,
- struct inst_list *list)
-{
- int count;
- int i;
-
- count = CMGetArrayCount(array, NULL);
-
- for (i = 0; i < count; i++) {
- CMPIInstance *inst;
- CMPIData item;
- int ret;
-
- item = CMGetArrayElementAt(array, i, NULL);
- /* FIXME: Check for string here */
-
- ret = cu_parse_embedded_instance(CMGetCharPtr(item.value.string),
- _BROKER,
- ns,
- &inst);
-
- if (ret == 0)
- inst_list_add(list, inst);
- }
-
- return 1;
-}
-
static CMPIStatus define_system_parse_args(const CMPIArgs *argsin,
CMPIInstance **sys,
const char *ns,
- struct inst_list *res)
+ CMPIArray **res)
{
CMPIStatus s = {CMPI_RC_ERR_FAILED, NULL};
- const char *sys_str = NULL;
- CMPIArray *res_arr;
- int ret;
-
- if (cu_get_str_arg(argsin, "SystemSettings", &sys_str) != CMPI_RC_OK) {
+
+ if (cu_get_inst_arg(argsin, "SystemSettings", sys) != CMPI_RC_OK) {
CU_DEBUG("No SystemSettings string argument");
goto out;
}
- ret = cu_parse_embedded_instance(sys_str,
- _BROKER,
- ns,
- sys);
- if (ret) {
- CU_DEBUG("Unable to parse SystemSettings instance");
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "SystemSettings parse error");
- goto out;
- }
-
- if (cu_get_array_arg(argsin, "ResourceSettings", &res_arr) !=
+ if (cu_get_array_arg(argsin, "ResourceSettings", res) !=
CMPI_RC_OK) {
CU_DEBUG("Failed to get array arg");
goto out;
}
-
- ret = parse_str_inst_array(res_arr, ns, res);
CMSetStatus(&s, CMPI_RC_OK);
@@ -317,24 +271,34 @@ static int rasd_to_vdev(CMPIInstance *in
return 0;
}
-static int classify_resources(struct inst_list *all,
+static int classify_resources(CMPIArray *resources,
struct domain *domain)
{
int i;
uint16_t type;
+ int count;
domain->dev_disk_ct = domain->dev_net_ct = 0;
domain->dev_vcpu_ct = domain->dev_mem_ct = 0;
-
- domain->dev_disk = calloc(all->cur, sizeof(struct virt_device));
- domain->dev_vcpu = calloc(all->cur, sizeof(struct virt_device));
- domain->dev_mem = calloc(all->cur, sizeof(struct virt_device));
- domain->dev_net = calloc(all->cur, sizeof(struct virt_device));
-
- for (i = 0; i < all->cur; i++) {
+
+ count = CMGetArrayCount(resources, NULL);
+ if (count < 1)
+ return 0;
+
+ domain->dev_disk = calloc(count, sizeof(struct virt_device));
+ domain->dev_vcpu = calloc(count, sizeof(struct virt_device));
+ domain->dev_mem = calloc(count, sizeof(struct virt_device));
+ domain->dev_net = calloc(count, sizeof(struct virt_device));
+
+ for (i = 0; i < count; i++) {
CMPIObjectPath *op;
-
- op = CMGetObjectPath(all->list[i], NULL);
+ CMPIData item;
+
+ item = CMGetArrayElementAt(resources, i, NULL);
+ if (CMIsNullObject(item.value.inst))
+ return 0;
+
+ op = CMGetObjectPath(item.value.inst, NULL);
if (op == NULL)
return 0;
@@ -343,16 +307,16 @@ static int classify_resources(struct ins
return 0;
if (type == CIM_RASD_TYPE_PROC)
- rasd_to_vdev(all->list[i],
+ rasd_to_vdev(item.value.inst,
&domain->dev_vcpu[domain->dev_vcpu_ct++]);
else if (type == CIM_RASD_TYPE_MEM)
- rasd_to_vdev(all->list[i],
+ rasd_to_vdev(item.value.inst,
&domain->dev_mem[domain->dev_mem_ct++]);
else if (type == CIM_RASD_TYPE_DISK)
- rasd_to_vdev(all->list[i],
+ rasd_to_vdev(item.value.inst,
&domain->dev_disk[domain->dev_disk_ct++]);
else if (type == CIM_RASD_TYPE_NET)
- rasd_to_vdev(all->list[i],
+ rasd_to_vdev(item.value.inst,
&domain->dev_net[domain->dev_net_ct++]);
}
@@ -398,7 +362,7 @@ static CMPIInstance *connect_and_create(
}
static CMPIInstance *create_system(CMPIInstance *vssd,
- struct inst_list *resources,
+ CMPIArray *resources,
const CMPIObjectPath *ref,
CMPIStatus *s)
{
@@ -467,10 +431,8 @@ static CMPIStatus define_system(CMPIMeth
CMPIInstance *vssd;
CMPIInstance *sys;
CMPIObjectPath *sys_op;
- struct inst_list res;
+ CMPIArray *res;
CMPIStatus s;
-
- inst_list_init(&res);
CU_DEBUG("DefineSystem");
@@ -478,11 +440,9 @@ static CMPIStatus define_system(CMPIMeth
if (s.rc != CMPI_RC_OK)
goto out;
- sys = create_system(vssd, &res, reference, &s);
+ sys = create_system(vssd, res, reference, &s);
if (sys == NULL)
goto out;
-
- inst_list_free(&res);
CMAddArg(argsout, "ResultingSystem", &sys, CMPI_instance);
@@ -623,27 +583,14 @@ static CMPIStatus mod_system_settings(CM
const CMPIArgs *argsin,
CMPIArgs *argsout)
{
- const char *inst_str;
CMPIInstance *inst;
- if (cu_get_str_arg(argsin, "SystemSettings", &inst_str) != CMPI_RC_OK) {
+ if (cu_get_inst_arg(argsin, "SystemSettings", &inst) != CMPI_RC_OK) {
CMPIStatus s;
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
"Missing SystemSettings");
- return s;
- }
-
- if (cu_parse_embedded_instance(inst_str,
- _BROKER,
- NAMESPACE(reference),
- &inst)) {
- CMPIStatus s;
-
- cu_statusf(_BROKER, &s,
- CMPI_RC_ERR_FAILED,
- "Internal Parse Error on SystemSettings");
return s;
}
@@ -953,23 +900,30 @@ static CMPIStatus _update_resources_for(
}
static CMPIStatus _update_resource_settings(const CMPIObjectPath *ref,
- struct inst_list *list,
+ CMPIArray *resources,
resmod_fn func)
{
int i;
virConnectPtr conn = NULL;
CMPIStatus s;
+ int count;
conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s);
if (conn == NULL)
goto out;
- for (i = 0; i < list->cur; i++) {
- CMPIInstance *inst = list->list[i];
+ count = CMGetArrayCount(resources, NULL);
+
+ for (i = 0; i < count; i++) {
+ CMPIData item;
+ CMPIInstance *inst;
const char *id = NULL;
char *name = NULL;
char *devid = NULL;
virDomainPtr dom = NULL;
+
+ item = CMGetArrayElementAt(resources, i, NULL);
+ inst = item.value.inst;
if (cu_get_str_prop(inst, "InstanceID", &id) != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
@@ -1027,9 +981,7 @@ static CMPIStatus update_resource_settin
goto out;
}
- parse_str_inst_array(arr, NAMESPACE(ref), &list);
-
- s = _update_resource_settings(ref, &list, func);
+ s = _update_resource_settings(ref, arr, func);
out:
inst_list_free(&list);
@@ -1040,7 +992,7 @@ static CMPIStatus rasd_refs_to_insts(con
static CMPIStatus rasd_refs_to_insts(const CMPIContext *ctx,
const CMPIObjectPath *reference,
CMPIArray *arr,
- struct inst_list *list)
+ CMPIArray **out_arr)
{
CMPIStatus s;
int i;
@@ -1049,6 +1001,11 @@ static CMPIStatus rasd_refs_to_insts(con
c = CMGetArrayCount(arr, &s);
if (s.rc != CMPI_RC_OK)
return s;
+
+ *out_arr = CMNewArray(_BROKER,
+ c,
+ CMPI_instance,
+ &s);
for (i = 0; i < c; i++) {
CMPIData d;
@@ -1079,7 +1036,9 @@ static CMPIStatus rasd_refs_to_insts(con
inst = get_rasd_instance(ctx, reference, _BROKER, id, type);
if (inst != NULL)
- inst_list_add(list, inst);
+ CMSetArrayElementAt(*out_arr, i,
+ &inst,
+ CMPI_instance);
else
CU_DEBUG("Failed to get instance for `%s'",
REF2STR(ref));
@@ -1122,10 +1081,8 @@ static CMPIStatus rm_resource_settings(C
*/
CMPIArray *arr;
+ CMPIArray *resource_arr;
CMPIStatus s;
- struct inst_list list;
-
- inst_list_init(&list);
if (cu_get_array_arg(argsin, "ResourceSettings", &arr) != CMPI_RC_OK) {
cu_statusf(_BROKER, &s,
@@ -1134,22 +1091,20 @@ static CMPIStatus rm_resource_settings(C
goto out;
}
- s = rasd_refs_to_insts(context, reference, arr, &list);
+ s = rasd_refs_to_insts(context, reference, arr, &resource_arr);
if (s.rc != CMPI_RC_OK)
goto out;
- s = _update_resource_settings(reference, &list, resource_del);
- out:
- inst_list_free(&list);
-
+ s = _update_resource_settings(reference, resource_arr, resource_del);
+ out:
return s;
}
static struct method_handler DefineSystem = {
.name = "DefineSystem",
.handler = define_system,
- .args = {{"SystemSettings", CMPI_string},
- {"ResourceSettings", CMPI_stringA},
+ .args = {{"SystemSettings", CMPI_instance},
+ {"ResourceSettings", CMPI_instanceA},
{"ReferencedConfiguration", CMPI_string},
ARG_END
}
@@ -1167,7 +1122,7 @@ static struct method_handler AddResource
.name = "AddResourceSettings",
.handler = add_resource_settings,
.args = {{"AffectedConfiguration", CMPI_ref},
- {"ResourceSettings", CMPI_stringA},
+ {"ResourceSettings", CMPI_instanceA},
ARG_END
}
};
@@ -1175,7 +1130,7 @@ static struct method_handler ModifyResou
static struct method_handler ModifyResourceSettings = {
.name = "ModifyResourceSettings",
.handler = mod_resource_settings,
- .args = {{"ResourceSettings", CMPI_stringA},
+ .args = {{"ResourceSettings", CMPI_instanceA},
ARG_END
}
};
@@ -1183,7 +1138,7 @@ static struct method_handler ModifySyste
static struct method_handler ModifySystemSettings = {
.name = "ModifySystemSettings",
.handler = mod_system_settings,
- .args = {{"SystemSettings", CMPI_string},
+ .args = {{"SystemSettings", CMPI_instance},
ARG_END
}
};
16 years, 11 months
[PATCH 0 of 3] #2 - Device: fix getInstance issues
by Heidi Eckhart
- getInstance with wrong hypervisor segfaults
- getInstance returns with FAILED instead of NOT_FOUND
- SystemCreationClassName not set in key properties
diff to patch set 1:
- close connection to libvirt in 3rd patch now
16 years, 11 months
[PATCH] [CU] Fix crash on invalid method name in std_invokemethod
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1201714058 28800
# Node ID 508066eaa4b4f521b7b5f959b9f0d2c4f1b810fe
# Parent fd28a485f90399d166eb62816c32e2d7727cced6
[CU] Fix crash on invalid method name in std_invokemethod
I have no idea how this one slipped in, because it should always cause
a crash if the method the client asks for isn't offered.
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r fd28a485f903 -r 508066eaa4b4 std_invokemethod.c
--- a/std_invokemethod.c Wed Jan 16 07:43:41 2008 -0800
+++ b/std_invokemethod.c Wed Jan 30 09:27:38 2008 -0800
@@ -92,7 +92,7 @@ CMPIStatus _std_invokemethod(CMPIMethodM
CU_DEBUG("Method `%s' execution attempted", methodname);
- for (hi = 0; ctx->handlers[hi]->name; hi++) {
+ for (hi = 0; ctx->handlers[hi]; hi++) {
if (STREQ(methodname, ctx->handlers[hi]->name)) {
h = ctx->handlers[hi];
break;
16 years, 11 months
[PATCH] Fix migration with libvirt-0.4.0
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1201719178 28800
# Node ID 2920e184226248f7885dd87a28e30eb1a90005c9
# Parent b8d69e734306e618b4efb53e23c17ffdd8bab128
Fix migration with libvirt-0.4.0
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r b8d69e734306 -r 2920e1842262 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Wed Jan 30 09:27:27 2008 -0800
+++ b/src/Virt_VSMigrationService.c Wed Jan 30 10:52:58 2008 -0800
@@ -80,7 +80,7 @@ static char *dest_uri(const char *cn,
return NULL;
}
- if (asprintf(&uri, "%s://%s/", tport, dest) == -1)
+ if (asprintf(&uri, "%s://%s/system", tport, dest) == -1)
uri = NULL;
return uri;
16 years, 11 months
[PATCH] Fix migration schema per Jim's comment (from months ago)
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1201708774 28800
# Node ID 582dbca831385ad2221128e2ae7189fd15691102
# Parent 1edd65bed40d4f560942eee3e9bec25515a09770
Fix migration schema per Jim's comment (from months ago)
As a result, change the migratable checks to return a boolean
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 1edd65bed40d -r 582dbca83138 schema/VSMigrationService.mof
--- a/schema/VSMigrationService.mof Wed Jan 30 12:42:52 2008 +0100
+++ b/schema/VSMigrationService.mof Wed Jan 30 07:59:34 2008 -0800
@@ -3,34 +3,66 @@
// Placeholder definition until schema is available upstream
class CIM_VirtualSystemMigrationService : CIM_Service {
- uint32 VirtualSystemIsMigratableToHost(
- [Out]
- CIM_ConcreteJob REF Job,
- [In, EmbeddedInstance("CIM_ResourceAllocationSettingData")]
- string NewResourceSettingData[],
+ uint32 CheckVirtualSystemIsMigratableToHost(
+ [In]
+ CIM_ComputerSystem REF ComputerSystem,
+ [In]
+ string DestinationHost,
[In, EmbeddedInstance("CIM_SettingData")]
string MigrationSettingData,
[In, EmbeddedInstance("CIM_VirtualSystemSettingData")]
string NewSystemSettingData,
+ [In, EmbeddedInstance("CIM_ResourceAllocationSettingData")]
+ string NewResourceSettingData[],
+ [Out]
+ boolean IsMigratable
+ );
+
+ uint32 CheckVirtualSystemIsMigratableToSystem(
[In]
CIM_ComputerSystem REF ComputerSystem,
[In]
- string DestinationHost);
-
- uint32 MigrateVirtualSystemToHost(
- [Out]
- CIM_ConcreteJob REF Job,
- [In, EmbeddedInstance("CIM_ResourceAllocationSettingData")]
- string NewResourceSettingData[],
+ CIM_System REF DestinationSystem,
[In, EmbeddedInstance("CIM_SettingData")]
string MigrationSettingData,
[In, EmbeddedInstance("CIM_VirtualSystemSettingData")]
string NewSystemSettingData,
+ [In, EmbeddedInstance("CIM_ResourceAllocationSettingData")]
+ string NewResourceSettingData[],
+ [Out]
+ boolean IsMigratable
+ );
+
+
+ uint32 MigrateVirtualSystemToHost(
[In]
CIM_ComputerSystem REF ComputerSystem,
[In]
- string DestinationHost);
+ string DestinationHost,
+ [In, EmbeddedInstance("CIM_SettingData")]
+ string MigrationSettingData,
+ [In, EmbeddedInstance("CIM_VirtualSystemSettingData")]
+ string NewSystemSettingData,
+ [In, EmbeddedInstance("CIM_ResourceAllocationSettingData")]
+ string NewResourceSettingData[],
+ [Out]
+ CIM_ConcreteJob REF Job
+ );
+ uint32 MigrateVirtualSystemToHost(
+ [In]
+ CIM_ComputerSystem REF ComputerSystem,
+ [In]
+ CIM_System REF DestinationSystem,
+ [In, EmbeddedInstance("CIM_SettingData")]
+ string MigrationSettingData,
+ [In, EmbeddedInstance("CIM_VirtualSystemSettingData")]
+ string NewSystemSettingData,
+ [In, EmbeddedInstance("CIM_ResourceAllocationSettingData")]
+ string NewResourceSettingData[],
+ [Out]
+ CIM_ConcreteJob REF Job
+ );
};
class Virt_MigrationJob : CIM_ConcreteJob {
diff -r 1edd65bed40d -r 582dbca83138 src/Virt_VSMigrationService.c
--- a/src/Virt_VSMigrationService.c Wed Jan 30 12:42:52 2008 +0100
+++ b/src/Virt_VSMigrationService.c Wed Jan 30 07:59:34 2008 -0800
@@ -131,13 +131,15 @@ static CMPIStatus vs_migratable(const CM
static CMPIStatus vs_migratable(const CMPIObjectPath *ref,
const char *domain,
const char *destination,
- const CMPIResult *results)
+ const CMPIResult *results,
+ CMPIArgs *argsout)
{
CMPIStatus s;
char *uri = NULL;
virConnectPtr conn = NULL;
virConnectPtr dconn = NULL;
uint32_t retcode = 1;
+ CMPIBoolean isMigratable = 0;
uri = dest_uri(CLASSNAME(ref), destination);
if (uri == NULL) {
@@ -173,6 +175,10 @@ static CMPIStatus vs_migratable(const CM
out:
CMReturnData(results, (CMPIValue *)&retcode, CMPI_uint32);
+
+ isMigratable = (retcode == 0);
+ CMAddArg(argsout, "IsMigratable",
+ (CMPIValue *)&isMigratable, CMPI_boolean);
free(uri);
virConnectClose(conn);
@@ -212,7 +218,7 @@ static CMPIStatus vs_migratable_host(CMP
return s;
}
- return vs_migratable(ref, name, dhost, results);
+ return vs_migratable(ref, name, dhost, results, argsout);
}
static CMPIStatus vs_migratable_system(CMPIMethodMI *self,
@@ -255,7 +261,7 @@ static CMPIStatus vs_migratable_system(C
return s;
}
- return vs_migratable(ref, name, dname, results);
+ return vs_migratable(ref, name, dname, results, argsout);
}
static void migrate_job_set_state(struct migration_job *job,
@@ -620,7 +626,7 @@ static CMPIStatus migrate_vs_system(CMPI
}
static struct method_handler vsimth = {
- .name = "VirtualSystemIsMigratableToHost",
+ .name = "CheckVirtualSystemIsMigratableToHost",
.handler = vs_migratable_host,
.args = {{"ComputerSystem", CMPI_ref},
{"DestinationHost", CMPI_string},
@@ -629,7 +635,7 @@ static struct method_handler vsimth = {
};
static struct method_handler vsimts = {
- .name = "VirtualSystemIsMigratableToSystem",
+ .name = "CheckVirtualSystemIsMigratableToSystem",
.handler = vs_migratable_system,
.args = {{"ComputerSystem", CMPI_ref},
{"DestinationSystem", CMPI_ref},
16 years, 11 months
[PATCH] ComputerSystem: getInstance with wrong hypervisor segfaults
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1201179188 -3600
# Node ID 2a4ee3b11a8e2879597b6e312eaa8ccdd1e56aef
# Parent dc5a3cf2e717e2630958454211bc7e0e4b8b2e94
ComputerSystem: getInstance with wrong hypervisor segfaults
wbemgi 'http://localhost:5988/root/virt:Xen_ComputerSystem.CreationClassName="KVM_ComputerSystem",Name="qemu1"'
on a KVM system seg faults.
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r dc5a3cf2e717 -r 2a4ee3b11a8e src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Thu Jan 24 13:28:14 2008 +0100
+++ b/src/Virt_ComputerSystem.c Thu Jan 24 13:53:08 2008 +0100
@@ -394,8 +394,12 @@ CMPIStatus get_domain(const CMPIBroker *
}
conn = connect_by_classname(broker, CLASSNAME(reference), &s);
- if (conn == NULL)
+ if (conn == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "No such instance.");
return s;
+ }
_inst = instance_from_name(broker, conn, name, reference);
if (_inst == NULL) {
16 years, 11 months
[PATCH] DevicePool: getInstance with wrong hypervisor segfaults
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1201693372 -3600
# Node ID 9494f6f1f1677389b6ad5dbfb01776795b483d11
# Parent a531911a2284fed43b764f5137b7f84ea135fc50
DevicePool: getInstance with wrong hypervisor segfaults
wbemgi 'http://localhost:5988/root/virt:Xen_ProcessorPool.InstanceID="ProcessorPool/0"'
on a KVM system segfaults.
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r a531911a2284 -r 9494f6f1f167 src/Virt_DevicePool.c
--- a/src/Virt_DevicePool.c Mon Jan 28 12:20:27 2008 -0800
+++ b/src/Virt_DevicePool.c Wed Jan 30 12:42:52 2008 +0100
@@ -826,8 +826,12 @@ CMPIStatus get_pool_inst(const CMPIBroke
}
conn = connect_by_classname(broker, CLASSNAME(reference), &s);
- if (conn == NULL)
- goto out;
+ if (conn == NULL) {
+ cu_statusf(broker, &s,
+ CMPI_RC_ERR_NOT_FOUND,
+ "No such instance");
+ goto out;
+ }
inst = get_pool_by_id(broker, conn, id, NAMESPACE(reference));
if (inst == NULL)
16 years, 11 months