提交 6335c2a0 编写于 作者: C Chris Lalancette

With the recent refactoring of the domain code, plus the changes with the Xend

code, a couple of bugs were introduced into the attach-disk and attach-interface
functionality.  This patch fixes 3 bugs:

1)  In xenDaemonAttachDevice(), there is a switch statement to determine which
of the xenDaemonFormatSxpr{Disk,Net} functions to call.  Unfortunately, the case
statements are all missing the corresponding "break", so we always fall-through
to the default error case.  This patch just adds the appropriate break statements.

2)  (minor) In xenDaemonDomainDefineXML (that's a mouthful!), there is a stray
"fprintf".  This is now converted to a proper virXendError().

3)  xenDaemonFormatSxpr{Disk,Net} were adding an extra (device to the front of
the sexpr expressions that xend did not expect (this is Xend on RHEL 5.2).
Because of this, the attaches would fail.  The patch fixes this by removing the
(device from the front, which makes attach-disk and attach-interface work again.
Signed-off-by: NChris Lalancette <clalance@redhat.com>
上级 8c300028
Tue Aug 5 18:43:00 CEST 2008 Chris Lalancette <clalance@redhat.com>
* src/xend_internal.c: Fix three bugs related to virsh attach-disk:
a) make sure to break in the xenDaemonAttachDevice() in the switch
b) convert a stray fprintf to a virXendError()
c) remove an additional "(device" on the front of the sexpr
expression passed to xend. This actually fixes virsh attach-disk
and virsh attach-interface work with Xen again
Tue Aug 5 18:36:00 CEST 2008 Chris Lalancette <clalance@redhat.com> Tue Aug 5 18:36:00 CEST 2008 Chris Lalancette <clalance@redhat.com>
* src/stats_linux.c tests/statstest.c: Update the parsing of disks for * src/stats_linux.c tests/statstest.c: Update the parsing of disks for
xen block statistics. In particular, add support for > 16 xvd devices xen block statistics. In particular, add support for > 16 xvd devices
......
...@@ -3900,6 +3900,7 @@ xenDaemonAttachDevice(virDomainPtr domain, const char *xml) ...@@ -3900,6 +3900,7 @@ xenDaemonAttachDevice(virDomainPtr domain, const char *xml)
STREQ(def->os.type, "hvm") ? 1 : 0, STREQ(def->os.type, "hvm") ? 1 : 0,
priv->xendConfigVersion) < 0) priv->xendConfigVersion) < 0)
goto cleanup; goto cleanup;
break;
case VIR_DOMAIN_DEVICE_NET: case VIR_DOMAIN_DEVICE_NET:
if (xenDaemonFormatSxprNet(domain->conn, if (xenDaemonFormatSxprNet(domain->conn,
...@@ -3908,6 +3909,7 @@ xenDaemonAttachDevice(virDomainPtr domain, const char *xml) ...@@ -3908,6 +3909,7 @@ xenDaemonAttachDevice(virDomainPtr domain, const char *xml)
STREQ(def->os.type, "hvm") ? 1 : 0, STREQ(def->os.type, "hvm") ? 1 : 0,
priv->xendConfigVersion) < 0) priv->xendConfigVersion) < 0)
goto cleanup; goto cleanup;
break;
default: default:
virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s", virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s",
...@@ -4292,7 +4294,8 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) { ...@@ -4292,7 +4294,8 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
ret = xend_op(conn, "", "op", "new", "config", sexpr, NULL); ret = xend_op(conn, "", "op", "new", "config", sexpr, NULL);
VIR_FREE(sexpr); VIR_FREE(sexpr);
if (ret != 0) { if (ret != 0) {
fprintf(stderr, _("Failed to create inactive domain %s\n"), name); virXendError(conn, VIR_ERR_XEN_CALL,
_("Failed to create inactive domain %s\n"), name);
goto error; goto error;
} }
...@@ -5029,7 +5032,6 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, ...@@ -5029,7 +5032,6 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
xendConfigVersion == 1) xendConfigVersion == 1)
return 0; return 0;
virBufferAddLit(buf, "(device ");
/* Normally disks are in a (device (vbd ...)) block /* Normally disks are in a (device (vbd ...)) block
* but blktap disks ended up in a differently named * but blktap disks ended up in a differently named
* (device (tap ....)) block.... */ * (device (tap ....)) block.... */
...@@ -5083,7 +5085,7 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED, ...@@ -5083,7 +5085,7 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
else else
virBufferAddLit(buf, "(mode 'w')"); virBufferAddLit(buf, "(mode 'w')");
virBufferAddLit(buf, "))"); virBufferAddLit(buf, ")");
return 0; return 0;
} }
...@@ -5117,7 +5119,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn, ...@@ -5117,7 +5119,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
return -1; return -1;
} }
virBufferAddLit(buf, "(device (vif "); virBufferAddLit(buf, "(vif ");
virBufferVSprintf(buf, virBufferVSprintf(buf,
"(mac '%02x:%02x:%02x:%02x:%02x:%02x')", "(mac '%02x:%02x:%02x:%02x:%02x:%02x')",
...@@ -5177,7 +5179,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn, ...@@ -5177,7 +5179,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
if ((hvm) && (xendConfigVersion < 4)) if ((hvm) && (xendConfigVersion < 4))
virBufferAddLit(buf, "(type ioemu)"); virBufferAddLit(buf, "(type ioemu)");
virBufferAddLit(buf, "))"); virBufferAddLit(buf, ")");
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册