[Libvir] regarding libvirt windows support...

2008-03-17 Thread Deepa.Lingaraj

We are not able to execute make command

 

The errors we ae getting

 

make[2]: *** [libvirt_la-libvirt.lo] Error 1

make[2]: Leaving directory `/cygdrive/d/libvirt-0.4.1/src'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/cygdrive/d/libvirt-0.4.1'

make: *** [all] Error 2

 

Thanks and Regards,

Deepa Lingaraj.

 

 

 



This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient, please contact the sender by reply 
e-mail and destroy all copies of the original message. 
Any unauthorized review, use, disclosure, dissemination, forwarding, printing 
or copying of this email or any action taken in reliance on this e-mail is 
strictly 
prohibited and may be unlawful.--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] regarding libvirt windows support...

2008-03-17 Thread Atsushi SAKAI
Did you read following mail?
https://www.redhat.com/archives/libvir-list/2008-January/msg00348.html

Thanks
Atsushi SAKAI


[EMAIL PROTECTED] wrote:

 
 We are not able to execute make command
 
  
 
 The errors we ae getting
 
  
 
 make[2]: *** [libvirt_la-libvirt.lo] Error 1
 
 make[2]: Leaving directory `/cygdrive/d/libvirt-0.4.1/src'
 
 make[1]: *** [all-recursive] Error 1
 
 make[1]: Leaving directory `/cygdrive/d/libvirt-0.4.1'
 
 make: *** [all] Error 2
 
  
 
 Thanks and Regards,
 
 Deepa Lingaraj.
 
  
 
  
 
  
 
 
 
 This e-mail and any files transmitted with it are for the sole use of the 
 intended recipient(s) and may contain confidential and privileged information.
 If you are not the intended recipient, please contact the sender by reply 
 e-mail and destroy all copies of the original message. 
 Any unauthorized review, use, disclosure, dissemination, forwarding, printing 
 or copying of this email or any action taken in reliance on this e-mail is 
 strictly 
 prohibited and may be unlawful.


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


Re: [Libvir] [PATCH] fix typos (part?)

2008-03-17 Thread Daniel Veillard
On Mon, Mar 17, 2008 at 11:29:56AM +0900, Atsushi SAKAI wrote:
 Various typos fix.
 
 priviledged = privileged
 neccessary  = necessary
 hve = have
 advertizement = advertisement
 supervizing = supervising (Saori Fukuta suggest us as typo)
 poool   = pool
 persitent   = persistent
 numbber = number
 overriden   = overridden
 independantly = independently
 hypvisor= hypervisor
 adminstrator = administrator
 maintainance = maintenance
 targetted= targeted
 
 from Longman Dictionary of Contemporary English
 http://pewebdic2.cw.idm.fr/

  Heh, i'm not a native english speaker but it looks fine to me, i can
even recognize some of my mistakes. As long as the English dictionary
is coming from a french site, I assume it's all correct ;-)

 I hope no one suggest typo on libvirt.

  Well actually an awful lot of people mistype it as libvert, go figure !

  docs/FAQ.html |6 +++---
  docs/architecture.html|   12 ++--
  docs/auth.html|   14 +++---
  docs/devhelp/libvirt-libvirt.html |   30 +++---
  docs/html/libvirt-libvirt.html|   30 +++---
  docs/libvir.html  |   20 ++--
  docs/libvirt-api.xml  |   34 +-
  docs/libvirt-refs.xml |   10 +-
  docs/news.html|2 +-
  docs/virsh.pod|2 +-
  include/libvirt/libvirt.h |2 +-
  include/libvirt/libvirt.h.in  |2 +-
  qemud/mdns.h  |   12 ++--
  src/libvirt.c |   28 ++--
  src/qemu.conf |2 +-
  src/remote_internal.c |2 +-
  src/xend_internal.c   |2 +-
  tests/confdata/libvirtd.conf  |2 +-
  tests/confdata/libvirtd.out   |2 +-
  virsh.1   |2 +-
  20 files changed, 108 insertions(+), 108 deletions(-)

  Okay, patch applied but you sould be aware that most of the files
you are patching are actually the result of 'make rebuild' in the docs
directory, so the same change is usually carried twice, I double checked by
regenerating everything, this looks okay,

   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: [Libvir] regarding libvirt windows support...

2008-03-17 Thread Richard W.M. Jones
On Mon, Mar 17, 2008 at 12:03:31PM +0530, [EMAIL PROTECTED] wrote:
 We are not able to execute make command
 
 The errors we ae getting
 
 make[2]: *** [libvirt_la-libvirt.lo] Error 1
 make[2]: Leaving directory `/cygdrive/d/libvirt-0.4.1/src'
 make[1]: *** [all-recursive] Error 1
 make[1]: Leaving directory `/cygdrive/d/libvirt-0.4.1'
 make: *** [all] Error 2

Don't use Cygwin, use MSYS+MinGW instead.

Having said that, it is unlikely that libvirt builds at the moment
under Windows, although it could be made to work again with a little
effort.  We badly need someone, or a group of people, to take
responsibility for starting a project to keep libvirt compiling under
Windows, and to submit patches back to fix any problems.  A daily
build report for Windows (and Mac OS X) would be good too, for anyone
who knows how to do this  has the requisite hardware/servers.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v

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


Re: [Libvir] [PATCH] fix typos (part?)

2008-03-17 Thread Richard W.M. Jones
On Mon, Mar 17, 2008 at 11:29:56AM +0900, Atsushi SAKAI wrote:
 Various typos fix.
 
 priviledged = privileged
 neccessary  = necessary
 hve = have
 advertizement = advertisement
 supervizing = supervising (Saori Fukuta suggest us as typo)
 poool   = pool
 persitent   = persistent
 numbber = number
 overriden   = overridden
 independantly = independently
 hypvisor= hypervisor
 adminstrator = administrator
 maintainance = maintenance
 targetted= targeted

These all look good to me!

 I hope no one suggest typo on libvirt.

Dan B had the foresight to register this one ...

  http://libvert.org/

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v

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


[Libvir] persistent guests (save guest at shutdown and reload it at boot)

2008-03-17 Thread Matthias Pfafferodt
Hello,

I added the following entry to the libvirt bugzilla (Bugzilla Bug 437204).
Daniel Veillard ask me to post this to the list for discussion.

Description of problem:

libvirt can save and restore guests. It is also possible to autostart
guest at boot time. I miss a similar option: 'persistent'

booting the host:
* the guest is restored if there is a saved version
* else it is booted

shutdown of the host
* the guest is saved

The xendomain script does something like this. There the 'autostart' option
checks if the domain was saved. If it was this domain is restored else it
is created. At shutdown of the dom0 all running domU's are saved.

Matthias Pfafferodt



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


Re: [Libvir] persistent guests (save guest at shutdown and reload it at boot)

2008-03-17 Thread Daniel Veillard
[ Please subscribe, manually approving messages gets boring and unreliable
  rather quickly, Daniel ]

On Mon, Mar 17, 2008 at 03:20:26PM +0100, Matthias Pfafferodt wrote:
 Hello,
 
 I added the following entry to the libvirt bugzilla (Bugzilla Bug 437204).
 Daniel Veillard ask me to post this to the list for discussion.
 
 Description of problem:
 
 libvirt can save and restore guests. It is also possible to autostart
 guest at boot time. I miss a similar option: 'persistent'
 
 booting the host:
 * the guest is restored if there is a saved version
 * else it is booted
 
 shutdown of the host
 * the guest is saved
 
 The xendomain script does something like this. There the 'autostart' option
 checks if the domain was saved. If it was this domain is restored else it
 is created. At shutdown of the dom0 all running domU's are saved.

  That would assume libvirt is always in control of the guest, and that's
not the case, I assume you would be fine by a 'best-effort' kind of
support. This might be doable in libvirtd, assuming it intercepts shudown
properly, and actually has the time to do this. But the elapsed time for
a an xmlDomainSave option can be fairly long (nearly linear with the
size of the memory allocated for the domain), this may slowdown significantly
the shutdown process.
  What kind of benefits are you trying to get with this ?

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: [Libvir] PATCH: Fix xen unified driver open logic

2008-03-17 Thread Daniel P. Berrange
On Tue, Mar 11, 2008 at 06:47:47AM -0400, Daniel Veillard wrote:
 On Mon, Mar 10, 2008 at 07:09:36PM +, Daniel P. Berrange wrote:
  When adding PolicyKit support we disabled the proxy driver, but did not
  correctly fix up the Xen unified driver. The result is that it is still
  trying to run the proxy setuid helper which doesn't exist and thus it fails
  the open operation before the remote driver gets the opportunity to process
  the URI. I attempted to fix this by just disabling the proxy driver in the
  unified driver, but came to the conclusion the logic of the current code is
  just not flexible enough for what we need to be able todo  these days.
  
  THe core problem is the 'for(;;)' loop iterating over the drivers - it
  already has several special cases in the loop body to skip drivers, or
  ignore errors and adding more special cases is making my mind hurt trying
  to trace the logic.
  
  So I have removed the loop, and encode the desired logic explicitly. The
  diff a little unpleasant to read, so to summarize the logic is thus:
  
   - If root only, try open the hypervisor driver
   - Failure to open is fatal, do not try other drivers
 
   hum, I'm not 100% sure of that, an old libvirt version might still be
 able to work though xend in face of an hypervisor change it can't handle,
 we had the problem for example with 0.4.0 on xen-3.2, there was side effects
 but it was basically working without hypervisor access...

This attached patch adds that use case too. Failure of the HV driver is
now non-fatal. The other rules below are unchagned

 
   - Try to open the XenD driver
- If XenD suceeds
- If XenD  3.0.4, then open the XM driver for inactive domains
- Try to open the XS driver
 = Failure to open is fatal if root
- Else XenD fails
-.If proxy is compiled in, try to open proxy
  = Failure to open is fatal
  
  
  This should result in one of the following combinations of drivers being
  activated:
  
   root: (HV + XenD + XS)
   root: (HV + XenD + XS + XM)
 
   root: (XenD + XS [+XM]) should still be allowed IMHO,

Dan.

Index: configure.in
===
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.134
diff -u -p -r1.134 configure.in
--- configure.in11 Mar 2008 14:49:04 -  1.134
+++ configure.in17 Mar 2008 15:52:58 -
@@ -869,6 +869,9 @@ fi
 AC_MSG_RESULT([$with_xen_proxy])
 
 AM_CONDITIONAL(WITH_PROXY,[test $with_xen_proxy = yes])
+if test $with_xen_proxy = yes; then
+  AC_DEFINE(WITH_PROXY, 1, [Whether Xen proxy is enabled])
+fi
 
 dnl Enable building libvirtd?
 AM_CONDITIONAL(WITH_LIBVIRTD,[test x$with_libvirtd = xyes])
Index: src/remote_internal.c
===
RCS file: /data/cvs/libvirt/src/remote_internal.c,v
retrieving revision 1.62
diff -u -p -r1.62 remote_internal.c
--- src/remote_internal.c   17 Mar 2008 10:27:32 -  1.62
+++ src/remote_internal.c   17 Mar 2008 15:52:58 -
@@ -835,6 +835,14 @@ remoteOpen (virConnectPtr conn,
 }
 }
 #endif
+#if WITH_XEN
+if (uri 
+uri-scheme  STREQ (uri-scheme, xen) 
+(!uri-server || STREQ (uri-server, )) 
+(!uri-path || STREQ(uri-path, /))) {
+rflags |= VIR_DRV_OPEN_REMOTE_UNIX;
+}
+#endif
 
 priv-magic = DEAD;
 priv-sock = -1;
Index: src/xen_unified.c
===
RCS file: /data/cvs/libvirt/src/xen_unified.c,v
retrieving revision 1.38
diff -u -p -r1.38 xen_unified.c
--- src/xen_unified.c   27 Feb 2008 10:37:19 -  1.38
+++ src/xen_unified.c   17 Mar 2008 15:52:58 -
@@ -42,6 +42,7 @@
 #include util.h
 
 #define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt,__VA_ARGS__)
+#define DEBUG0(msg) VIR_DEBUG(__FILE__, %s, msg)
 
 static int
 xenUnifiedNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info);
@@ -239,7 +240,7 @@ xenUnifiedProbe (void)
 static int
 xenUnifiedOpen (virConnectPtr conn, xmlURIPtr uri, virConnectAuthPtr auth, int 
flags)
 {
-int i, j;
+int i;
 xenUnifiedPrivatePtr priv;
 
 /* Refuse any scheme which isn't xen:// or http://;. */
@@ -276,41 +277,73 @@ xenUnifiedOpen (virConnectPtr conn, xmlU
 priv-xshandle = NULL;
 priv-proxy = -1;
 
-for (i = 0; i  XEN_UNIFIED_NR_DRIVERS; ++i) {
-priv-opened[i] = 0;
 
-/* Only use XM driver for Xen = 3.0.3 (ie xendConfigVersion = 2) */
-if (drivers[i] == xenXMDriver 
-priv-xendConfigVersion  2)
-continue;
-
-/* Ignore proxy for root */
-if (i == XEN_UNIFIED_PROXY_OFFSET  getuid() == 0)
-continue;
-
-if (drivers[i]-open) {
-DEBUG(trying Xen sub-driver %d, i);
-if (drivers[i]-open (conn, uri, auth, flags) == 
VIR_DRV_OPEN_SUCCESS)
-priv-opened[i] = 1;
-

Re: [Libvir] PATCH: Fix xen unified driver open logic

2008-03-17 Thread Daniel Veillard
On Mon, Mar 17, 2008 at 04:02:06PM +, Daniel P. Berrange wrote:
 On Tue, Mar 11, 2008 at 06:47:47AM -0400, Daniel Veillard wrote:
  On Mon, Mar 10, 2008 at 07:09:36PM +, Daniel P. Berrange wrote:
   When adding PolicyKit support we disabled the proxy driver, but did not
   correctly fix up the Xen unified driver. The result is that it is still
   trying to run the proxy setuid helper which doesn't exist and thus it 
   fails
   the open operation before the remote driver gets the opportunity to 
   process
   the URI. I attempted to fix this by just disabling the proxy driver in the
   unified driver, but came to the conclusion the logic of the current code 
   is
   just not flexible enough for what we need to be able todo  these days.
   
   THe core problem is the 'for(;;)' loop iterating over the drivers - it
   already has several special cases in the loop body to skip drivers, or
   ignore errors and adding more special cases is making my mind hurt trying
   to trace the logic.
   
   So I have removed the loop, and encode the desired logic explicitly. The
   diff a little unpleasant to read, so to summarize the logic is thus:
   
- If root only, try open the hypervisor driver
- Failure to open is fatal, do not try other drivers
  
hum, I'm not 100% sure of that, an old libvirt version might still be
  able to work though xend in face of an hypervisor change it can't handle,
  we had the problem for example with 0.4.0 on xen-3.2, there was side effects
  but it was basically working without hypervisor access...
 
 This attached patch adds that use case too. Failure of the HV driver is
 now non-fatal. The other rules below are unchagned

  Okidoc, +1 :-)

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: [Libvir] PATCH: Fix dir/fs storage pool when SELinux is disabled

2008-03-17 Thread Jim Meyering
Daniel P. Berrange [EMAIL PROTECTED] wrote:
 When SELinux is disabled  fgetfilecon() may well return -1, if a file has no
 extended attribute with security context data. This causes the storage pool
 to skip that file. The fix is to check whether errno is ENODATA and treat
 that as an expected error case  ignore it.

Hi Dan,

That code should handle ENOTSUP as well as ENODATA.
Here's the change:

Treat ENOTSUP like ENODATA, after failed fgetfilecon.
* src/storage_backend.c (virStorageBackendUpdateVolInfoFD): Treat a
failed fgetfilecon with errno == ENOTSUP the same as for ENODATA.

diff --git a/src/storage_backend.c b/src/storage_backend.c
index 9702de3..4a58cb6 100644
--- a/src/storage_backend.c
+++ b/src/storage_backend.c
@@ -240,7 +240,7 @@ virStorageBackendUpdateVolInfoFD(virConnectPtr conn,

 #if HAVE_SELINUX
 if (fgetfilecon(fd, filecon) == -1) {
-if (errno != ENODATA) {
+if (errno != ENODATA  errno != ENOTSUP) {
 virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
   _(cannot get file context of %s: %s),
   vol-target.path, strerror(errno));
--
1.5.4.4.482.g16f99

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


Re: [Libvir] PATCH: Fix dir/fs storage pool when SELinux is disabled

2008-03-17 Thread Daniel P. Berrange
On Mon, Mar 17, 2008 at 05:36:49PM +0100, Jim Meyering wrote:
 Daniel P. Berrange [EMAIL PROTECTED] wrote:
  When SELinux is disabled  fgetfilecon() may well return -1, if a file has no
  extended attribute with security context data. This causes the storage pool
  to skip that file. The fix is to check whether errno is ENODATA and treat
  that as an expected error case  ignore it.
 
 Hi Dan,
 
 That code should handle ENOTSUP as well as ENODATA.

Ok, comitted that too

Dan.
-- 
|: Red Hat, Engineering, Boston   -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: [Libvir] PATCH: Fix dir/fs storage pool when SELinux is disabled

2008-03-17 Thread Jim Meyering
Daniel P. Berrange [EMAIL PROTECTED] wrote:
 On Mon, Mar 17, 2008 at 05:36:49PM +0100, Jim Meyering wrote:
 Daniel P. Berrange [EMAIL PROTECTED] wrote:
  When SELinux is disabled  fgetfilecon() may well return -1, if a file has 
  no
  extended attribute with security context data. This causes the storage pool
  to skip that file. The fix is to check whether errno is ENODATA and treat
  that as an expected error case  ignore it.

 Hi Dan,

 That code should handle ENOTSUP as well as ENODATA.

 Ok, comitted that too

No problem.
I've just done it.

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


[Libvir] [PATCH] Implement memory operations for qemu driver

2008-03-17 Thread Cole Robinson
The attached patch implements the following operations for the qemu driver:

virDomainGetMaxMemory
virDomainSetMaxMemory
virDomainSetMemory

A few questions/comments:

1) I changed maxmem and memory in the qemu_vm_def struct to unsigned long
   to match the public api for memory values. Seems to work, but not sure
   if there are any undesirable side effects to this.

2) Should SetMaxMem be able to be called on a running guest? This code
   allows it, since maxmem is basically a metavalue that doesn't directly
   affect a guest.

3) Should maxmem be able to be set lower than the currently allocated mem?
   This code does not allow this. If this changed, would also need to take
   into account how we would handle this if we can change the maxmem while
   the guest is running. After rethinking, we probably should be able to
   do this, but I haven't changed the code.

Thanks,
Cole

diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index a196bb8..f6ae06b 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -1650,7 +1650,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
  (vm-def-graphicsType == QEMUD_GRAPHICS_SDL ? 0 : 1)) + /* graphics 
*/
 (vm-migrateFrom[0] ? 3 : 0); /* migrateFrom */
 
-snprintf(memory, sizeof(memory), %d, vm-def-memory/1024);
+snprintf(memory, sizeof(memory), %lu, vm-def-memory/1024);
 snprintf(vcpus, sizeof(vcpus), %d, vm-def-vcpus);
 
 if (!(*argv = malloc(sizeof(**argv) * (len+1
@@ -2820,9 +2820,9 @@ char *qemudGenerateXML(virConnectPtr conn,
 virUUIDFormat(uuid, uuidstr);
 if (virBufferVSprintf(buf,   uuid%s/uuid\n, uuidstr)  0)
 goto no_memory;
-if (virBufferVSprintf(buf,   memory%d/memory\n, def-maxmem)  0)
+if (virBufferVSprintf(buf,   memory%lu/memory\n, def-maxmem)  0)
 goto no_memory;
-if (virBufferVSprintf(buf,   currentMemory%d/currentMemory\n, 
def-memory)  0)
+if (virBufferVSprintf(buf,   currentMemory%lu/currentMemory\n, 
def-memory)  0)
 goto no_memory;
 if (virBufferVSprintf(buf,   vcpu%d/vcpu\n, def-vcpus)  0)
 goto no_memory;
diff --git a/src/qemu_conf.h b/src/qemu_conf.h
index 12aa6ae..c1aae75 100644
--- a/src/qemu_conf.h
+++ b/src/qemu_conf.h
@@ -193,8 +193,8 @@ struct qemud_vm_def {
 unsigned char uuid[VIR_UUID_BUFLEN];
 char name[QEMUD_MAX_NAME_LEN];
 
-int memory;
-int maxmem;
+unsigned long memory;
+unsigned long maxmem;
 int vcpus;
 
 int noReboot;
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 2b4c2a6..215f4c4 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -1765,6 +1765,66 @@ static char *qemudDomainGetOSType(virDomainPtr dom) {
 return type;
 }
 
+/* Returns max memory in kb, 0 if error */
+static unsigned long qemudDomainGetMaxMemory(virDomainPtr dom) {
+struct qemud_driver *driver = (struct qemud_driver 
*)dom-conn-privateData;
+struct qemud_vm *vm = qemudFindVMByUUID(driver, dom-uuid);
+
+if (!vm) {
+qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ no domain with matching uuid '%s', dom-uuid);
+return 0;
+}
+
+return vm-def-maxmem;
+}
+
+static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long memory) {
+struct qemud_driver *driver = (struct qemud_driver 
*)dom-conn-privateData;
+struct qemud_vm *vm = qemudFindVMByUUID(driver, dom-uuid);
+
+if (!vm) {
+qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ no domain with matching uuid '%s', dom-uuid);
+return -1;
+}
+
+if (memory  vm-def-maxmem) {
+qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ cannot set max memory lower than current memory);
+return -1;
+}
+
+vm-def-maxmem = memory;
+return 0;
+}
+
+static int qemudDomainSetMemory(virDomainPtr dom, unsigned long memory) {
+struct qemud_driver *driver = (struct qemud_driver 
*)dom-conn-privateData;
+struct qemud_vm *vm = qemudFindVMByUUID(driver, dom-uuid);
+
+if (!vm) {
+qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_DOMAIN,
+ no domain with matching uuid '%s', dom-uuid);
+return -1;
+}
+
+if (qemudIsActiveVM(vm)) {
+qemudReportError(dom-conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
+ cannot set memory of an active domain);
+return -1;
+}
+
+if (memory  vm-def-maxmem) {
+qemudReportError(dom-conn, dom, NULL, VIR_ERR_INVALID_ARG,
+ cannot set memory higher than max memory);
+return -1;
+}
+
+vm-def-memory = memory;
+return 0;
+}
+
 static int qemudDomainGetInfo(virDomainPtr dom,
virDomainInfoPtr info) {
 struct qemud_driver *driver = (struct qemud_driver 
*)dom-conn-privateData;
@@ -2886,9 +2946,9 @@ static virDriver qemuDriver = {
 NULL, /* domainReboot */
 qemudDomainDestroy, /* domainDestroy 

Re: [Libvir] persistent guests (save guest at shutdown and reload it at boot)

2008-03-17 Thread Matthias Pfafferodt
Am Montag, 17. März 2008 15:37:00 schrieb Daniel Veillard:
 [ Please subscribe, manually approving messages gets boring and unreliable
   rather quickly, Daniel ]

OK, now I'm on the list ...


 On Mon, Mar 17, 2008 at 03:20:26PM +0100, Matthias Pfafferodt wrote:
  Hello,
 
  I added the following entry to the libvirt bugzilla (Bugzilla Bug
  437204). Daniel Veillard ask me to post this to the list for discussion.
 
  Description of problem:
 
  libvirt can save and restore guests. It is also possible to autostart
  guest at boot time. I miss a similar option: 'persistent'
 
  booting the host:
  * the guest is restored if there is a saved version
  * else it is booted
 
  shutdown of the host
  * the guest is saved
 
  The xendomain script does something like this. There the 'autostart'
  option checks if the domain was saved. If it was this domain is restored
  else it is created. At shutdown of the dom0 all running domU's are saved.

   That would assume libvirt is always in control of the guest, and that's
 not the case, I assume you would be fine by a 'best-effort' kind of
 support. This might be doable in libvirtd, assuming it intercepts shudown
 properly, and actually has the time to do this. But the elapsed time for
 a an xmlDomainSave option can be fairly long (nearly linear with the
 size of the memory allocated for the domain), this may slowdown
 significantly the shutdown process.
   What kind of benefits are you trying to get with this ?

 Daniel

At the moment I have a server using xen (version 3.0) and the xendomain boot 
script. The server is powered off from time to time. Do to the script the 
guests are saved and restored with all the processes still running. Now I 
plan to update the server and I think about using libvir and kvm.

Is it possible to update the 'autostart' option to check if the guest was 
saved and restore it before creating a new version?

Matthias

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


[Libvir] [PATCH] Fix MAC address parsing for 1-digit case

2008-03-17 Thread Hiroyuki Kaguchi
libvirt fails in parsing when MAC address like 00:16:3e:12:3:61
is specified for installation.
This is because virt-install can pass 1-digit (like 3) for
MAC address from Cset:316 for Solaris
But libvirt cannot support this MAC 1-digit (like 3) parameter.

This patch fixes libvirt parsing in the MAC address
against virt-inst Cset:316

Thanks

Signed-off-by: Hiroyuki Kaguchi [EMAIL PROTECTED]
? parse_macaddr.patch
Index: src/xml.c
===
RCS file: /data/cvs/libvirt/src/xml.c,v
retrieving revision 1.113
diff -u -r1.113 xml.c
--- src/xml.c   27 Feb 2008 04:35:08 -  1.113
+++ src/xml.c   18 Mar 2008 05:30:14 -
@@ -17,6 +17,7 @@
 #include string.h
 #include stdarg.h
 #include limits.h
+#include ctype.h
 #ifdef WITH_XEN
 #include xs.h
 #endif
@@ -537,6 +538,44 @@
  /
 #if WITH_XEN
 /**
+ * parseMacAddr:
+ * @str: mac addrress string
+ * @addr: mac addrress numbers
+ *
+ * Parse a mac addrress
+ *
+ * Returns 0 in case success or -1 in case of error.
+ */
+static int
+parseMacAddr(const char* str, unsigned char *addr)
+{
+int i;
+for (i = 0; i  6; i++) {
+char *end_ptr;
+unsigned long result;
+
+if (!isdigit(*str)  !isalpha(*str))
+break;
+
+result = strtoul(str, end_ptr, 16);
+
+if ((end_ptr - str)  1 || 2  (end_ptr - str) ||
+(errno == ERANGE) ||
+(0xFF  result))
+break;
+
+addr[i] = (unsigned char) result;
+
+if (*end_ptr != ':')
+return (i == 5) ? 0 : -1;
+
+str = end_ptr + 1;
+}
+
+return -1;
+}
+
+/**
  * virtDomainParseXMLGraphicsDescImage:
  * @conn: pointer to the hypervisor connection
  * @node: node containing graphics description
@@ -1233,22 +1272,8 @@
 
 virBufferAddLit(buf, (vif );
 if (mac != NULL) {
-unsigned int addr[12];
-int tmp = sscanf((const char *) mac,
-%01x%01x:%01x%01x:%01x%01x:%01x%01x:%01x%01x:%01x%01x,
- (unsigned int *) addr[0],
- (unsigned int *) addr[1],
- (unsigned int *) addr[2],
- (unsigned int *) addr[3],
- (unsigned int *) addr[4],
- (unsigned int *) addr[5],
- (unsigned int *) addr[6],
- (unsigned int *) addr[7],
- (unsigned int *) addr[8],
- (unsigned int *) addr[9],
- (unsigned int *) addr[10],
- (unsigned int *) addr[11]);
-if (tmp != 12 || strlen((const char *) mac) != 17) {
+unsigned char addr[6];
+if (parseMacAddr((const char*) mac, addr) == -1) {
 virXMLError(conn, VIR_ERR_INVALID_MAC, (const char *) mac, 0);
 goto error;
 }
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list