floppy0.present defaults to true. Therefore, it needs to be
explicitly set to false when the XML config doesn't specify the
corresponding floppy device.
---
v2:
- This issue affects ESX too, the assumed default was wrong in
general
- Explicitly disable unused floppy devices independent of the
product version
src/esx/esx_vmx.c | 19 +++++++++++++++----
src/esx/esx_vmx.h | 2 +-
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/esx/esx_vmx.c b/src/esx/esx_vmx.c
index d5d9ff0..12cd005 100644
--- a/src/esx/esx_vmx.c
+++ b/src/esx/esx_vmx.c
@@ -215,7 +215,7 @@ def->disks[0]...
## disks: floppy from .flp image ###############################################
- floppy0.present = "true"
# defaults to "false"
+ floppy0.present = "true"
# defaults to "true"
floppy0.startConnected = "true"
# defaults to "true"
floppy0.clientDevice = "false"
# defaults to "false"
@@ -235,7 +235,7 @@ def->disks[0]...
## disks: floppy from host device ##############################################
- floppy0.present = "true"
# defaults to "false"
+ floppy0.present = "true"
# defaults to "true"
floppy0.startConnected = "true"
# defaults to "true"
floppy0.clientDevice = "false"
# defaults to "false"
@@ -2320,6 +2320,7 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps,
virDomainDefPtr def,
virBuffer buffer = VIR_BUFFER_INITIALIZER;
bool scsi_present[4] = { false, false, false, false };
int scsi_virtualDev[4] = { -1, -1, -1, -1 };
+ bool floppy_present[2] = { false, false };
if (ctx->formatFileName == NULL) {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -2525,7 +2526,8 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps,
virDomainDefPtr def,
break;
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
- if (esxVMX_FormatFloppy(ctx, def->disks[i], &buffer) < 0) {
+ if (esxVMX_FormatFloppy(ctx, def->disks[i], &buffer,
+ floppy_present) < 0) {
goto failure;
}
@@ -2539,6 +2541,13 @@ esxVMX_FormatConfig(esxVMX_Context *ctx, virCapsPtr caps,
virDomainDefPtr def,
}
}
+ for (i = 0; i < 2; ++i) {
+ /* floppy[0..1].present defaults to true, disable it explicitly */
+ if (! floppy_present[i]) {
+ virBufferVSprintf(&buffer, "floppy%d.present =
\"false\"\n", i);
+ }
+ }
+
/* def:fss */
/* FIXME */
@@ -2810,7 +2819,7 @@ esxVMX_FormatCDROM(esxVMX_Context *ctx, virDomainDiskDefPtr def,
int
esxVMX_FormatFloppy(esxVMX_Context *ctx, virDomainDiskDefPtr def,
- virBufferPtr buffer)
+ virBufferPtr buffer, bool floppy_present[2])
{
int unit;
char *fileName = NULL;
@@ -2824,6 +2833,8 @@ esxVMX_FormatFloppy(esxVMX_Context *ctx, virDomainDiskDefPtr def,
return -1;
}
+ floppy_present[unit] = true;
+
virBufferVSprintf(buffer, "floppy%d.present = \"true\"\n",
unit);
if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) {
diff --git a/src/esx/esx_vmx.h b/src/esx/esx_vmx.h
index a77264a..12fc5af 100644
--- a/src/esx/esx_vmx.h
+++ b/src/esx/esx_vmx.h
@@ -137,7 +137,7 @@ esxVMX_FormatCDROM(esxVMX_Context *ctx, virDomainDiskDefPtr def,
int
esxVMX_FormatFloppy(esxVMX_Context *ctx, virDomainDiskDefPtr def,
- virBufferPtr buffer);
+ virBufferPtr buffer, bool floppy_present[2]);
int
esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,
--
1.7.0.4