Re: [libvirt] [PATCH] qemudDomainCreate: also check uuid

2008-08-01 Thread Daniel Veillard
On Wed, Jul 30, 2008 at 02:06:29PM -0500, Charles Duffy wrote:
 Blerg; the more complex patch I provided was dangerously wrong.
 
 Just applying the one that corrects the message WORKSFORME.

  Okay, done,

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] qemudDomainCreate: also check uuid

2008-08-01 Thread Daniel Veillard
On Thu, Jul 31, 2008 at 07:08:33AM -0400, Guido Günther wrote:
 On Wed, Jul 30, 2008 at 12:05:56AM -0500, Charles Duffy wrote:
  It appears that this patch was applied (in commit  
  45616162db2d1e807dbe70e60c67cb701cbd06d8) with the virDomainIsActive(vm)  
  checks removed from qemudDomainCreate, such that we fail out with  
  domain [...] is already defined and running even if the domain is only  
  defined but not running.
 The error message is confusing. I missed to correct that. Shall I send a
 patch? I thing doing more than that is simply too confusing for users.

  No, no problem, Charles was being confused :-) all set now !

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] [EMAIL PROTECTED]: [PATCH] autoport overrides actual VNC port number in dump-xml]

2008-08-01 Thread Daniel Veillard
On Thu, Jul 31, 2008 at 02:17:25PM +0100, Daniel P. Berrange wrote:
 On Thu, Jul 31, 2008 at 02:24:25PM +0200, Chris Lalancette wrote:
  Daniel Veillard wrote:
   So the explicit port is output in XML if autoport is not set, or
   if the domain is running.
   
 Okay +1, push the patch :-)
  
  Yes, I agree, I just tested out the patch and it seems to fix the issue for 
  me.
   I'm going to commit the patch now.
 
 You committed the wrong patch it appears - the original one instead of my
 revised version :-(

  Seems fixed now, I'm seeing 

case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
if (def-data.vnc.port 
(!def-data.vnc.autoport || vm-id != -1))
virBufferVSprintf(buf,  port='%d',
  def-data.vnc.port);
else if (def-data.vnc.autoport)
virBufferAddLit(buf,  port='-1');

virBufferVSprintf(buf,  autoport='%s',
  def-data.vnc.autoport ? yes : no);
in CVS head,

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] [EMAIL PROTECTED]: [PATCH] autoport overrides actual VNC port number in dump-xml]

2008-08-01 Thread Chris Lalancette
Daniel Veillard wrote:
   Seems fixed now, I'm seeing 
 
 case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
 if (def-data.vnc.port 
 (!def-data.vnc.autoport || vm-id != -1))
 virBufferVSprintf(buf,  port='%d',
   def-data.vnc.port);
 else if (def-data.vnc.autoport)
 virBufferAddLit(buf,  port='-1');
 
 virBufferVSprintf(buf,  autoport='%s',
   def-data.vnc.autoport ? yes : no);

Yeah, Dan B committed the fix to the fix, since I didn't get around to it
yesterday.  Thanks Dan B!

Chris Lalancette

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


Re: [libvirt] [PATCH] Minor doc tweaks

2008-08-01 Thread Daniel Veillard
On Thu, Jul 31, 2008 at 11:38:38AM -0500, Charles Duffy wrote:
 Per subject; clarifies the distinction between virDomainCreateLinux and 
 virDomainDefineXML+virDomainCreate, and adds documentation for the 
 autoport display attribute.

  Okay, applied, except that docs/libvirt-api.xml is automatically regenerated
by scanning the C files and headers for descriptions, so the way to fix
it is by editing the functions comments of the 2 API entry points. I extended
the descriptions a bit too.

  Thanks for the patch and the heads up :-)

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


[libvirt] Contribution to libvirt

2008-08-01 Thread rajesh battala
hi all..
i am interested to contribute to libvirt.
i want to contribute to the java bindings.
is there any procedure for that.
plz let me know i ddint find doc on the site.
thanks
rajesh



  Unlimited freedom, unlimited storage. Get it now, on 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Contribution to libvirt

2008-08-01 Thread Atsushi SAKAI
Hello, rajesh

As you know, the java bindings are here.
http://libvirt.org/java.html

Please mail the patch to this mailing list.

Thanks
Atsushi SAKAI



rajesh battala [EMAIL PROTECTED] wrote:

 hi all..
 i am interested to contribute to libvirt.
 i want to contribute to the java bindings.
 is there any procedure for that.
 plz let me know i ddint find doc on the site.
 thanks
 rajesh
 
 
 
   Unlimited freedom, unlimited storage. Get it now, on 
 http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/


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


Re: [libvirt] [PATCH] virsh edit, virsh net-edit, virsh pool-edit

2008-08-01 Thread Jim Meyering
Richard W.M. Jones [EMAIL PROTECTED] wrote:
 This implements 'virsh edit', 'virsh net-edit' and 'virsh pool-edit'
 commands.

Hi Rich,

 Index: src/virsh.c
 ===
 RCS file: /data/cvs/libvirt/src/virsh.c,v
 retrieving revision 1.157
 diff -u -r1.157 virsh.c
 --- src/virsh.c   22 Jul 2008 16:12:01 -  1.157
 +++ src/virsh.c   30 Jul 2008 09:54:46 -
 @@ -5070,6 +5070,424 @@
  }

  /*
 + * edit command
 + */

