提交 7c0cbe02 编写于 作者: M Matthias Bolte

esx: Explicitly disable unused floppy devices

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.

Also update tests accordingly.
上级 177e17e4
......@@ -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) {
......
......@@ -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,
......
......@@ -8,3 +8,5 @@ numvcpus = "1"
ide0:0.present = "true"
ide0:0.deviceType = "atapi-cdrom"
ide0:0.fileName = "/dev/scd0"
floppy0.present = "false"
floppy1.present = "false"
......@@ -8,3 +8,5 @@ numvcpus = "1"
ide0:0.present = "true"
ide0:0.deviceType = "cdrom-image"
ide0:0.fileName = "/vmfs/volumes/testing/isos/cdrom.iso"
floppy0.present = "false"
floppy1.present = "false"
......@@ -9,3 +9,5 @@ scsi0.present = "true"
scsi0:0.present = "true"
scsi0:0.deviceType = "atapi-cdrom"
scsi0:0.fileName = "/dev/scd0"
floppy0.present = "false"
floppy1.present = "false"
......@@ -9,3 +9,5 @@ scsi0.present = "true"
scsi0:0.present = "true"
scsi0:0.deviceType = "cdrom-image"
scsi0:0.fileName = "/vmfs/volumes/testing/isos/cdrom.iso"
floppy0.present = "false"
floppy1.present = "false"
......@@ -10,6 +10,8 @@ scsi0.virtualDev = "lsilogic"
scsi0:0.present = "true"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Fedora11/Fedora11.vmdk"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "bridged"
......
......@@ -30,6 +30,7 @@ ide1:1.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtDebian1
floppy0.present = "true"
floppy0.fileType = "device"
floppy0.fileName = "/dev/fd0"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.virtualDev = "vlance"
ethernet0.networkName = "VM Network"
......
......@@ -17,6 +17,7 @@ ide0:0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Isos/debian
floppy1.present = "true"
floppy1.fileType = "file"
floppy1.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Debian2/dummy.flp"
floppy0.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "bridged"
......
......@@ -10,6 +10,8 @@ scsi0.virtualDev = "lsilogic"
scsi0:0.present = "true"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/virtMonServ1.vmdk"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "bridged"
......
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "ethernet-bridged"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "bridged"
......
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "ethernet-custom"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "custom"
......
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "ethernet-e1000"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.virtualDev = "e1000"
ethernet0.networkName = "VM Network"
......
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "ethernet-generated"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "bridged"
......
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "ethernet-static"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "bridged"
......
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "ethernet-static"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "bridged"
......
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "ethernet-vmxnet2"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.virtualDev = "vmxnet"
ethernet0.features = "15"
......
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "ethernet-vpx"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "VM Network"
ethernet0.connectionType = "bridged"
......
......@@ -8,3 +8,4 @@ numvcpus = "1"
floppy0.present = "true"
floppy0.fileType = "device"
floppy0.fileName = "/dev/fd0"
floppy1.present = "false"
......@@ -8,3 +8,4 @@ numvcpus = "1"
floppy0.present = "true"
floppy0.fileType = "file"
floppy0.fileName = "/vmfs/volumes/testing/floppy.flp"
floppy1.present = "false"
......@@ -9,3 +9,5 @@ RemoteDisplay.vnc.enabled = "true"
RemoteDisplay.vnc.port = "5903"
RemoteDisplay.vnc.keymap = "de"
RemoteDisplay.vnc.password = "password"
floppy0.present = "false"
floppy1.present = "false"
......@@ -8,6 +8,8 @@ numvcpus = "1"
ide0:0.present = "true"
ide0:0.deviceType = "ata-hardDisk"
ide0:0.fileName = "/vmfs/volumes/storage/Server1/Debian-System1-0-cl2.vmdk"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "net1"
ethernet0.connectionType = "custom"
......
......@@ -8,6 +8,8 @@ numvcpus = "1"
ide0:0.present = "true"
ide0:0.deviceType = "ata-hardDisk"
ide0:0.fileName = "/vmfs/volumes/storage/Server2/Debian-System1-0-cl3.vmdk"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "net1"
ethernet0.connectionType = "custom"
......
......@@ -8,6 +8,8 @@ numvcpus = "1"
ide0:0.present = "true"
ide0:0.deviceType = "ata-hardDisk"
ide0:0.fileName = "/vmfs/volumes/storage/Router/Debian-System1-0-cl1.vmdk"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "net1"
ethernet0.connectionType = "custom"
......
......@@ -8,6 +8,8 @@ numvcpus = "1"
ide0:0.present = "true"
ide0:0.deviceType = "ata-hardDisk"
ide0:0.fileName = "/vmfs/volumes/storage/Client/Debian-System1-0-cl2.vmdk"
floppy0.present = "false"
floppy1.present = "false"
ethernet0.present = "true"
ethernet0.networkName = "net2"
ethernet0.connectionType = "custom"
......
......@@ -8,3 +8,5 @@ numvcpus = "1"
ide0:0.present = "true"
ide0:0.deviceType = "ata-hardDisk"
ide0:0.fileName = "/vmfs/volumes/datastore/directory/harddisk.vmdk"
floppy0.present = "false"
floppy1.present = "false"
......@@ -9,3 +9,5 @@ scsi0.present = "true"
scsi0:0.present = "true"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.fileName = "/vmfs/volumes/datastore/directory/harddisk.vmdk"
floppy0.present = "false"
floppy1.present = "false"
......@@ -5,3 +5,5 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "minimal-64bit"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
......@@ -5,3 +5,5 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "minimal"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "parallel-device"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
parallel0.present = "true"
parallel0.fileType = "device"
parallel0.fileName = "/dev/parallel0"
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "parallel-file"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
parallel0.present = "true"
parallel0.fileType = "file"
parallel0.fileName = "/vmfs/volumes/datastore/directory/parallel0.file"
......@@ -25,3 +25,5 @@ scsi2:0.fileName = "/vmfs/volumes/datastore/directory/harddisk3.vmdk"
scsi3:0.present = "true"
scsi3:0.deviceType = "scsi-hardDisk"
scsi3:0.fileName = "/vmfs/volumes/datastore/directory/harddisk4.vmdk"
floppy0.present = "false"
floppy1.present = "false"
......@@ -11,3 +11,5 @@ scsi0:0.present = "true"
scsi0:0.deviceType = "scsi-hardDisk"
scsi0:0.fileName = "/vmfs/volumes/datastore/directory/harddisk.vmdk"
scsi0:0.writeThrough = "true"
floppy0.present = "false"
floppy1.present = "false"
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "serial-device"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
serial0.present = "true"
serial0.fileType = "device"
serial0.fileName = "/dev/ttyS0"
......
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "serial-file"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
serial0.present = "true"
serial0.fileType = "file"
serial0.fileName = "/vmfs/volumes/datastore/directory/serial0.file"
......
......@@ -5,6 +5,8 @@ uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15"
displayName = "serial-pipe"
memsize = "4"
numvcpus = "1"
floppy0.present = "false"
floppy1.present = "false"
serial0.present = "true"
serial0.fileType = "pipe"
serial0.pipe.endPoint = "client"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册