[PATCH] Add support for "xen" input bus type

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1227551275 28800 # Node ID db393eb037a0782d2e8328d2e2fd0582e185f08b # Parent 598515fe705be5738226bb0fe789d7645769e4f3 Add support for "xen" input bus type Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r 598515fe705b -r db393eb037a0 src/Virt_Device.c --- a/src/Virt_Device.c Fri Nov 21 15:08:33 2008 -0800 +++ b/src/Virt_Device.c Mon Nov 24 10:27:55 2008 -0800 @@ -242,6 +242,8 @@ bus_str = "USB"; else if (STREQC(bus, "ps2")) bus_str = "PS2"; + else if (STREQC(bus, "xen")) + bus_str = "Xen"; else bus_str = "Unknown bus"; diff -r 598515fe705b -r db393eb037a0 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Fri Nov 21 15:08:33 2008 -0800 +++ b/src/Virt_SettingsDefineCapabilities.c Mon Nov 24 10:27:55 2008 -0800 @@ -761,6 +761,7 @@ const char *id, const char *type, const char *bus, + const char *caption, struct inst_list *list) { CMPIStatus s = {CMPI_RC_OK, NULL}; @@ -773,6 +774,15 @@ CMPI_RC_ERR_NOT_FOUND, "Unable to build input caption"); return s; + } + + if (caption != NULL) { + if (asprintf(&cap, "%s %s", caption, cap) == -1) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_NOT_FOUND, + "Unable to build input caption"); + goto out; + } } inst = sdc_rasd_inst(&s, ref, CIM_RES_TYPE_INPUT); @@ -799,11 +809,20 @@ { const char *id; CMPIStatus s = {CMPI_RC_OK, NULL}; - const char *inputs[4][2] = { {"mouse", "ps2"}, - {"mouse", "usb"}, - {"tablet", "usb"}, - {NULL, NULL} - }; + const char *xen_inputs[4][3] = { {"mouse", "ps2", "FV"}, + {"mouse", "usb", "FV"}, + {"mouse", "xen", "PV"}, + {NULL, NULL, NULL} + }; + const char *kvm_inputs[4][3] = { {"mouse", "ps2", NULL}, + {"mouse", "usb", NULL}, + {"tablet", "usb", NULL}, + {NULL, NULL, NULL} + }; + const char *lxc_inputs[4][3] = { {"mouse", "usb", NULL}, + {NULL, NULL, NULL} + }; + char *pfx = NULL; int i; switch(template_type) { @@ -826,13 +845,50 @@ goto out; } - for(i = 0; inputs[i][0] != NULL; i++) { - s = set_input_props(ref, id, inputs[i][0], inputs[i][1], list); - if (s.rc != CMPI_RC_OK) - goto out; + pfx = class_prefix_name(CLASSNAME(ref)); + + if (STREQ(pfx, "Xen")) { + for(i = 0; xen_inputs[i][0] != NULL; i++) { + s = set_input_props(ref, + id, + xen_inputs[i][0], + xen_inputs[i][1], + xen_inputs[i][2], + list); + if (s.rc != CMPI_RC_OK) + goto out; + } + } else if (STREQ(pfx, "KVM")) { + for(i = 0; kvm_inputs[i][0] != NULL; i++) { + s = set_input_props(ref, + id, + kvm_inputs[i][0], + kvm_inputs[i][1], + kvm_inputs[i][2], + list); + if (s.rc != CMPI_RC_OK) + goto out; + } + } else if (STREQ(pfx, "LXC")) { + for(i = 0; lxc_inputs[i][0] != NULL; i++) { + s = set_input_props(ref, + id, + lxc_inputs[i][0], + lxc_inputs[i][1], + lxc_inputs[i][2], + list); + if (s.rc != CMPI_RC_OK) + goto out; + } + } else { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, + "Unsupported guest type"); + goto out; } out: + free(pfx); return s; }
participants (1)
-
Kaitlin Rupert