Fix <features> block. Only include ID & VNC port for active domain XML

This commit is contained in:
Daniel P. Berrange 2007-02-14 21:47:59 +00:00
parent 8dca13efc1
commit 31ea5e9733
2 changed files with 17 additions and 12 deletions

View File

@ -1,3 +1,8 @@
Wed Feb 14 16:47:24 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* qemud/conf.c: Fixed generation of <features> block, and
don't include ID, or VNC port in inactive XML generation
Wed Feb 14 16:45:24 EST 2007 Daniel P. Berrange <berrange@redhat.com> Wed Feb 14 16:45:24 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_internal.c: Fixed path to the libvirt_qemud * src/qemu_internal.c: Fixed path to the libvirt_qemud

View File

@ -1725,7 +1725,7 @@ char *qemudGenerateXML(struct qemud_server *server, struct qemud_vm *vm, int liv
goto cleanup; goto cleanup;
} }
if (vm->id >= 0) { if (vm->id >= 0 && live) {
if (qemudBufferPrintf(&buf, "<domain type='%s' id='%d'>\n", type, vm->id) < 0) if (qemudBufferPrintf(&buf, "<domain type='%s' id='%d'>\n", type, vm->id) < 0)
goto no_memory; goto no_memory;
} else { } else {
@ -1772,16 +1772,6 @@ char *qemudGenerateXML(struct qemud_server *server, struct qemud_vm *vm, int liv
if (qemudBufferPrintf(&buf, " <cmdline>%s</cmdline>\n", def->os.cmdline) < 0) if (qemudBufferPrintf(&buf, " <cmdline>%s</cmdline>\n", def->os.cmdline) < 0)
goto no_memory; goto no_memory;
if (def->features & QEMUD_FEATURE_ACPI) {
if (qemudBufferAdd(&buf, " <features>\n") < 0)
goto no_memory;
if (qemudBufferAdd(&buf, " <acpi>\n") < 0)
goto no_memory;
if (qemudBufferAdd(&buf, " </features>\n") < 0)
goto no_memory;
}
for (n = 0 ; n < def->os.nBootDevs ; n++) { for (n = 0 ; n < def->os.nBootDevs ; n++) {
const char *boottype = "hd"; const char *boottype = "hd";
switch (def->os.bootDevs[n]) { switch (def->os.bootDevs[n]) {
@ -1805,6 +1795,16 @@ char *qemudGenerateXML(struct qemud_server *server, struct qemud_vm *vm, int liv
if (qemudBufferAdd(&buf, " </os>\n") < 0) if (qemudBufferAdd(&buf, " </os>\n") < 0)
goto no_memory; goto no_memory;
if (def->features & QEMUD_FEATURE_ACPI) {
if (qemudBufferAdd(&buf, " <features>\n") < 0)
goto no_memory;
if (qemudBufferAdd(&buf, " <acpi/>\n") < 0)
goto no_memory;
if (qemudBufferAdd(&buf, " </features>\n") < 0)
goto no_memory;
}
if (qemudBufferAdd(&buf, " <devices>\n") < 0) if (qemudBufferAdd(&buf, " <devices>\n") < 0)
goto no_memory; goto no_memory;
@ -1888,7 +1888,7 @@ char *qemudGenerateXML(struct qemud_server *server, struct qemud_vm *vm, int liv
if (def->graphicsType == QEMUD_GRAPHICS_VNC) { if (def->graphicsType == QEMUD_GRAPHICS_VNC) {
if (def->vncPort) { if (def->vncPort) {
qemudBufferPrintf(&buf, " <graphics type='vnc' port='%d'/>\n", qemudBufferPrintf(&buf, " <graphics type='vnc' port='%d'/>\n",
vm->id == -1 ? def->vncPort : def->vncActivePort); vm->id >= 0 && live ? def->vncActivePort : def->vncPort);
} else { } else {
qemudBufferPrintf(&buf, " <graphics type='vnc'/>\n"); qemudBufferPrintf(&buf, " <graphics type='vnc'/>\n");
} }