[Libvirt-cim] [PATCH] If the useer specifies a ReferencedConfiguration, be sure to generate a new

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Jul 28 20:20:31 UTC 2009


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1248812402 25200
# Node ID cd7e42dad453bf6b0269274dd43e354b89c1734d
# Parent  ba165481b932c372b13e0cf458e99f86bd843282
If the useer specifies a ReferencedConfiguration, be sure to generate a new...

MAC address since MACs cannot collide.

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r ba165481b932 -r cd7e42dad453 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Mon Jul 20 13:27:37 2009 -0700
+++ b/src/Virt_VirtualSystemManagementService.c	Tue Jul 28 13:20:02 2009 -0700
@@ -1276,6 +1276,7 @@
         virDomainPtr dom = NULL;
         char *name = NULL;
         const char *iid;
+        const char *mac;
         CMPIStatus s;
         int ret;
 
@@ -1336,6 +1337,18 @@
         (*domain)->name = NULL;
         free((*domain)->uuid);
         (*domain)->uuid = NULL;
+        free((*domain)->dev_net->dev.net.mac);
+        (*domain)->dev_net->dev.net.mac = NULL;
+
+        mac = _net_rand_mac();
+        if (mac == NULL) {
+                cu_statusf(_BROKER, &s,
+                           CMPI_RC_ERR_INVALID_PARAMETER,
+                           "Unable to generate a MAC address for guest %s",
+                           name);
+                goto out;
+        }
+        (*domain)->dev_net->dev.net.mac = strdup(mac);
 
  out:
         virDomainFree(dom);




More information about the Libvirt-cim mailing list