On Thu, Nov 19, 2020 at 07:33:29PM -0500, Matt Coleman wrote:
dumpxml can now serialize:
* floppy drives
* file-backed and device-backed disk drives
* images mounted to virtual CD/DVD drives
* IDE and SCSI controllers
Co-authored-by: Sri Ramanujam <sramanujam(a)datto.com>
Signed-off-by: Matt Coleman <matt(a)datto.com>
---
src/hyperv/hyperv_driver.c | 419 +++++++++++++++++++++++++-
src/hyperv/hyperv_driver.h | 3 +
src/hyperv/hyperv_private.h | 2 +
src/hyperv/hyperv_wmi.c | 45 +++
src/hyperv/hyperv_wmi.h | 8 +
src/hyperv/hyperv_wmi_classes.h | 19 ++
src/hyperv/hyperv_wmi_generator.input | 134 ++++++++
7 files changed, 629 insertions(+), 1 deletion(-)
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 40739595ac..326c0169e7 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -293,6 +293,396 @@ hypervCapsInit(hypervPrivate *priv)
return NULL;
}
+/*
+ * Virtual device functions
+ */
+static int
+hypervGetDeviceParentRasdFromDeviceId(const char *parentDeviceId,
+ Msvm_ResourceAllocationSettingData *list,
+ Msvm_ResourceAllocationSettingData **out)
+{
+ Msvm_ResourceAllocationSettingData *entry = list;
+ *out = NULL;
+
+ while (entry) {
+ g_autofree char *escapedDeviceId =
virStringReplace(entry->data->InstanceID, "\\", "\\\\");
+ g_autofree char *expectedSuffix = g_strdup_printf("%s\"",
escapedDeviceId);
+
+ if (g_str_has_suffix(parentDeviceId, expectedSuffix)) {
+ *out = entry;
+ break;
+ }
+
+ entry = entry->next;
+ }
+
+ if (*out)
+ return 0;
+
I think you need a virReportError here, so the caller gets some
error message
+ return -1;
+}
+
@@ -1324,7 +1728,18 @@ hypervDomainGetXMLDesc(virDomainPtr domain,
unsigned int flags)
def->os.type = VIR_DOMAIN_OSTYPE_HVM;
- /* FIXME: devices section is totally missing */
+ /* Allocate space for all potential devices */
+
+ /* 256 scsi drives + 8 ide drives */
s/8/4/
+ def->disks = g_new0(virDomainDiskDefPtr, 264);
s/264/260/
Or perhaps use the HYPERV_MAX_SCSI_CONTROLLERS / HYPERV_MAX_IDE_CHANNELS
constants here
+ def->ndisks = 0;
+
+ /* 1 ide & 4 scsi controllers */
+ def->controllers = g_new0(virDomainControllerDefPtr, 5);
+ def->ncontrollers = 0;
diff --git a/src/hyperv/hyperv_driver.h b/src/hyperv/hyperv_driver.h
index 8099b5714b..3a71a2943e 100644
--- a/src/hyperv/hyperv_driver.h
+++ b/src/hyperv/hyperv_driver.h
@@ -22,4 +22,7 @@
#pragma once
+#define HYPERV_MAX_SCSI_CONTROLLERS 4
+#define HYPERV_MAX_IDE_CHANNELS 2
s/2/1/
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|