Re: [libvirt] [PATCH]: qemu_driver: convert uuid to string in error messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 25, 2008 at 11:46:48AM -0400, Daniel Veillard wrote:
> On Fri, Jul 25, 2008 at 09:56:27AM -0400, Guido Günther wrote:
> > On Fri, Jul 25, 2008 at 05:02:43AM -0400, Daniel Veillard wrote:
> > > On Fri, Jul 25, 2008 at 09:29:43AM +0100, Daniel P. Berrange wrote:
> > > > On Thu, Jul 24, 2008 at 03:52:32PM -0400, Guido G?nther wrote:
> > > > > Hi,
> > > > > qemu_driver misses some conversions to a char* before printing the uuid.
> > > > > Possible fix attached.
> > > > 
> > > > ACK, surprised that the printf() format checks don't complain about
> > > > passing an unsigned char to a %s format in GCC.  This is actually
> > > > one of the things ICC flagged when i tried it, but I never fixed it
> > > 
> > >   Applied, i just had to add an include for uuid.h to avoid an undeclared
> > > function warning :-)
> > The hunk including uuid.h accidently endet up in
> > 0001-also-check-domain-uuid-on-create.patch, sorry about that.
> 
>   Hum, i don't find it. Can you regenerate/repost please ?
Attached. It also dropped the check if the domain is running or not,
since a transient domain with of a currently offline domain is just to
confusing.
 -- Guido
[PATCH] also check domain uuid on create

and don't care if domain is active or not - it confuses users both ways
---
 src/qemu_driver.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 81bde4e..3c04e09 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2013,13 +2013,24 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
         return NULL;
 
     vm = virDomainFindByName(driver->domains, def->name);
-    if (vm && virDomainIsActive(vm)) {
+    if (vm) {
         qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("domain %s is already defined and running"),
+                         _("domain '%s' is already defined and running"),
                          def->name);
         virDomainDefFree(def);
         return NULL;
     }
+    vm = virDomainFindByUUID(driver->domains, def->uuid);
+    if (vm) {
+        char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+        virUUIDFormat(def->uuid, uuidstr);
+        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
+                         _("domain with uuid '%s' is already defined and running"),
+                         uuidstr);
+        virDomainDefFree(def);
+        return NULL;
+    }
 
     if (!(vm = virDomainAssignDef(conn,
                                   &driver->domains,
-- 
1.5.6.3

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]