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

2008-07-28 Thread Daniel Veillard
On Fri, Jul 25, 2008 at 04:09:31PM -0400, Guido Günther wrote:
 [PATCH] also check domain uuid on create
 
 and don't care if domain is active or not - it confuses users both ways

  Okay, that looks reasonnable to me, applied and commited,

   thanks !

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


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

2008-07-25 Thread Daniel P. Berrange
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

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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


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

2008-07-25 Thread Daniel Veillard
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 :-)

   thanks again

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


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

2008-07-25 Thread Guido Günther
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.
 -- Guido

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


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

2008-07-25 Thread Daniel Veillard
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 ?

   thanks,

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard  | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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


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

2008-07-25 Thread Guido Günther
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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


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

2008-07-24 Thread Guido Günther
Hi,
qemu_driver misses some conversions to a char* before printing the uuid.
Possible fix attached.
Cheers,
 -- Guido
---
 src/qemu_driver.c |   25 -
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 2539d78..2983b9c 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2167,8 +2167,11 @@ static unsigned long qemudDomainGetMaxMemory(virDomainPtr dom) {
 virDomainObjPtr vm = virDomainFindByUUID(driver-domains, dom-uuid);
 
 if (!vm) {
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+virUUIDFormat(dom-uuid, uuidstr);
 qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _(no domain with matching uuid '%s'), dom-uuid);
+ _(no domain with matching uuid '%s'), uuidstr);
 return 0;
 }
 
@@ -2180,8 +2183,11 @@ static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
 virDomainObjPtr vm = virDomainFindByUUID(driver-domains, dom-uuid);
 
 if (!vm) {
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+virUUIDFormat(dom-uuid, uuidstr);
 qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _(no domain with matching uuid '%s'), dom-uuid);
+ _(no domain with matching uuid '%s'), uuidstr);
 return -1;
 }
 
@@ -2200,8 +2206,11 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
 virDomainObjPtr vm = virDomainFindByUUID(driver-domains, dom-uuid);
 
 if (!vm) {
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+virUUIDFormat(dom-uuid, uuidstr);
 qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _(no domain with matching uuid '%s'), dom-uuid);
+ _(no domain with matching uuid '%s'), uuidstr);
 return -1;
 }
 
@@ -2470,8 +2479,11 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
 int max;
 
 if (!vm) {
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+virUUIDFormat(dom-uuid, uuidstr);
 qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _(no domain with matching uuid '%s'), dom-uuid);
+ _(no domain with matching uuid '%s'), uuidstr);
 return -1;
 }
 
@@ -2629,8 +2641,11 @@ static int qemudDomainGetMaxVcpus(virDomainPtr dom) {
 int ret;
 
 if (!vm) {
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+
+virUUIDFormat(dom-uuid, uuidstr);
 qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
- _(no domain with matching uuid '%s'), dom-uuid);
+ _(no domain with matching uuid '%s'), uuidstr);
 return -1;
 }
 
-- 
1.5.6.3

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