+Tue Jun 16 14:30:05 EDT 2009 Cole Robinson <crobinso@redhat.com>
+
+ * src/domain_conf.c
+ tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args
+ tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml:
+ Allow USB hostdev product to be 0x0000
+
Tue Jun 16 11:43:17 EDT 2009 Cole Robinson <crobinso@redhat.com>
* src/storage_backend_fs.c: Fix FS volume creation with backing stores.
int flags ATTRIBUTE_UNUSED) {
int ret = -1;
+ int got_product, got_vendor;
xmlNodePtr cur;
+ /* Product can validly be 0, so we need some extra help to determine
+ * if it is uninitialized*/
+ got_product = 0;
+ got_vendor = 0;
+
cur = node->children;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
char *vendor = virXMLPropString(cur, "id");
if (vendor) {
+ got_vendor = 1;
if (virStrToLong_ui(vendor, NULL, 0,
&def->source.subsys.u.usb.vendor) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
char* product = virXMLPropString(cur, "id");
if (product) {
+ got_product = 1;
if (virStrToLong_ui(product, NULL, 0,
&def->source.subsys.u.usb.product) < 0) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
cur = cur->next;
}
- if (def->source.subsys.u.usb.vendor == 0 &&
- def->source.subsys.u.usb.product != 0) {
+ if (got_vendor && def->source.subsys.u.usb.vendor == 0) {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("vendor cannot be 0."));
+ goto out;
+ }
+
+ if (!got_vendor && got_product) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("missing vendor"));
goto out;
}
- if (def->source.subsys.u.usb.vendor != 0 &&
- def->source.subsys.u.usb.product == 0) {
+ if (got_vendor && !got_product) {
virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
"%s", _("missing product"));
goto out;