These declarations can go farther down, right above the definition
of cmdEdit.

 +static vshCmdInfo info_edit[] = {
 +{syntax, edit domain},
 +{help, gettext_noop(edit XML configuration for a domain)},
 +{desc, gettext_noop(Edit the XML configuration for a domain.)},
 +{NULL, NULL}
 +};
 +
 +static vshCmdOptDef opts_edit[] = {

You can mark entries as const:

  static const vshCmdOptDef opts_edit[] = {

 +{domain, VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop(domain name, id or 
 uuid)},
 +{NULL, 0, 0, NULL}
 +};
 +
 +static char *
 +editWriteToTempFile (vshControl *ctl, const char *doc)
 +{
 +char *ret;
 +int fd;
 +
 +ret = tempnam (NULL, virsh);

Don't use tempnam.
It poses a security risk (symlink attack in a race to open).
Use mkstemp instead, but you'll have to form the concatenation
of $TMPDIR (if defined, else /tmp) with a template like /virshXX.

 +if (!ret) {
 +vshError(ctl, FALSE,
 + _(tempnam: failed to create temporary file: %s),
 + strerror (errno));
 +return NULL;
 +}
 +
 +fd = open (ret, O_EXCL|O_CREAT|O_WRONLY, 0600);
 +if (fd == -1) {
 +vshError(ctl, FALSE,
 + _(open: %s: failed to create temporary file: %s),
 + ret, strerror (errno));
 +free (ret);
 +return NULL;
 +}
 +
 +if (safewrite (fd, doc, strlen (doc)) == -1) {
 +vshError(ctl, FALSE,
 + _(write: %s: failed to create temporary file: %s),

s/create/write/

 + ret, strerror (errno));
 +close (fd);
 +unlink (ret);
 +free (ret);
 +return NULL;
 +}
 +if (close (fd) == -1) {
 +vshError(ctl, FALSE,
 + _(close: %s: failed to create temporary file: %s),

s/create/write/

 + ret, strerror (errno));
 +unlink (ret);
 +free (ret);
 +return NULL;
 +}
 +
 +/* Temporary filename: caller frees. */
 +return ret;
 +}
 +
 +static int
 +editFile (vshControl *ctl, const char *filename)
 +{
 +const char *editor;
 +char command[100];
 +int command_ret;
 +
 +editor = getenv (EDITOR);
 +if (!editor) editor = vi; /* could be cruel  default to ed(1) here */
 +
 +snprintf (command, sizeof command, %s %s, editor, filename);

Use asprintf rather than a fixed-sized buffer.
Otherwise, if EDITOR and/or TMPDIR are long enough, the result won't fit.

What if either contains shell meta-characters?
To accommodate you'd have to shell-quote as needed, or (as I prefer)
simply detect the bogosity and refuse to run the command.

 +command_ret = system (command);
 +
 +if (command_ret == -1) {
 +vshError(ctl, FALSE,
 + %s: %s,
 + command, strerror (errno));
 +return -1;
 +}
 +if (command_ret != WEXITSTATUS (0)) {
 +vshError(ctl, FALSE,
 + _(%s: command exited with non-zero status), command);
 +return -1;
 +}
 +return 0;
 +}
 +
 +static char *
 +editReadBackFile (vshControl *ctl, const char *filename)
 +{
...

How about using virFileReadAll here?
Or at least fread_file_lim, if virFileReadAll's error-handling
isn't exactly what you want.

 +}


 +static int
 +cmdEdit (vshControl *ctl, vshCmd *cmd)
 +{
...
 +static int
 +cmdNetworkEdit (vshControl *ctl, vshCmd *cmd)
 +{
...
 +static int
 +cmdPoolEdit (vshControl *ctl, vshCmd *cmd)
 +{

Have you considered factoring these three?
At 70-80 lines each, with so much common code, it's begging for it.

Two approaches:

Pure C would require lots of ugly casts and would end up
worse than the duplication.

However, consider putting this into a new file, say virsh-dom-edit.c
(or better, just extracting it from virsh.c)

static vshCmdInfo info_edit[] = { ...
static vshCmdOptDef opts_edit[] = { ...
static int
cmdEdit (vshControl *ctl, vshCmd *cmd)
{
...
}

With that, we could use a few sed substitutions to automatically derive
virsh-net-edit.c and virsh-pool-edit.c, and then replace the two +80-line
blocks of duplicate code with these two lines:

#include virsh-net-edit.c
#include virsh-pool-edit.c

If you do that, you'll have to add both new file names to the
list of built sources in src/Makefile.am:

BUILT_SOURCES += virsh-net-edit.c virsh-pool-edit.c

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


Re: [libvirt] PATCH: 5/14: Convert test driver to generic domain API

2008-08-01 Thread Jim Meyering
Daniel P. Berrange [EMAIL PROTECTED] wrote:
 This patch ports the Test driver over to the domain XML apis.

ACK.

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


Re: [libvirt] [PATCH] virsh edit, virsh net-edit, virsh pool-edit

2008-08-01 Thread Richard W.M. Jones
On Fri, Aug 01, 2008 at 10:02:50AM +0200, Jim Meyering wrote:
 Richard W.M. Jones [EMAIL PROTECTED] wrote:
  +static int
  +cmdEdit (vshControl *ctl, vshCmd *cmd)
  +{
 ...
  +static int
  +cmdNetworkEdit (vshControl *ctl, vshCmd *cmd)
  +{
 ...
  +static int
  +cmdPoolEdit (vshControl *ctl, vshCmd *cmd)
  +{
 
 Have you considered factoring these three?
 At 70-80 lines each, with so much common code, it's begging for it.

I certainly did!

Normally of course I'd do it with closures, but ...

I'll go with the 'sed' approach unless anyone stronly objects to that.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top

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


Re: [libvirt] fully virtualized xen guest question

2008-08-01 Thread Daniel P. Berrange
On Thu, Jul 31, 2008 at 11:31:39PM +0200, Christoph H?ger wrote:
 I am running XEN on an debian etch. For clustering purposes I wanted to
 boot fedora as virtual machine. 
 
 That works (except for nfs mounts) fine using the paravortualization
 features.
 
 But fully virtulalized guests do not even boot, I do not get any
 sensefull error message, my config file looks like:
 
 domain type='xen'
 namewerewolf/name
 
 os
 typehvm/type
 loader/usr/lib/xen-3.0.3-1/boot/hvmloader/loader
 
 kernel/data/virtual/kernel/kvm1/vmlinuz-2.6.18-6-amd64/kernel
 
 initrd/data/virtual/kernel/kvm1/initrd.img-2.6.18-6-amd64/initrd
 cmdlineroot=/dev/hda1/cmdline

Booting fullyvirtualized guests off a kernel+initrd is a very new
feature in Xen. Your loader path suggests you are using Xen 3.0.3
which is no where near new enough to support this. You need to boot
of CDROM or hardisk instead.

 domain type='xen'
 namewerewolf/name
 
 os
 typehvm/type
 loader/usr/lib/xen-3.0.3-1/boot/hvmloader/loader
 
 kernel/data/virtual/kernel/kvm1/vmlinuz-2.6.18-6-amd64/kernel
 
 initrd/data/virtual/kernel/kvm1/initrd.img-2.6.18-6-amd64/initrd
 cmdlineroot=/dev/hda1/cmdline
 /os
   memory524M/memory
   vcpu1/vcpu
   devices
 emulator/usr/bin/kvm/emulator

Urm, you're trying to use KVM with Xen which just won't work. You
need to point to Xen's version of QEMU /usr/lib/xen/bin/qemu-dm
or whereever Debian puts it.

 all I get when tryin virsh create is:
 
 xend_post: error from xen daemon: (xend.err Error creating domain: (0,
 'Error'))

This looks like a fairly old Xen which didn't know how to give proper
error messages. You'll have to check /var/log/xen/ for more details,
but it'll certainly be the kernel/initrd stuff that's broken, and the
device emulator too.

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] storage pool discovery

2008-08-01 Thread Daniel P. Berrange
On Wed, Jul 30, 2008 at 04:30:01PM -0400, David Lively wrote:
   For example, to discover existing LVM volume groups, there's no need
 to specify a source:
 virsh # pool-discover logical
 
   While discovering nfs shares requires a source document to specify
 the host to query:
 virsh # pool-discover netfs sourcehost name='share' //source
 
   Currently (i.e., in this patch) I've implemented discovery support
 only for the logical and netfs pools.  I plan on covering the other
 types once we've agreed upon the API.  While this patch is rather large,
 the vast majority of it is generic (not specific to any particular
 type of storage pool) code, which I mostly took from Daniel's
 submission.  I could easily break the storage-pool-type-specific pieces
 into separate patches, but those changes are already segregated into the
 appropriate storage_backend_ files.
 
 * Known Issues *
 
   I made the virsh interface take a XML string rather than a filename.
 I found it convenient, but AFAIK the rest of the commands that take XML
 take it from a file, so perhaps that should be changed (just let me know
 what you'd prefer).

I'd rather this took at filename, and then we add a separate 
pool-discover-as  command which takes a list of flags and turns
them into XML.  eg, so you could do

virsh pool-discover-as --host share netfs

and thus avoid the user needing to deal with XML at all here.

   I realize the description of srcSpec is kind of fuzzy.  For instance,
 for netfs discovery, the source must have a host element (to specify
 the host to query), but shouldn't have a dir element since the
 exported dirs are exactly what we're trying to discover in this case.
 So this really needs to be documented accurately for each storage pool
 type.  (Where?)

We've got some documentation on the XML required for each type of
storage pool here, so its natural to add more info in this page

  http://libvirt.org/storage.html

It could also be detailed in the virsh manpage for 'pool-discover' command.

   Finally, there's an underspecification issue.  The XML pool
 descriptions returned are supposed to be usable as valid input to
 virStoragePoolDefineXML.  But these descriptions include some data (pool
 name, target path) that isn't specified by the discover input or the
 discovered resources.  For now, I'm making up a somewhat arbitrary pool
 name (logical: VolGroup name, netfs: last component of export path).
 And I don't even specify targetpath in the netfs discovery output
 (which means it's not valid input to virStoragePoolDefineXML until a
 target path is added).

Yep, my original intention was that you could send the XML straight
back into the PoolDefineXML api. One alternative I've thought of 
though, is that it perhaps it might be nicer to return all the 
discovered pools as one XML doc

   poolList type='netfs'
  source
host name='someserver'/
dir path='/exports/home'/
  /source
  source
host name='someserver'/
dir path='/exports/web'/
  /source
  source
host name='someserver'/
dir path='/exports/ftp'/
  /source
   /poolList

And just let the caller decide how they want to use this - they may not
even want to define pools from them immediately - instead they might
just want to display list of NFS exports to the user. It'd be easier
than having to make up data for the name and target elements which
is really something the client app wants to decide upon.

 diff --git a/include/libvirt/libvirt.h b/include/libvirt/libvirt.h
 index 8980bc2..463cf2b 100644
 --- a/include/libvirt/libvirt.h
 +++ b/include/libvirt/libvirt.h
 @@ -890,6 +890,15 @@ int 
 virConnectListDefinedStoragePools(virConnectPtr conn,
int maxnames);
  
  /*
 + * Query a host for storage pools of a particular type
 + */
 +int virConnectDiscoverStoragePools(virConnectPtr conn,
 +const char *type,
 +const char *srcSpec,
 +unsigned int flags,
 +char ***xmlDesc);
 +
 +/*
   * Lookup pool by name or uuid
   */
  virStoragePoolPtr   virStoragePoolLookupByName  (virConnectPtr conn,
 @@ -979,6 +988,13 @@ char *  virStorageVolGetXMLDesc 
 (virStorageVolPtr pool,
  
  char *  virStorageVolGetPath(virStorageVolPtr 
 vol);
  
 +typedef struct _virStringList virStringList;
 +
 +struct _virStringList {
 +char *val;
 +struct _virStringList *next;
 +};


This typedef doesn't appear to be needed in the public API, so
can be moved internally.

 diff --git a/python/generator.py b/python/generator.py
 index 1514c02..66cb3cc 100755
 --- a/python/generator.py
 +++ b/python/generator.py
 @@ -313,6 +313,7 @@ skip_impl = (
  

Re: [libvirt] [PATCH] storage pool discovery

2008-08-01 Thread Stefan de Konink
Daniel,

When this gets in; would it get more easy to lookup a file-storagepool.
In order to make the alternative configuration I proposed for
domains working? (Basically providing pool/volume instead of filename)


Stefan


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


Re: [libvirt] [PATCH] storage pool discovery

2008-08-01 Thread Daniel P. Berrange
On Fri, Aug 01, 2008 at 11:46:14AM +0200, Stefan de Konink wrote:
 Daniel,
 
 When this gets in; would it get more easy to lookup a file-storagepool.
 In order to make the alternative configuration I proposed for
 domains working? (Basically providing pool/volume instead of filename)

I don't think it'll make any significant difference - we can do the
alternate XML syntax you proposed already. I think it might be nice
to use a different approach to the Xen impl of it though. Previously
have had done the poool/volume - filename conversion in libvirt before
passing the data to XenD. This means that when you don't the XML you
get the filename instead of pool/volume details, and doesn't deal with
potentially different filenames upon migration. So I'd like to see if
its possible to write a custom script for xen to go in /etc/xen/scripts.
So we can pass in a pool/volume to Xend and have it auto-lookup the
file at time of hotplug.

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] storage pool discovery

2008-08-01 Thread Stefan de Konink
On Fri, 1 Aug 2008, Daniel P. Berrange wrote:

 On Fri, Aug 01, 2008 at 11:46:14AM +0200, Stefan de Konink wrote:
  Daniel,
 
  When this gets in; would it get more easy to lookup a file-storagepool.
  In order to make the alternative configuration I proposed for
  domains working? (Basically providing pool/volume instead of filename)

 I don't think it'll make any significant difference - we can do the
 alternate XML syntax you proposed already. I think it might be nice
 to use a different approach to the Xen impl of it though. Previously
 have had done the poool/volume - filename conversion in libvirt before
 passing the data to XenD. This means that when you don't the XML you
 get the filename instead of pool/volume details, and doesn't deal with
 potentially different filenames upon migration. So I'd like to see if
 its possible to write a custom script for xen to go in /etc/xen/scripts.
 So we can pass in a pool/volume to Xend and have it auto-lookup the
 file at time of hotplug.

As you know I wrote such thing for iSCSI/Solaris, iSCSI/Netapp so... if
you want such script I can fabricate something, maybe it would be
interesting to not create a script, but instead a binary that links to
libvirt and is able to lookup the connection url and creates the xenstore
stuff.

But as you look at it now, this gets very close to what XenD is doing, so
if we implement it in this way, why not do everything that is required ;)


Stefan

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


[libvirt] libvirt, XEN, bridged network and arp

2008-08-01 Thread Christoph Höger
Hi,

Ive got a severe networking problem over here: When I boot up my machine
(debian lenny) using virsh 0.4.4 on an debian etch, a new virtual eth
device (something like vif97.0) is assigned to that machine and that
device is attached to my bridge virbr1. That is fine. Not so fine is the
fact, that no arp packages come over to my bridge for about 5 seconds or
so.
During that time I can see a lot of arp-who-has on vifXX.0 but nothing
on virbr1 so there are no answers and the result is my guest machine not
mounting nfs directories on boot.
After some time (e.g. after login) networking works fine - but thats
definitely too late - I need those directories mounted on boot.


Is there a way to fix that?


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[PATCH] virsh edit (v3) (was: Re: [libvirt] [PATCH] virsh edit, virsh net-edit, virsh pool-edit)

2008-08-01 Thread Richard W.M. Jones
Thanks for reviewing this patch.

On Fri, Aug 01, 2008 at 10:02:50AM +0200, Jim Meyering wrote:
 What if either contains shell meta-characters?
 To accommodate you'd have to shell-quote as needed, or (as I prefer)
 simply detect the bogosity and refuse to run the command.

Yes, not quite sure what I was thinking of there.  The new version
should reject characters in both the editor  filename which are
not in a small recognized set of characters.

 You can mark entries as const:
 static const vshCmdOptDef opts_edit[] = {

This gives an error because the vshCmdDef array where we aggregate all
of these doesn't expect the const pointer.  Obviously it's a general
const-correctness problem which needs a separate patch to fix
throughout the whole file.

A new patch is attached which should address everything that you
mentioned.

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
Index: docs/virsh.pod
===
RCS file: /data/cvs/libvirt/docs/virsh.pod,v
retrieving revision 1.16
diff -u -r1.16 virsh.pod
--- docs/virsh.pod  15 May 2008 06:12:32 -  1.16
+++ docs/virsh.pod  1 Aug 2008 10:33:22 -
@@ -277,6 +277,19 @@
 
 Output the domain information as an XML dump to stdout, this format can be 
used by the Bcreate command.
 
+=item Bedit Idomain-id
+
+Edit the XML configuration file for a domain.
+
+This is equivalent to:
+ virsh dumpxml domain  domain.xml
+ edit domain.xml
+ virsh define domain.xml
+except that it does some error checking.
+
+The editor used can be supplied by the C$EDITOR environment
+variable, or if that is not defined defaults to Cvi.
+
 =item Bmigrate optional I--live Idomain-id Idesturi Imigrateuri
 
 Migrate domain to another host.  Add --live for live migration. The Idesturi
@@ -480,6 +493,19 @@
 
 Output the virtual network information as an XML dump to stdout.
 
+=item Bnet-edit Inetwork
+
+Edit the XML configuration file for a network.
+
+This is equivalent to:
+ virsh net-dumpxml network  network.xml
+ edit network.xml
+ virsh define network.xml
+except that it does some error checking.
+
+The editor used can be supplied by the C$EDITOR environment
+variable, or if that is not defined defaults to Cvi.
+
 =item Bnet-list optional I--inactive or I--all
 
 Returns the list of active networks, if I--all is specified this will also
Index: src/Makefile.am
===
RCS file: /data/cvs/libvirt/src/Makefile.am,v
retrieving revision 1.86
diff -u -r1.86 Makefile.am
--- src/Makefile.am 11 Jul 2008 16:23:36 -  1.86
+++ src/Makefile.am 1 Aug 2008 10:33:22 -
@@ -138,6 +138,31 @@
 virsh_DEPENDENCIES = $(DEPS)
 virsh_LDADD = $(LDADDS) $(VIRSH_LIBS)
 virsh_CFLAGS = $(COVERAGE_CFLAGS) $(READLINE_CFLAGS)
+BUILT_SOURCES = virsh-net-edit.c virsh-pool-edit.c
+EXTRA_DIST += virsh-net-edit.c virsh-pool-edit.c
+
+virsh-net-edit.c: virsh.c Makefile.am
+   echo '/* Automatically generated from the Makefile and virsh.c */'  $@
+   echo 'static int'  $@
+   awk '/^cmdEdit/, /^}/' $ | \
+   sed -e 's/domain/network/g' \
+   -e 's/Domain/Network/g' \
+   -e 's/cmdEdit/cmdNetworkEdit/g' \
+   -e 's/dom/network/g' \
+$@
+
+virsh-pool-edit.c: virsh.c Makefile.am
+   echo '/* Automatically generated from the Makefile and virsh.c */'  $@
+   echo 'static int'  $@
+   awk '/^cmdEdit/, /^}/' $ | \
+   sed -e 's/domain/pool/g' \
+   -e 's/vshCommandOptDomain/vshCommandOptPool/g' \
+   -e 's/Domain %s/Pool %s/g' \
+   -e 's/Domain/StoragePool/g' \
+   -e 's/cmdEdit/cmdPoolEdit/g' \
+   -e 's/\(virStoragePoolDefineXML.*\));/\1, 0);/' \
+   -e 's/dom/pool/g' \
+$@
 
 if WITH_STORAGE_DISK
 if WITH_LIBVIRTD
Index: src/virsh-net-edit.c
===
RCS file: src/virsh-net-edit.c
diff -N src/virsh-net-edit.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ src/virsh-net-edit.c1 Aug 2008 10:33:22 -
@@ -0,0 +1,85 @@
+/* Automatically generated from the Makefile and virsh.c */
+static int
+cmdNetworkEdit (vshControl *ctl, vshCmd *cmd)
+{
+int ret = FALSE;
+virNetworkPtr network = NULL;
+char *tmp = NULL;
+char *doc = NULL;
+char *doc_edited = NULL;
+char *doc_reread = NULL;
+
+if (!vshConnectionUsability(ctl, ctl-conn, TRUE))
+goto cleanup;
+
+network = vshCommandOptNetwork (ctl, cmd, network, NULL);
+if (network == NULL)
+goto cleanup;
+
+/* Get the XML configuration of the network. */
+doc = virNetworkGetXMLDesc (network, 0);
+if (!doc)
+goto cleanup;
+
+/* Create and open the temporary file. */
+tmp = 

Re: [libvirt] libvirt, XEN, bridged network and arp

2008-08-01 Thread Daniel P. Berrange
On Fri, Aug 01, 2008 at 12:21:53PM +0200, Christoph H?ger wrote:
 Hi,
 
 Ive got a severe networking problem over here: When I boot up my machine
 (debian lenny) using virsh 0.4.4 on an debian etch, a new virtual eth
 device (something like vif97.0) is assigned to that machine and that
 device is attached to my bridge virbr1. That is fine. Not so fine is the
 fact, that no arp packages come over to my bridge for about 5 seconds or
 so.
 During that time I can see a lot of arp-who-has on vifXX.0 but nothing
 on virbr1 so there are no answers and the result is my guest machine not
 mounting nfs directories on boot.
 After some time (e.g. after login) networking works fine - but thats
 definitely too late - I need those directories mounted on boot.

There is a bug in the libvirt default networking - even though the
network is configured with a forward delay of 0, we're not setting
the forward delay. So the kernel default applies which is 15 seconds.
If you explicitly edit the default network config in /etc/libvirt/
to set fd=1 attribute on the bridge tag, it'll work-around the
problem. I'm in process of fixing it to honour a fd=0 which is what
we intended to have  broke a few releases back without realizing.

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


[libvirt] PATCH: Fix setting of bridge forward-delay

2008-08-01 Thread Daniel P. Berrange
The libvirt virtual networking  allows setting of the forward-delay
parameter. This is the delay the kernel inserts before it starts
forwarding traffic when a guest VIF is added to a bridge. The default
network config sets this to zero, and previously we had a bug where
we accidentally called brSetForwardDelay() based on the STP parameter
which was zero, so we did in fact have a forward delay of 0 as desired.

Rich then fixed this bug, and thus we no longer accidentally call the
brSetForardDelay() method. Unfortuntely the place where we *do* delibrately
call it is conditionalized on

 if (network-def-delay


So if you set a forward delay of zero, we never explicitly set this on
the bridge. Thus the kernel's default setting applies which is 15 seconds.

The fix is trivial - just remove the  conditional.

So previously you could see traffic forwaarding delayed by the kernel
for 30 seconds

Aug  1 11:34:16 t60wlan kernel: device vnet0 entered promiscuous mode
Aug  1 11:34:16 t60wlan kernel: virbr0: port 1(vnet0) entering listening state
Aug  1 11:34:31 t60wlan kernel: virbr0: port 1(vnet0) entering learning state
Aug  1 11:34:46 t60wlan kernel: virbr0: topology change detected, propagating
Aug  1 11:34:46 t60wlan kernel: virbr0: port 1(vnet0) entering forwarding state

Now it applies immediately

Aug  1 11:40:07 t60wlan kernel: device vnet0 entered promiscuous mode
Aug  1 11:40:07 t60wlan kernel: virbr0: port 1(vnet0) entering listening state
Aug  1 11:40:07 t60wlan kernel: virbr0: port 1(vnet0) entering learning state
Aug  1 11:40:07 t60wlan kernel: virbr0: topology change detected, propagating
Aug  1 11:40:07 t60wlan kernel: virbr0: port 1(vnet0) entering forwarding state

Daniel

Index: src/qemu_driver.c
===
RCS file: /data/cvs/libvirt/src/qemu_driver.c,v
retrieving revision 1.98
diff -u -r1.98 qemu_driver.c
--- src/qemu_driver.c   30 Jul 2008 09:20:19 -  1.98
+++ src/qemu_driver.c   1 Aug 2008 10:46:36 -
@@ -1480,8 +1480,7 @@
 }
 
 
-if (network-def-delay 
-(err = brSetForwardDelay(driver-brctl, network-def-bridge, 
network-def-delay))) {
+if ((err = brSetForwardDelay(driver-brctl, network-def-bridge, 
network-def-delay))) {
 qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
  _(failed to set bridge forward delay to %ld),
  network-def-delay);


-- 
|: 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: Fix setting of bridge forward-delay

2008-08-01 Thread Richard W.M. Jones
On Fri, Aug 01, 2008 at 11:46:59AM +0100, Daniel P. Berrange wrote:
 The fix is trivial - just remove the  conditional.

ACK that one.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 59 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

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


Re: [libvirt] [PATCH]: Add carriage returns to qemudLog

2008-08-01 Thread Daniel P. Berrange
On Tue, Jul 29, 2008 at 12:05:04PM +0200, Chris Lalancette wrote:
 Since qemudLog just maps to fprintf(stderr), add carriage returns every where 
 it
 is used, so it's easier on the eyes while debugging.

I can't remember why we didn't have these already - I guess previously
we must have had something else adding \n, but lost it in refactoring.
ACK.

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


[libvirt] [PATCH] Add link to how-to-contribute doc from HACKING file

2008-08-01 Thread Richard W.M. Jones

Very trivial patch which adds a link to my document on how to
contribute to open source projects to the HACKING file.

http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 59 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
Index: HACKING
===
RCS file: /data/cvs/libvirt/HACKING,v
retrieving revision 1.4
diff -u -r1.4 HACKING
--- HACKING 2 Jun 2008 11:53:23 -   1.4
+++ HACKING 1 Aug 2008 10:54:04 -
@@ -41,6 +41,12 @@
 a new feature or changing the output of a program.
 
 
+There is more on this subject, including lots of links to background
+reading on the subject, on this page:
+
+  http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/
+
+
 
 Code indentation
 
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] Contribution to libvirt

2008-08-01 Thread rajesh battala
hi Daniel.
thanks a lot..
i will start working on it..

thanks



- Original Message 
From: Daniel Veillard [EMAIL PROTECTED]
To: rajesh battala [EMAIL PROTECTED]
Cc: libvir-list@redhat.com
Sent: Friday, 1 August, 2008 12:28:45 PM
Subject: Re: [libvirt] Contribution to libvirt

On Fri, Aug 01, 2008 at 12:15:38PM +0530, rajesh battala wrote:
 hi all..
 i am interested to contribute to libvirt.
 i want to contribute to the java bindings.
 is there any procedure for that.
 plz let me know i ddint find doc on the site.

  Discuss what you would like to provide here, send patches in unified
diff format against the CVS head. See
  http://libvirt.org/bugs.html
  http://libvirt.org/java.html

  Basically it's like for any other project, I suggest you read
what Rich Jones wrote on the topic:

  http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/

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/



  Unlimited freedom, unlimited storage. Get it now, on 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html/--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] Add link to how-to-contribute doc from HACKING file

2008-08-01 Thread Daniel P. Berrange
On Fri, Aug 01, 2008 at 11:54:28AM +0100, Richard W.M. Jones wrote:
 
 Very trivial patch which adds a link to my document on how to
 contribute to open source projects to the HACKING file.
 
 http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/

ACK

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] Add link to how-to-contribute doc from HACKING file

2008-08-01 Thread Daniel Veillard
On Fri, Aug 01, 2008 at 11:54:28AM +0100, Richard W.M. Jones wrote:
 
 Very trivial patch which adds a link to my document on how to
 contribute to open source projects to the HACKING file.
 
 http://et.redhat.com/~rjones/how-to-supply-code-to-open-source-projects/

  Sure, +1, adding it in the Wiki main page would be a good idea too

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


[libvirt] [PATCH] Const-correctness in virsh.c

2008-08-01 Thread Richard W.M. Jones
This rather tedious patch adds const-correctness to the command  info
structures in virsh.

It's worth noting that it compiles without warning, and the tests
still run.

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
Index: src/virsh.c
===
RCS file: /data/cvs/libvirt/src/virsh.c,v
retrieving revision 1.157
diff -u -r1.157 virsh.c
--- src/virsh.c 22 Jul 2008 16:12:01 -  1.157
+++ src/virsh.c 1 Aug 2008 11:20:26 -
@@ -172,7 +172,7 @@
  * vshCmdOpt - command options
  */
 typedef struct vshCmdOpt {
-vshCmdOptDef *def;  /* pointer to relevant option */
+const vshCmdOptDef *def;/* pointer to relevant option */
 char *data; /* allocated data */
 struct vshCmdOpt *next;
 } vshCmdOpt;
@@ -183,15 +183,15 @@
 typedef struct {
 const char *name;
 int (*handler) (vshControl *, vshCmd *);/* command handler */
-vshCmdOptDef *opts; /* definition of command options */
-vshCmdInfo *info;   /* details about command */
+const vshCmdOptDef *opts;   /* definition of command options */
+const vshCmdInfo *info; /* details about command */
 } vshCmdDef;
 
 /*
  * vshCmd - parsed command
  */
 typedef struct __vshCmd {
-vshCmdDef *def; /* command definition */
+const vshCmdDef *def;   /* command definition */
 vshCmdOpt *opts;/* list of command arguments */
 struct __vshCmd *next;  /* next command */
 } __vshCmd;
@@ -216,7 +216,7 @@
 } __vshControl;
 
 
-static vshCmdDef commands[];
+static const vshCmdDef commands[];
 
 static void vshError(vshControl * ctl, int doexit, const char *format, ...)
 ATTRIBUTE_FORMAT(printf, 3, 4);
@@ -229,8 +229,8 @@
 
 static int vshParseArgv(vshControl * ctl, int argc, char **argv);
 
-static const char *vshCmddefGetInfo(vshCmdDef * cmd, const char *info);
-static vshCmdDef *vshCmddefSearch(const char *cmdname);
+static const char *vshCmddefGetInfo(const vshCmdDef * cmd, const char *info);
+static const vshCmdDef *vshCmddefSearch(const char *cmdname);
 static int vshCmddefHelp(vshControl * ctl, const char *name, int withprog);
 
 static vshCmdOpt *vshCommandOpt(vshCmd * cmd, const char *name);
@@ -332,7 +332,7 @@
 /*
  * help command
  */
-static vshCmdInfo info_help[] = {
+static const vshCmdInfo info_help[] = {
 {syntax, help [command]},
 {help, gettext_noop(print help)},
 {desc, gettext_noop(Prints global help or command specific help.)},
@@ -340,7 +340,7 @@
 {NULL, NULL}
 };
 
-static vshCmdOptDef opts_help[] = {
+static const vshCmdOptDef opts_help[] = {
 {command, VSH_OT_DATA, 0, gettext_noop(name of command)},
 {NULL, 0, 0, NULL}
 };
@@ -351,7 +351,7 @@
 const char *cmdname = vshCommandOptString(cmd, command, NULL);
 
 if (!cmdname) {
-vshCmdDef *def;
+const vshCmdDef *def;
 
 vshPrint(ctl, %s, _(Commands:\n\n));
 for (def = commands; def-name; def++)
@@ -365,7 +365,7 @@
 /*
  * autostart command
  */
-static vshCmdInfo info_autostart[] = {
+static const vshCmdInfo info_autostart[] = {
 {syntax, autostart [--disable] domain},
 {help, gettext_noop(autostart a domain)},
 {desc,
@@ -373,7 +373,7 @@
 {NULL, NULL}
 };
 
-static vshCmdOptDef opts_autostart[] = {
+static const vshCmdOptDef opts_autostart[] = {
 {domain,  VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop(domain name, id or 
uuid)},
 {disable, VSH_OT_BOOL, 0, gettext_noop(disable autostarting)},
 {NULL, 0, 0, NULL}
@@ -417,7 +417,7 @@
 /*
  * connect command
  */
-static vshCmdInfo info_connect[] = {
+static const vshCmdInfo info_connect[] = {
 {syntax, connect [name] [--readonly]},
 {help, gettext_noop((re)connect to hypervisor)},
 {desc,
@@ -425,7 +425,7 @@
 {NULL, NULL}
 };
 
-static vshCmdOptDef opts_connect[] = {
+static const vshCmdOptDef opts_connect[] = {
 {name, VSH_OT_DATA, 0, gettext_noop(hypervisor connection URI)},
 {readonly, VSH_OT_BOOL, 0, gettext_noop(read-only connection)},
 {NULL, 0, 0, NULL}
@@ -465,7 +465,7 @@
 /*
  * console command
  */
-static vshCmdInfo info_console[] = {
+static const vshCmdInfo info_console[] = {
 {syntax, console domain},
 {help, gettext_noop(connect to the guest console)},
 {desc,
@@ -473,7 +473,7 @@
 {NULL, NULL}
 };
 
-static vshCmdOptDef opts_console[] = {
+static const vshCmdOptDef opts_console[] = {
 {domain, VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop(domain name, id or 
uuid)},
 {NULL, 0, 0, NULL}
 };
@@ -542,14 +542,14 @@
 /*
  * list command
  */
-static vshCmdInfo info_list[] = {
+static const vshCmdInfo info_list[] = {
 {syntax, list [--inactive | --all]},
 {help, gettext_noop(list domains)},
 {desc, 

Re: [libvirt] PATCH: Fix setting of bridge forward-delay

2008-08-01 Thread Richard W.M. Jones
On Fri, Aug 01, 2008 at 06:55:32AM -0400, Daniel Veillard wrote:
 BTW you're hinting at a new release and I agree, the last push was June 25
 it was a good release but it sounds like time to make a new push.
 Should we wait for the LXC refactoring ? Anything else waiting ?

I would like to get 'virsh edit' in.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
Read my OCaml programming blog: http://camltastic.blogspot.com/
Fedora now supports 59 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

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


Re: [libvirt] PATCH: Fix setting of bridge forward-delay

2008-08-01 Thread Daniel P. Berrange
On Fri, Aug 01, 2008 at 06:55:32AM -0400, Daniel Veillard wrote:
 On Fri, Aug 01, 2008 at 11:46:59AM +0100, Daniel P. Berrange wrote:
  The libvirt virtual networking  allows setting of the forward-delay
  parameter. This is the delay the kernel inserts before it starts
  forwarding traffic when a guest VIF is added to a bridge. The default
  network config sets this to zero, and previously we had a bug where
  we accidentally called brSetForwardDelay() based on the STP parameter
  which was zero, so we did in fact have a forward delay of 0 as desired.
 [...]
  -if (network-def-delay 
  -(err = brSetForwardDelay(driver-brctl, network-def-bridge, 
  network-def-delay))) {
  +if ((err = brSetForwardDelay(driver-brctl, network-def-bridge, 
  network-def-delay))) {
   qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_(failed to set bridge forward delay to %ld),
network-def-delay);
 
   Oh ! Sure +1 !
 BTW you're hinting at a new release and I agree, the last push was June 25
 it was a good release but it sounds like time to make a new push.
 Should we wait for the LXC refactoring ? Anything else waiting ?

The Xen  QEMU refactoring needs more testing - we've had a good few
bug reports about it this week, and I'm sure there's more pending. 

Also, since the LXC and OpenVZ drivers are now on by default we need
to finish porting them to the new XML routines so they are compliant
with the official XML schema.

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]: Add carriage returns to qemudLog

2008-08-01 Thread Daniel Veillard
On Tue, Jul 29, 2008 at 12:05:04PM +0200, Chris Lalancette wrote:
 Since qemudLog just maps to fprintf(stderr), add carriage returns every where 
 it
 is used, so it's easier on the eyes while debugging.

  Okay, no problem, 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] Contribution to libvirt

2008-08-01 Thread Daniel Veillard
On Fri, Aug 01, 2008 at 04:25:02PM +0530, rajesh battala wrote:
 hi Daniel.
 thanks a lot..
 i will start working on it..

  Hum, but what do you want to do ? This is at least as important
to me an others than getting patches.

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: Fix setting of bridge forward-delay

2008-08-01 Thread Daniel Veillard
On Fri, Aug 01, 2008 at 12:22:35PM +0100, Richard W.M. Jones wrote:
 On Fri, Aug 01, 2008 at 06:55:32AM -0400, Daniel Veillard wrote:
  BTW you're hinting at a new release and I agree, the last push was June 25
  it was a good release but it sounds like time to make a new push.
  Should we wait for the LXC refactoring ? Anything else waiting ?
 
 I would like to get 'virsh edit' in.

  Well, push it :-) !
I expect to still be busy with libxml2 for the end of the week and maybe
a bit more next week, so you have a couple of days at least ...

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: Fix setting of bridge forward-delay

2008-08-01 Thread Richard W.M. Jones
On Fri, Aug 01, 2008 at 07:30:31AM -0400, Daniel Veillard wrote:
 On Fri, Aug 01, 2008 at 12:22:35PM +0100, Richard W.M. Jones wrote:
  On Fri, Aug 01, 2008 at 06:55:32AM -0400, Daniel Veillard wrote:
   BTW you're hinting at a new release and I agree, the last push was June 25
   it was a good release but it sounds like time to make a new push.
   Should we wait for the LXC refactoring ? Anything else waiting ?
  
  I would like to get 'virsh edit' in.
 
   Well, push it :-) !

Well, there's a new version I posted this morning.  May need some
checking:

https://www.redhat.com/archives/libvir-list/2008-August/msg00018.html

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: [libvirt] [PATCH] Const-correctness in virsh.c

2008-08-01 Thread Daniel Veillard
On Fri, Aug 01, 2008 at 12:21:53PM +0100, Richard W.M. Jones wrote:
 This rather tedious patch adds const-correctness to the command  info
 structures in virsh.
 
 It's worth noting that it compiles without warning, and the tests
 still run.

  This looks safe to me, no problem +1

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: Fix setting of bridge forward-delay

2008-08-01 Thread Daniel Veillard
On Fri, Aug 01, 2008 at 12:25:03PM +0100, Daniel P. Berrange wrote:
 On Fri, Aug 01, 2008 at 06:55:32AM -0400, Daniel Veillard wrote:
  BTW you're hinting at a new release and I agree, the last push was June 25
  it was a good release but it sounds like time to make a new push.
  Should we wait for the LXC refactoring ? Anything else waiting ?
 
 The Xen  QEMU refactoring needs more testing - we've had a good few
 bug reports about it this week, and I'm sure there's more pending. 
 
 Also, since the LXC and OpenVZ drivers are now on by default we need
 to finish porting them to the new XML routines so they are compliant
 with the official XML schema.

  Okay let's give it another week or so, but we should not wait too long.
Evgeniy you think you should be able to make an update patch switching to
the new parser infrastructure next week ?

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] Const-correctness in virsh.c

2008-08-01 Thread Jim Meyering
Richard W.M. Jones [EMAIL PROTECTED] wrote:
 This rather tedious patch adds const-correctness to the command  info
 structures in virsh.

Good idea.
ACK.

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


[libvirt] virsh.c: more const-correctness

2008-08-01 Thread Jim Meyering
One good turn deserves another ;-)
This also normalizes spacing around the * in declarations
of vshControl and vshCmd pointers.

Of course, this compiles with no warnings and passes make syntax-check.

From e0db0c0eb4a62eafe1f5790de6d7f9a9d5cb84a0 Mon Sep 17 00:00:00 2001
From: Jim Meyering [EMAIL PROTECTED]
Date: Fri, 1 Aug 2008 14:00:20 +0200
Subject: [PATCH] virsh.c: more const-correctness

---
 src/virsh.c |  266 +-
 1 files changed, 133 insertions(+), 133 deletions(-)

diff --git a/src/virsh.c b/src/virsh.c
index 620f103..d636301 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -182,7 +182,7 @@ typedef struct vshCmdOpt {
  */
 typedef struct {
 const char *name;
-int (*handler) (vshControl *, vshCmd *);/* command handler */
+int (*handler) (vshControl *, const vshCmd *);/* command handler */
 vshCmdOptDef *opts; /* definition of command options */
 vshCmdInfo *info;   /* details about command */
 } vshCmdDef;
@@ -218,35 +218,35 @@ typedef struct __vshControl {

 static vshCmdDef commands[];

-static void vshError(vshControl * ctl, int doexit, const char *format, ...)
+static void vshError(vshControl *ctl, int doexit, const char *format, ...)
 ATTRIBUTE_FORMAT(printf, 3, 4);
-static int vshInit(vshControl * ctl);
-static int vshDeinit(vshControl * ctl);
-static void vshUsage(vshControl * ctl, const char *cmdname);
+static int vshInit(vshControl *ctl);
+static int vshDeinit(vshControl *ctl);
+static void vshUsage(vshControl *ctl, const char *cmdname);
 static void vshOpenLogFile(vshControl *ctl);
 static void vshOutputLogFile(vshControl *ctl, int log_level, const char 
*format, va_list ap);
 static void vshCloseLogFile(vshControl *ctl);

-static int vshParseArgv(vshControl * ctl, int argc, char **argv);
+static int vshParseArgv(vshControl *ctl, int argc, char **argv);

 static const char *vshCmddefGetInfo(vshCmdDef * cmd, const char *info);
 static vshCmdDef *vshCmddefSearch(const char *cmdname);
-static int vshCmddefHelp(vshControl * ctl, const char *name, int withprog);
+static int vshCmddefHelp(vshControl *ctl, const char *name, int withprog);

-static vshCmdOpt *vshCommandOpt(vshCmd * cmd, const char *name);
-static int vshCommandOptInt(vshCmd * cmd, const char *name, int *found);
-static char *vshCommandOptString(vshCmd * cmd, const char *name,
+static vshCmdOpt *vshCommandOpt(const vshCmd *cmd, const char *name);
+static int vshCommandOptInt(const vshCmd *cmd, const char *name, int *found);
+static char *vshCommandOptString(const vshCmd *cmd, const char *name,
  int *found);
 #if 0
-static int vshCommandOptStringList(vshCmd * cmd, const char *name, char 
***data);
+static int vshCommandOptStringList(const vshCmd *cmd, const char *name, char 
***data);
 #endif
-static int vshCommandOptBool(vshCmd * cmd, const char *name);
+static int vshCommandOptBool(const vshCmd *cmd, const char *name);

 #define VSH_BYID (1  1)
 #define VSH_BYUUID   (1  2)
 #define VSH_BYNAME   (1  3)

-static virDomainPtr vshCommandOptDomainBy(vshControl * ctl, vshCmd * cmd,
+static virDomainPtr vshCommandOptDomainBy(vshControl *ctl, const vshCmd *cmd,
   const char *optname, char **name, 
int flag);

 /* default is lookup by Id, Name and UUID */
@@ -254,7 +254,7 @@ static virDomainPtr vshCommandOptDomainBy(vshControl * ctl, 
vshCmd * cmd,
 vshCommandOptDomainBy(_ctl, _cmd, _optname, _name,  \
   VSH_BYID|VSH_BYUUID|VSH_BYNAME)

-static virNetworkPtr vshCommandOptNetworkBy(vshControl * ctl, vshCmd * cmd,
+static virNetworkPtr vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
 const char *optname, char **name, int flag);

 /* default is lookup by Name and UUID */
@@ -262,7 +262,7 @@ static virNetworkPtr vshCommandOptNetworkBy(vshControl * 
ctl, vshCmd * cmd,
 vshCommandOptNetworkBy(_ctl, _cmd, _optname, _name, \
VSH_BYUUID|VSH_BYNAME)

-static virStoragePoolPtr vshCommandOptPoolBy(vshControl * ctl, vshCmd * cmd,
+static virStoragePoolPtr vshCommandOptPoolBy(vshControl *ctl, const vshCmd 
*cmd,
 const char *optname, char **name, int flag);

 /* default is lookup by Name and UUID */
@@ -270,7 +270,7 @@ static virStoragePoolPtr vshCommandOptPoolBy(vshControl * 
ctl, vshCmd * cmd,
 vshCommandOptPoolBy(_ctl, _cmd, _optname, _name, \
VSH_BYUUID|VSH_BYNAME)

-static virStorageVolPtr vshCommandOptVolBy(vshControl * ctl, vshCmd * cmd,
+static virStorageVolPtr vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
const char *optname,
const char *pooloptname,
char **name, int flag);
@@ -280,9 +280,9 @@ static virStorageVolPtr 

[libvirt] Re: [PATCH] virsh edit (v3)

2008-08-01 Thread Jim Meyering
Richard W.M. Jones [EMAIL PROTECTED] wrote:
 A new patch is attached which should address everything that you
 mentioned.

That was quick ;-)

 Index: src/Makefile.am
 ===
 RCS file: /data/cvs/libvirt/src/Makefile.am,v
 retrieving revision 1.86
 diff -u -r1.86 Makefile.am
 --- src/Makefile.am   11 Jul 2008 16:23:36 -  1.86
 +++ src/Makefile.am   1 Aug 2008 10:33:22 -
 @@ -138,6 +138,31 @@
  virsh_DEPENDENCIES = $(DEPS)
  virsh_LDADD = $(LDADDS) $(VIRSH_LIBS)
  virsh_CFLAGS = $(COVERAGE_CFLAGS) $(READLINE_CFLAGS)
 +BUILT_SOURCES = virsh-net-edit.c virsh-pool-edit.c
 +EXTRA_DIST += virsh-net-edit.c virsh-pool-edit.c
 +
 +virsh-net-edit.c: virsh.c Makefile.am
 + echo '/* Automatically generated from the Makefile and virsh.c */'  $@
 + echo 'static int'  $@
 + awk '/^cmdEdit/, /^}/' $ | \
 + sed -e 's/domain/network/g' \
 + -e 's/Domain/Network/g' \
 + -e 's/cmdEdit/cmdNetworkEdit/g' \
 + -e 's/dom/network/g' \
 +  $@

Don't redirect directly to [EMAIL PROTECTED]
Otherwise, if something goes wrong before the output is completely written,
you're left with a corrupt input that has an up-to-date time stamp.
That can be a pain to diagnose.

Also, if you make each generated file read-only, then even those
who don't spot the Auto-Generated-from comment at the top will have
a hard time accidentally changing it.

Also, you can include dependent names in the comment with $^:

I indented the sed command so it's clearer that it's
on a backslash-continued line:

virsh-net-edit.c: virsh.c Makefile.am
rm -f [EMAIL PROTECTED] $@
echo '/* Automatically generated from: $^ */'  [EMAIL PROTECTED]
echo 'static int'  [EMAIL PROTECTED]
awk '/^cmdEdit/, /^}/' $   \
  | sed -e 's/domain/network/g' \
 -e 's/Domain/Network/g'\
 -e 's/cmdEdit/cmdNetworkEdit/g'\
 -e 's/dom/network/g'   \
   [EMAIL PROTECTED]
chmod a-w [EMAIL PROTECTED]
mv [EMAIL PROTECTED] $@

This is longer than the original rule, but it's for a good cause:
the point is to better protect readers/builders/developers.
We incur the cost of writing Makefile.am once, but the audience
will be saved some small wasted effort over and over ;-)

Yes, there are many other rules that can benefit from the same
treatment.  have to start somewhere.

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


Re: [libvirt] virsh.c: more const-correctness

2008-08-01 Thread Daniel Veillard
On Fri, Aug 01, 2008 at 02:04:45PM +0200, Jim Meyering wrote:
 One good turn deserves another ;-)
 This also normalizes spacing around the * in declarations
 of vshControl and vshCmd pointers.

  Sure, +1

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: Support container XML enhancements

2008-08-01 Thread Daniel P. Berrange
On Tue, Jul 29, 2008 at 04:44:32PM +0100, John Levon wrote:
 On Tue, Jul 29, 2008 at 04:20:14PM +0100, Daniel P. Berrange wrote:
 
  This is something I previously submitted as part of one of the LXC
  patches, but I figure it makes sense on its own, since OpenVZ needs
  this now too.
 
 No update to libvirt.rng? Or test cases?

I added the libvirt.rng update and a test XML data file to validate
when I comitted this patch

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


[libvirt] sexpr.c: reviving an old const-correct change

2008-08-01 Thread Jim Meyering
I wrote this months ago and forgot about it:

diff --git a/src/xend_internal.c b/src/xend_internal.c
index 880a279..1e6e875 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -2171,7 +2171,7 @@ error:
  */
 static virDomainDefPtr
 xenDaemonParseSxpr(virConnectPtr conn,
-   struct sexpr *root,
+   const struct sexpr *root,
int xendConfigVersion,
const char *cpus)
 {



When you pull the thread (i.e., eliminate all resulting
warnings that arise from the above change), you end up with
the following additional const-adding changes:
(I'll squash the two into a single change set before committing)


From 1d0fd10b999ab65c555d8cb5bcfc03bc5cad9e6e Mon Sep 17 00:00:00 2001
From: Jim Meyering [EMAIL PROTECTED]
Date: Fri, 1 Aug 2008 15:36:31 +0200
Subject: [PATCH] xend_internal.c, sexpr.c: const-correctness

---
 src/sexpr.c |2 +-
 src/sexpr.h |2 +-
 src/xend_internal.c |   19 ++-
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/sexpr.c b/src/sexpr.c
index 90c549c..b607e41 100644
--- a/src/sexpr.c
+++ b/src/sexpr.c
@@ -519,7 +519,7 @@ sexpr_lookup(const struct sexpr *sexpr, const char *node)
  * Returns true if the key was found, false otherwise
  */
 int
-sexpr_has(struct sexpr *sexpr, const char *node)
+sexpr_has(const struct sexpr *sexpr, const char *node)
 {
 struct sexpr *s = sexpr_lookup_key(sexpr, node);

diff --git a/src/sexpr.h b/src/sexpr.h
index 0559a27..c3d038e 100644
--- a/src/sexpr.h
+++ b/src/sexpr.h
@@ -51,5 +51,5 @@ int sexpr_node_copy(const struct sexpr *sexpr, const char 
*node, char **dst);
 const char *sexpr_fmt_node(const struct sexpr *sexpr, const char *fmt, ...)
   ATTRIBUTE_FORMAT(printf,2,3);
 struct sexpr *sexpr_lookup(const struct sexpr *sexpr, const char *node);
-int sexpr_has(struct sexpr *sexpr, const char *node);
+int sexpr_has(const struct sexpr *sexpr, const char *node);
 #endif
diff --git a/src/xend_internal.c b/src/xend_internal.c
index 1e6e875..e29702a 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -1180,7 +1180,8 @@ xend_detect_config_version(virConnectPtr conn) {
  * Returns 0 in case of success and -1 in case of error
  */
 static int
-xenDaemonParseSxprOS(virConnectPtr xend, struct sexpr *node,
+xenDaemonParseSxprOS(virConnectPtr xend,
+const struct sexpr *node,
  virDomainDefPtr def,
  int hvm)
 {
@@ -1640,11 +1641,11 @@ error:
 static int
 xenDaemonParseSxprDisks(virConnectPtr conn,
 virDomainDefPtr def,
-struct sexpr *root,
+const struct sexpr *root,
 int hvm,
 int xendConfigVersion)
 {
-struct sexpr *cur, *node;
+const struct sexpr *cur, *node;
 virDomainDiskDefPtr disk = NULL, prev = def-disks;

 for (cur = root; cur-kind == SEXPR_CONS; cur = cur-u.s.cdr) {
@@ -1803,10 +1804,10 @@ error:
 static int
 xenDaemonParseSxprNets(virConnectPtr conn,
virDomainDefPtr def,
-   struct sexpr *root)
+   const struct sexpr *root)
 {
 virDomainNetDefPtr net = NULL, prev = def-nets;
-struct sexpr *cur, *node;
+const struct sexpr *cur, *node;
 const char *tmp;
 int vif_index = 0;

@@ -1964,7 +1965,7 @@ error:
 static int
 xenDaemonParseSxprUSB(virConnectPtr conn,
   virDomainDefPtr def,
-  struct sexpr *root)
+  const struct sexpr *root)
 {
 virDomainInputDefPtr prev = def-inputs;
 struct sexpr *cur, *node;
@@ -2007,7 +2008,7 @@ no_memory:
 static int
 xenDaemonParseSxprGraphicsOld(virConnectPtr conn,
   virDomainDefPtr def,
-  struct sexpr *root,
+  const struct sexpr *root,
   int hvm,
   int xendConfigVersion)
 {
@@ -2085,10 +2086,10 @@ no_memory:
 static int
 xenDaemonParseSxprGraphicsNew(virConnectPtr conn,
   virDomainDefPtr def,
-  struct sexpr *root)
+  const struct sexpr *root)
 {
 virDomainGraphicsDefPtr graphics = NULL;
-struct sexpr *cur, *node;
+const struct sexpr *cur, *node;
 const char *tmp;

 /* append network devices and framebuffer */
--
1.6.0.rc1.29.gf08e3

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


Re: [libvirt] virsh.c: more const-correctness

2008-08-01 Thread Jim Meyering
Daniel Veillard [EMAIL PROTECTED] wrote:
 On Fri, Aug 01, 2008 at 02:04:45PM +0200, Jim Meyering wrote:
 One good turn deserves another ;-)
 This also normalizes spacing around the * in declarations
 of vshControl and vshCmd pointers.

   Sure, +1

Thanks.  Pushed.

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


[libvirt] [PATCH] virsh edit (v4)

2008-08-01 Thread Richard W.M. Jones
Here's version 4 of the patch, which I believe covers all the things
you've raised.  The changes since version 3 are:

(a) 'sed' snippets reformulated as you suggested

(b) const-correctness changes added to this patch

(c) We don't include the generated files virsh-net-edit.c or
virsh-pool-edit.c in CVS (or in the tarball).

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
Index: docs/virsh.pod
===
RCS file: /data/cvs/libvirt/docs/virsh.pod,v
retrieving revision 1.16
diff -u -r1.16 virsh.pod
--- docs/virsh.pod  15 May 2008 06:12:32 -  1.16
+++ docs/virsh.pod  1 Aug 2008 14:18:16 -
@@ -277,6 +277,19 @@
 
 Output the domain information as an XML dump to stdout, this format can be 
used by the Bcreate command.
 
+=item Bedit Idomain-id
+
+Edit the XML configuration file for a domain.
+
+This is equivalent to:
+ virsh dumpxml domain  domain.xml
+ edit domain.xml
+ virsh define domain.xml
+except that it does some error checking.
+
+The editor used can be supplied by the C$EDITOR environment
+variable, or if that is not defined defaults to Cvi.
+
 =item Bmigrate optional I--live Idomain-id Idesturi Imigrateuri
 
 Migrate domain to another host.  Add --live for live migration. The Idesturi
@@ -480,6 +493,19 @@
 
 Output the virtual network information as an XML dump to stdout.
 
+=item Bnet-edit Inetwork
+
+Edit the XML configuration file for a network.
+
+This is equivalent to:
+ virsh net-dumpxml network  network.xml
+ edit network.xml
+ virsh define network.xml
+except that it does some error checking.
+
+The editor used can be supplied by the C$EDITOR environment
+variable, or if that is not defined defaults to Cvi.
+
 =item Bnet-list optional I--inactive or I--all
 
 Returns the list of active networks, if I--all is specified this will also
Index: src/.cvsignore
===
RCS file: /data/cvs/libvirt/src/.cvsignore,v
retrieving revision 1.5
diff -u -r1.5 .cvsignore
--- src/.cvsignore  20 Feb 2008 15:58:38 -  1.5
+++ src/.cvsignore  1 Aug 2008 14:18:16 -
@@ -11,3 +11,5 @@
 *.gcov
 *.cov
 libvirt_parthelper
+virsh-net-edit.c
+virsh-pool-edit.c
Index: src/Makefile.am
===
RCS file: /data/cvs/libvirt/src/Makefile.am,v
retrieving revision 1.86
diff -u -r1.86 Makefile.am
--- src/Makefile.am 11 Jul 2008 16:23:36 -  1.86
+++ src/Makefile.am 1 Aug 2008 14:18:16 -
@@ -138,6 +138,38 @@
 virsh_DEPENDENCIES = $(DEPS)
 virsh_LDADD = $(LDADDS) $(VIRSH_LIBS)
 virsh_CFLAGS = $(COVERAGE_CFLAGS) $(READLINE_CFLAGS)
+BUILT_SOURCES = virsh-net-edit.c virsh-pool-edit.c
+
+virsh-net-edit.c: virsh.c Makefile.am
+   rm -f [EMAIL PROTECTED]
+   echo '/* Automatically generated from: $^ */'  [EMAIL PROTECTED]
+   echo 'static int'  [EMAIL PROTECTED]
+   awk '/^cmdEdit/, /^}/' $ \
+ | sed -e 's/domain/network/g' \
+ -e 's/Domain/Network/g' \
+ -e 's/cmdEdit/cmdNetworkEdit/g' \
+ -e 's/dom/network/g' \
+[EMAIL PROTECTED]
+   chmod a-w [EMAIL PROTECTED]
+   rm -f $@
+   mv [EMAIL PROTECTED] $@
+
+virsh-pool-edit.c: virsh.c Makefile.am
+   rm -f [EMAIL PROTECTED]
+   echo '/* Automatically generated from: $^ */'  [EMAIL PROTECTED]
+   echo 'static int'  [EMAIL PROTECTED]
+   awk '/^cmdEdit/, /^}/' $ \
+ | sed -e 's/domain/pool/g' \
+ -e 's/vshCommandOptDomain/vshCommandOptPool/g' \
+ -e 's/Domain %s/Pool %s/g' \
+ -e 's/Domain/StoragePool/g' \
+ -e 's/cmdEdit/cmdPoolEdit/g' \
+ -e 's/\(virStoragePoolDefineXML.*\));/\1, 0);/' \
+ -e 's/dom/pool/g' \
+[EMAIL PROTECTED]
+   chmod a-w [EMAIL PROTECTED]
+   rm -f $@
+   mv [EMAIL PROTECTED] $@
 
 if WITH_STORAGE_DISK
 if WITH_LIBVIRTD
Index: src/virsh.c
===
RCS file: /data/cvs/libvirt/src/virsh.c,v
retrieving revision 1.159
diff -u -r1.159 virsh.c
--- src/virsh.c 1 Aug 2008 13:51:18 -   1.159
+++ src/virsh.c 1 Aug 2008 14:18:17 -
@@ -5058,6 +5058,263 @@
 return ret;
 }
 
+/* Common code for the edit / net-edit / pool-edit functions which follow. */
+static char *
+editWriteToTempFile (vshControl *ctl, const char *doc)
+{
+char *ret;
+const char *tmpdir;
+int fd;
+
+ret = malloc (PATH_MAX);
+if (!ret) {
+vshError(ctl, FALSE,
+ _(malloc: failed to allocate temporary file name: %s),
+ strerror (errno));
+return NULL;
+}
+
+tmpdir = getenv (TMPDIR);
+if (!tmpdir) tmpdir = /tmp;
+snprintf 

[libvirt] Re: [PATCH] virsh edit (v4)

2008-08-01 Thread Jim Meyering
Richard W.M. Jones [EMAIL PROTECTED] wrote:
 Here's version 4 of the patch, which I believe covers all the things
 you've raised.  The changes since version 3 are:

 (a) 'sed' snippets reformulated as you suggested

 (b) const-correctness changes added to this patch

 (c) We don't include the generated files virsh-net-edit.c or
 virsh-pool-edit.c in CVS (or in the tarball).

Thanks!  All good.
ACK

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


Re: [libvirt] sexpr.c: reviving an old const-correct change

2008-08-01 Thread Daniel Veillard
On Fri, Aug 01, 2008 at 04:12:05PM +0200, Jim Meyering wrote:
 I wrote this months ago and forgot about it:
 
 diff --git a/src/xend_internal.c b/src/xend_internal.c
 index 880a279..1e6e875 100644
 --- a/src/xend_internal.c
 +++ b/src/xend_internal.c
 @@ -2171,7 +2171,7 @@ error:
   */
  static virDomainDefPtr
  xenDaemonParseSxpr(virConnectPtr conn,
 -   struct sexpr *root,
 +   const struct sexpr *root,
 int xendConfigVersion,
 const char *cpus)
  {
 
 
 
 When you pull the thread (i.e., eliminate all resulting
 warnings that arise from the above change), you end up with
 the following additional const-adding changes:
 (I'll squash the two into a single change set before committing)
 

  Looks fine too, +1

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] sexpr.c: reviving an old const-correct change

2008-08-01 Thread Jim Meyering
Daniel Veillard [EMAIL PROTECTED] wrote:
   Looks fine too, +1

Ta.  Pushed.

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


[libvirt] How does virt-manager send shutdown?

2008-08-01 Thread Bryan Kearney
How does virt-manager send shutdown to guests? Does it depend on if you 
are running kvm or xen? I have been building images with acpid enabled 
and acpi=force on the command line. After upgrading to f9 and running 
kvm my images no longer respond to shutdown. Is there a tweak which I 
have missed?


- bk

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


Re: [libvirt] How does virt-manager send shutdown?

2008-08-01 Thread Henri Cook

Bryan Kearney wrote:
How does virt-manager send shutdown to guests? Does it depend on if 
you are running kvm or xen? I have been building images with acpid 
enabled and acpi=force on the command line. After upgrading to f9 and 
running kvm my images no longer respond to shutdown. Is there a tweak 
which I have missed?


- bk

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

Hi Bryan,

What version of KVM does this now mean you are running?

Rgds,

Henri

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


Re: [libvirt] How does virt-manager send shutdown?

2008-08-01 Thread Bryan Kearney



Henri Cook wrote:

Bryan Kearney wrote:
How does virt-manager send shutdown to guests? Does it depend on if 
you are running kvm or xen? I have been building images with acpid 
enabled and acpi=force on the command line. After upgrading to f9 and 
running kvm my images no longer respond to shutdown. Is there a tweak 
which I have missed?


- bk

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

Hi Bryan,

What version of KVM does this now mean you are running?



Should have included this:

[EMAIL PROTECTED] bin]$ rpm -qa | grep kvm
kvm-65-7.fc9.i386
[EMAIL PROTECTED] bin]$ uname -a
Linux localhost.localdomain 2.6.25.11-97.fc9.i686 #1 SMP Mon Jul 21 
01:31:09 EDT 2008 i686 i686 i386 GNU/Linux

[EMAIL PROTECTED] bin]$

-- bk


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


Re: [libvirt] fully virtualized xen guest question

2008-08-01 Thread Christoph Höger
Am Freitag, den 01.08.2008, 10:23 +0100 schrieb Daniel P. Berrange:
 On Thu, Jul 31, 2008 at 11:31:39PM +0200, Christoph H?ger wrote:
  I am running XEN on an debian etch. For clustering purposes I wanted to
  boot fedora as virtual machine. 
  
  That works (except for nfs mounts) fine using the paravortualization
  features.
  
  But fully virtulalized guests do not even boot, I do not get any
  sensefull error message, my config file looks like:
  
  domain type='xen'
  namewerewolf/name
  
  os
  typehvm/type
  loader/usr/lib/xen-3.0.3-1/boot/hvmloader/loader
  
  kernel/data/virtual/kernel/kvm1/vmlinuz-2.6.18-6-amd64/kernel
  
  initrd/data/virtual/kernel/kvm1/initrd.img-2.6.18-6-amd64/initrd
  cmdlineroot=/dev/hda1/cmdline
 
 Booting fullyvirtualized guests off a kernel+initrd is a very new
 feature in Xen. Your loader path suggests you are using Xen 3.0.3
 which is no where near new enough to support this. You need to boot
 of CDROM or hardisk instead.
 
  domain type='xen'
  namewerewolf/name
  
  os
  typehvm/type
  loader/usr/lib/xen-3.0.3-1/boot/hvmloader/loader
  
  kernel/data/virtual/kernel/kvm1/vmlinuz-2.6.18-6-amd64/kernel
  
  initrd/data/virtual/kernel/kvm1/initrd.img-2.6.18-6-amd64/initrd
  cmdlineroot=/dev/hda1/cmdline
  /os
memory524M/memory
vcpu1/vcpu
devices
  emulator/usr/bin/kvm/emulator
 
 Urm, you're trying to use KVM with Xen which just won't work. You
 need to point to Xen's version of QEMU /usr/lib/xen/bin/qemu-dm
 or whereever Debian puts it.
 
  all I get when tryin virsh create is:
  
  xend_post: error from xen daemon: (xend.err Error creating domain: (0,
  'Error'))
 
 This looks like a fairly old Xen which didn't know how to give proper
 error messages. You'll have to check /var/log/xen/ for more details,
 but it'll certainly be the kernel/initrd stuff that's broken, and the
 device emulator too.
 
 Daniel

Hmm,

that's bad. Is there a way to run a kernel  2.6.18 as DomU under an
2.6.18 Dom0 paravirtualized? 


signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list