]> xenbits.xensource.com Git - libvirt.git/commitdiff
hyperv: implement networkGetXMLDesc
authorMatt Coleman <mcoleman@datto.com>
Tue, 2 Feb 2021 00:48:45 +0000 (19:48 -0500)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 2 Feb 2021 08:36:35 +0000 (09:36 +0100)
Co-authored-by: Dawid Zamirski <dzamirski@datto.com>
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/hyperv/hyperv_network_driver.c

index d6407ac591bdc0dba7730505b8036665970447bb..93ef01c9aafb3efb8cdf4aeb2b396c6e2c7ab3fb 100644 (file)
@@ -180,6 +180,29 @@ hypervNetworkLookupByName(virConnectPtr conn, const char *name)
 }
 
 
+static char *
+hypervNetworkGetXMLDesc(virNetworkPtr network, unsigned int flags)
+{
+    g_autoptr(virNetwork) hypervNetwork = NULL;
+    g_autoptr(virNetworkDef) def = NULL;
+
+    def = g_new0(virNetworkDef, 1);
+
+    hypervNetwork = hypervNetworkLookupByUUID(network->conn, network->uuid);
+    if (!hypervNetwork)
+        return NULL;
+
+    memcpy(def->uuid, network->uuid, VIR_UUID_BUFLEN);
+    def->uuid_specified = true;
+
+    def->name = g_strdup(hypervNetwork->name);
+
+    def->forward.type = VIR_NETWORK_FORWARD_NONE;
+
+    return virNetworkDefFormat(def, NULL, flags);
+}
+
+
 static int
 hypervNetworkGetAutostart(virNetworkPtr network G_GNUC_UNUSED, int *autostart)
 {
@@ -212,6 +235,7 @@ virNetworkDriver hypervNetworkDriver = {
     .connectListAllNetworks = hypervConnectListAllNetworks, /* 7.1.0 */
     .networkLookupByUUID = hypervNetworkLookupByUUID, /* 7.1.0 */
     .networkLookupByName = hypervNetworkLookupByName, /* 7.1.0 */
+    .networkGetXMLDesc = hypervNetworkGetXMLDesc, /* 7.1.0 */
     .networkGetAutostart = hypervNetworkGetAutostart, /* 7.1.0 */
     .networkIsActive = hypervNetworkIsActive, /* 7.1.0 */
     .networkIsPersistent = hypervNetworkIsPersistent, /* 7.1.0 */