## disks #######################################################################
scsi[0..3]:[0..6,8..15] -> <controller>:<unit> with 1 bus per controller
+ sata[0..3]:[0..29] -> <controller>:<unit> with 1 bus per controller
ide[0..1]:[0..1] -> <bus>:<unit> with 1 controller
floppy[0..1] -> <unit> with 1 controller and 1 bus per controller
->slotnum
+## disks: sata hard drive from .vmdk image #####################################
+
+ sata0.present = "true" # defaults to "false"
+ sata0:0.present = "true" # defaults to "false"
+ sata0:0.startConnected = "true" # defaults to "true"
+
+...
+->type = _DISK_TYPE_FILE <=> sata0:0.deviceType = "???" # defaults to ?
+->device = _DISK_DEVICE_DISK <=> sata0:0.deviceType = "???" # defaults to ?
+->bus = _DISK_BUS_SATA
+->src = <value>.vmdk <=> sata0:0.fileName = "<value>.vmdk"
+->dst = sd[<controller> * 30 + <unit> mapped to [a-z]+]
+->driverName = <driver> <=> sata0.virtualDev = "<driver>" # default depends on guestOS value
+->driverType
+->cachemode <=> sata0:0.writeThrough = "<value>" # defaults to false, true -> _DISK_CACHE_WRITETHRU, false _DISK_CACHE_DEFAULT
+->readonly
+->shared
+->slotnum
+
+
## disks: ide hard drive from .vmdk image ######################################
ide0:0.present = "true" # defaults to "false"
->slotnum
+## disks: sata cdrom from .iso image ###########################################
+
+ sata0.present = "true" # defaults to "false"
+ sata0:0.present = "true" # defaults to "false"
+ sata0:0.startConnected = "true" # defaults to "true"
+
+...
+->type = _DISK_TYPE_FILE <=> sata0:0.deviceType = "cdrom-image" # defaults to ?
+->device = _DISK_DEVICE_CDROM <=> sata0:0.deviceType = "cdrom-image" # defaults to ?
+->bus = _DISK_BUS_SATA
+->src = <value>.iso <=> sata0:0.fileName = "<value>.iso"
+->dst = sd[<controller> * 30 + <unit> mapped to [a-z]+]
+->driverName = <driver> <=> sata0.virtualDev = "<driver>" # default depends on guestOS value
+->driverType
+->cachemode
+->readonly
+->shared
+->slotnum
+
+
## disks: ide cdrom from .iso image ############################################
ide0:0.present = "true" # defaults to "false"
static int virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def);
static int virVMXParseSCSIController(virConfPtr conf, int controller, bool *present,
int *virtualDev);
+static int virVMXParseSATAController(virConfPtr conf, int controller, bool *present);
static int virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt,
virConfPtr conf, int device, int busType,
int controllerOrBus, int unit, virDomainDiskDefPtr *def,
long long coresPerSocket = 0;
virCPUDefPtr cpu = NULL;
char *firmware = NULL;
+ size_t saved_ndisks = 0;
if (ctx->parseFileName == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
controller, scsi_virtualDev[controller]))
goto cleanup;
}
+ saved_ndisks = def->ndisks;
+ }
+
+ /* def:disks (sata) */
+ for (controller = 0; controller < 4; ++controller) {
+ if (virVMXParseSATAController(conf, controller, &present) < 0) {
+ goto cleanup;
+ }
+
+ if (! present)
+ continue;
+
+ for (unit = 0; unit < 30; ++unit) {
+ if (virVMXParseDisk(ctx, xmlopt, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
+ VIR_DOMAIN_DISK_BUS_SATA, controller, unit,
+ &def->disks[def->ndisks], def) < 0) {
+ goto cleanup;
+ }
+
+ if (def->disks[def->ndisks] != NULL) {
+ ++def->ndisks;
+ continue;
+ }
+
+ if (virVMXParseDisk(ctx, xmlopt, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
+ VIR_DOMAIN_DISK_BUS_SATA, controller, unit,
+ &def->disks[def->ndisks], def) < 0) {
+ goto cleanup;
+ }
+
+ if (def->disks[def->ndisks] != NULL)
+ ++def->ndisks;
+ }
+
+ }
+
+ /* add all the SATA controllers we've seen, up until the last one that is
+ * currently used by a disk */
+ if (def->ndisks - saved_ndisks != 0) {
+ virDomainDeviceInfoPtr info = &def->disks[def->ndisks - 1]->info;
+ for (controller = 0; controller <= info->addr.drive.controller; controller++) {
+ if (!virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_SATA,
+ controller, -1))
+ goto cleanup;
+ }
}
/* def:disks (ide) */
+static int
+virVMXParseSATAController(virConfPtr conf, int controller, bool *present)
+{
+ char present_name[32];
+
+ if (controller < 0 || controller > 3) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SATA controller index %d out of [0..3] range"),
+ controller);
+ return -1;
+ }
+
+ g_snprintf(present_name, sizeof(present_name), "sata%d.present", controller);
+
+ if (virVMXGetConfigBoolean(conf, present_name, present, false, true) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+
static int
virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr conf,
int device, int busType, int controllerOrBus, int unit,
* device = {VIR_DOMAIN_DISK_DEVICE_DISK,
* VIR_DOMAIN_DISK_DEVICE_CDROM,
* VIR_DOMAIN_DISK_DEVICE_LUN}
+ * busType = VIR_DOMAIN_DISK_BUS_SATA
+ * controllerOrBus = [0..3] -> controller
+ * unit = [0..29]
+ *
+ * device = {VIR_DOMAIN_DISK_DEVICE_DISK,
+ * VIR_DOMAIN_DISK_DEVICE_CDROM,
+ * VIR_DOMAIN_DISK_DEVICE_LUN}
* busType = VIR_DOMAIN_DISK_BUS_IDE
* controllerOrBus = [0..1] -> bus
* unit = [0..1]
virIndexToDiskName
(controllerOrBus * 15 + (unit < 7 ? unit : unit - 1), "sd");
+ if ((*def)->dst == NULL)
+ goto cleanup;
+ } else if (busType == VIR_DOMAIN_DISK_BUS_SATA) {
+ if (controllerOrBus < 0 || controllerOrBus > 3) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SATA controller index %d out of [0..3] range"),
+ controllerOrBus);
+ goto cleanup;
+ }
+
+ if (unit < 0 || unit >= 30) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("SATA unit index %d out of [0..29] range"),
+ unit);
+ goto cleanup;
+ }
+
+ prefix = g_strdup_printf("sata%d:%d", controllerOrBus, unit);
+
+ (*def)->dst = virIndexToDiskName(controllerOrBus * 30 + unit, "sd");
+
if ((*def)->dst == NULL)
goto cleanup;
} else if (busType == VIR_DOMAIN_DISK_BUS_IDE) {
--- /dev/null
+.encoding = "UTF-8"
+config.version = "8"
+virtualHW.version = "17"
+nvram = "windows2019biosvmware.nvram"
+pciBridge0.present = "TRUE"
+svga.present = "TRUE"
+pciBridge4.present = "TRUE"
+pciBridge4.virtualDev = "pcieRootPort"
+pciBridge4.functions = "8"
+pciBridge5.present = "TRUE"
+pciBridge5.virtualDev = "pcieRootPort"
+pciBridge5.functions = "8"
+pciBridge6.present = "TRUE"
+pciBridge6.virtualDev = "pcieRootPort"
+pciBridge6.functions = "8"
+pciBridge7.present = "TRUE"
+pciBridge7.virtualDev = "pcieRootPort"
+pciBridge7.functions = "8"
+vmci0.present = "TRUE"
+hpet0.present = "TRUE"
+floppy0.present = "FALSE"
+svga.vramSize = "8388608"
+numvcpus = "2"
+cpuid.coresPerSocket = "2"
+memSize = "4096"
+powerType.powerOff = "default"
+powerType.suspend = "default"
+powerType.reset = "default"
+tools.upgrade.policy = "manual"
+sched.cpu.units = "mhz"
+sched.cpu.affinity = "all"
+sched.cpu.latencySensitivity = "normal"
+vm.createDate = "1600358272642584"
+sata0.present = "TRUE"
+ethernet0.virtualDev = "e1000e"
+ethernet0.networkName = "VM Network"
+ethernet0.addressType = "vpx"
+ethernet0.generatedAddress = "00:50:56:9a:9c:7a"
+ethernet0.present = "TRUE"
+displayName = "w2019biosvmware"
+guestOS = "windows2019srv-64"
+disk.EnableUUID = "TRUE"
+toolScripts.afterPowerOn = "TRUE"
+toolScripts.afterResume = "TRUE"
+toolScripts.beforeSuspend = "TRUE"
+toolScripts.beforePowerOff = "TRUE"
+uuid.bios = "42 1a 61 77 5a a9 ab b7-59 24 fc 37 6c 18 a1 b4"
+vc.uuid = "50 1a f9 f2 6d 29 1c 76-19 a9 b2 08 ed e5 f3 74"
+migrate.hostLog = "windows2019biosvmware-25cb1ed1.hlog"
+sched.cpu.min = "0"
+sched.cpu.shares = "normal"
+sched.mem.min = "0"
+sched.mem.minSize = "0"
+sched.mem.shares = "normal"
+migrate.encryptionMode = "opportunistic"
+viv.moid = "c95f9b69-0aea-44dd-9941-696b625c8fbb:vm-22:EF/prDXvzAhPJtd46UQDN3DGPNWZzzePsgdPTSxifyo="
+numa.autosize.cookie = "20022"
+numa.autosize.vcpu.maxPerVirtualNode = "2"
+sched.swap.derivedName = "windows2019biosvmware-79c21733.vswp"
+uuid.location = "56 4d ff 27 a3 20 99 44-4a 7f b5 40 3a 8a a2 5f"
+vm.genid = "1424963296993694319"
+vm.genidX = "-5704120239402535687"
+pciBridge0.pciSlotNumber = "17"
+pciBridge4.pciSlotNumber = "21"
+pciBridge5.pciSlotNumber = "22"
+pciBridge6.pciSlotNumber = "23"
+pciBridge7.pciSlotNumber = "24"
+ethernet0.pciSlotNumber = "192"
+usb_xhci.pciSlotNumber = "-1"
+vmci0.pciSlotNumber = "32"
+sata0.pciSlotNumber = "33"
+vmotion.checkpointFBSize = "8388608"
+vmotion.checkpointSVGAPrimarySize = "8388608"
+vmotion.svga.mobMaxSize = "8388608"
+vmotion.svga.graphicsMemoryKB = "8192"
+vmci0.id = "1813553588"
+monitor.phys_bits_used = "45"
+cleanShutdown = "TRUE"
+softPowerOff = "TRUE"
+usb_xhci:4.present = "TRUE"
+usb_xhci:4.deviceType = "hid"
+usb_xhci:4.port = "4"
+usb_xhci:4.parent = "-1"
+toolsInstallManager.lastInstallError = "0"
+tools.remindInstall = "FALSE"
+toolsInstallManager.updateCounter = "3"
+extendedConfigFile = "windows2019biosvmware.vmxf"
+disable_acceleration = "TRUE"
+sata0:0.fileName = "windows2019biosvmware.vmdk"
+sata0:0.present = "TRUE"
+sata0:0.redo = ""
+sched.sata0:0.shares = "normal"
+sched.sata0:0.throughputCap = "off"
+sata0:1.startConnected = "FALSE"
+sata0:1.deviceType = "cdrom-raw"
+sata0:1.clientDevice = "TRUE"
+sata0:1.fileName = "emptyBackingString"
+sata0:1.present = "TRUE"
+svga.guestBackedPrimaryAware = "TRUE"
+tools.syncTime = "FALSE"
+guestOS.detailed.data = ""