[Libvir] [patch] fix typos

2008-04-22 Thread Atsushi SAKAI
Hi,

Fix typos on proxy/libvirt_proxy.c.

Thanks
Atsushi SAKAI



fix_typos20080422.patch
Description: Binary data
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [patch] fix typos

2008-04-22 Thread Daniel Veillard
On Tue, Apr 22, 2008 at 09:58:00PM +0900, Atsushi SAKAI wrote:
 Hi,
 
 Fix typos on proxy/libvirt_proxy.c.

  Yes, please commit,

   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] sound support for qemu and xen

2008-04-22 Thread Jerone Young
I was actually thinking about doing this very patch :-) . Are you going
to also enable virt-manager to make use of it ? Since it's just good old
qemu it will be great for local KVM use.

Though it would be really nice if pulse audio support to where added to
qemu. Then someway expose options also through libvirt on which audio
subsystem to use (oss, alsa, or pulseaudio). Then with pulse audio you
do have the ability to transport it over the net (though never tried it
or set it up yet), to work with remote clients.


On Mon, 2008-04-21 at 13:02 -0400, Cole Robinson wrote:
 The patch below adds xml support for the soundhw option to qemu
 and xen. The new xml element takes the form:
 
 sound driver='drivername'/
 
 Where driver name can be pcspk, sb16, es1370, or all.
 
 
 Everything seems to be in working order but I have a few
 implementation questions:
 
 1) Should multiple drivers be able to be specified? qemu
 accommodates this, allowing  '-soundhw sb16,pcspk' for example.
 If this should be allowed, what should the xml format be? 
 
 2) Should acceptable driver options be hardcoded? The other option
 is to just pass the input straight to qemu. This patch has the
 options hardcoded.
 
 Also I realize this will probably need to be rediff'd around
 Dan's serial + parallel device patch, but I figured I would just
 get this out there.
 
 Thanks,
 Cole
 plain text document attachment (libvirt-sound-patch)
 diff --git a/src/qemu_conf.c b/src/qemu_conf.c
 index d9b82b2..bfd9ba4 100644
 --- a/src/qemu_conf.c
 +++ b/src/qemu_conf.c
 @@ -1011,6 +1011,41 @@ static int qemudParseInputXML(virConnectPtr conn,
  return -1;
  }
 
 +/* Sound device helper functions */
 +static int qemudSoundDriverFromString(virConnectPtr conn,
 +  const char *driver) {
 +if (STREQ(driver, all)) {
 +return QEMU_SOUND_ALL;
 +} else if (STREQ(driver, sb16)) {
 +return QEMU_SOUND_SB16;
 +} else if (STREQ(driver, es1370)) {
 +return QEMU_SOUND_ES1370;
 +} else if (STREQ(driver, pcspk)) {
 +return QEMU_SOUND_PCSPK;
 +}
 +
 +qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_ARG,
 + _(invalid sound driver '%s'), driver);
 +return -1;
 +}
 +
 +static const char *qemudSoundDriverToString(virConnectPtr conn,
 +const int driver) {
 +
 +if (driver == QEMU_SOUND_ALL) {
 +return all;
 +} else if (driver == QEMU_SOUND_SB16) {
 +return sb16;
 +} else if (driver == QEMU_SOUND_ES1370) {
 +return es1370;
 +} else if (driver == QEMU_SOUND_PCSPK) {
 +return pcspk;
 +}
 +
 +qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
 + _(invalid sound driver '%d'), driver);
 +return NULL;
 +}
 
  /*
   * Parses a libvirt XML definition of a guest, and populates the
 @@ -1486,6 +1521,25 @@ static struct qemud_vm_def 
 *qemudParseXML(virConnectPtr conn,
  }
  }
  xmlXPathFreeObject(obj);
 +
 +/* Parse sound driver xml */
 +obj = xmlXPathEval(BAD_CAST /domain/devices/sound, ctxt);
 +if ((obj == NULL) || (obj-type != XPATH_NODESET) ||
 +(obj-nodesetval == NULL) || (obj-nodesetval-nodeNr == 0)) {
 +def-soundDriver = QEMU_SOUND_NONE;
 +} else if ((prop = xmlGetProp(obj-nodesetval-nodeTab[0],
 +BAD_CAST driver))) {
 +
 +if ((def-soundDriver = qemudSoundDriverFromString(conn,
 +   (char *) prop))  
 0)
 +goto error;
 +
 +xmlFree(prop);
 +prop = NULL;
 +} else {
 +def-soundDriver = QEMU_SOUND_NONE;
 +}
 +xmlXPathFreeObject(obj);
  obj = NULL;
 
  /* If graphics are enabled, there's an implicit PS2 mouse */
 @@ -1694,6 +1748,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
  (vm-def-os.cmdline[0] ? 2 : 0) + /* cmdline */
  (vm-def-graphicsType == QEMUD_GRAPHICS_VNC ? 2 :
   (vm-def-graphicsType == QEMUD_GRAPHICS_SDL ? 0 : 1)) + /* 
 graphics */
 +(vm-def-soundDriver == QEMU_SOUND_NONE ? 0 : 2) + /* sound */
  (vm-migrateFrom[0] ? 3 : 0); /* migrateFrom */
 
  snprintf(memory, sizeof(memory), %lu, vm-def-memory/1024);
 @@ -1970,6 +2025,14 @@ int qemudBuildCommandLine(virConnectPtr conn,
  /* SDL is the default. no args needed */
  }
 
 +/* Add sound hardware */
 +if (vm-def-soundDriver != QEMU_SOUND_NONE) {
 +if (!((*argv)[++n] = strdup(-soundhw)))
 +goto no_memory;
 +if (!((*argv)[++n] = strdup((char *) qemudSoundDriverToString(conn, 
 vm-def-soundDriver
 +goto no_memory;
 +}
 +
  if (vm-migrateFrom[0]) {
  if (!((*argv)[++n] = strdup(-S)))
  goto no_memory;
 @@ -3125,7 +3188,11 @@ char *qemudGenerateXML(virConnectPtr conn,
  break;
  }
 
 -if (def-graphicsType == QEMUD_GRAPHICS_VNC) {
 +if 

[Libvir] Extra options to dnsmasq

2008-04-22 Thread PATTE, Mathieu


Hi everyone!
 
Is there any way I can pass extra options to dnsmasq when starting a
virtual network? 
I need that in order to specify static dhcp leases. (is there another
way to do that?)
 
Thanks, 
 
Mathieu Patte 
Electronic Ground Support Equipment Engineer 
EADS Astrium 
31 rue des Cosmonautes Z.I. du Palays
31402 Toulouse Cedex 4 France 
Phone : +33562199032 
Mail : [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  
 


Ce courriel (incluant ses eventuelles pieces jointes) peut contenir des 
informations confidentielles et/ou protegees ou dont la diffusion est 
restreinte. Si vous avez recu ce courriel par erreur, vous ne devez ni le 
copier, ni l'utiliser, ni en divulguer le contenu a quiconque. Merci d'en 
avertir immediatement l'expediteur et d'effacer ce courriel de votre systeme. 
Astrium decline toute responsabilite en cas de corruption par virus, 
d'alteration ou de falsification de ce courriel lors de sa transmission par 
voie electronique.

This email (including any attachments) may contain confidential and/or 
privileged information or information otherwise protected from disclosure. If 
you are not the intended recipient, please notify the sender immediately, do 
not copy this message or any attachments and do not use it for any purpose or 
disclose its content to any person, but delete this message and any attachments 
from your system. Astrium disclaims any and all liability if this email 
transmission was virus corrupted, altered or falsified.
-
Astrium SAS (393 341 516 RCS Paris) - Siege social: 6 rue Laurent Pichat, 75016 
Paris, France--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] [PATCH] sound support for qemu and xen

2008-04-22 Thread Cole Robinson
Jerone Young wrote:
 I was actually thinking about doing this very patch :-) . Are you going
 to also enable virt-manager to make use of it ? Since it's just good old
 qemu it will be great for local KVM use.


Yeah, I'll probably start adding support for this in virt-install and
virt-manager once this is committed.
 
 Though it would be really nice if pulse audio support to where added to
 qemu. Then someway expose options also through libvirt on which audio
 subsystem to use (oss, alsa, or pulseaudio). Then with pulse audio you
 do have the ability to transport it over the net (though never tried it
 or set it up yet), to work with remote clients.
 

Sounds a little elaborate :) But hey, anythings a possibility as long
as someone is willing to do the work.

- Cole

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


Re: [Libvir] Adding devices to a vm using virsh

2008-04-22 Thread Andrew Cathrow



On Mon, 2008-04-21 at 10:59 +0100, Richard W.M. Jones wrote:


 Unfortunately I'm pretty sure we don't support adding arbitrary
 devices (ie. PCI pass-thru).

Rich,

is this on our roadmap?
If not do I need to BZ this?


Aic

 
 You should be able to do this by starting the domain using an ordinary
 Xen configuration file.
 
 Rich.
 
--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [Libvir] Extra options to dnsmasq

2008-04-22 Thread Mads Chr. Olesen
tir, 22 04 2008 kl. 17:50 +0200, skrev PATTE, Mathieu:
 Is there any way I can pass extra options to dnsmasq when starting a
 virtual network? I need that in order to specify static dhcp leases.
 (is there another way to do that?)

Actually, I wrote a patch for doing static hosts some time ago, but I
haven't had the time to clean it up properly.
It should apply cleanly to 0.4.0, but it shouldn't be hard to adopt to
CVS head.

In XML it works by specifying a stanza such as:
  ip address=192.168.122.1 netmask=255.255.255.0
dhcp
  range start=192.168.122.4 end=192.168.122.254 /
  statichost mac=00:16:3E:XX:XX:XX host=XXX
ip=192.168.122.2 /
  statichost host=YYY ip=192.168.122.3 /
/dhcp
  /ip

The patch is attached, please let me know if you have any questions :-)

-- 
Mads Chr. Olesen [EMAIL PROTECTED]
shiyee.dk
Index: libvirt-0.4.0/src/qemu_conf.c
===
--- libvirt-0.4.0.orig/src/qemu_conf.c	2008-02-14 19:36:51.0 +0100
+++ libvirt-0.4.0/src/qemu_conf.c	2008-02-14 21:40:37.0 +0100
@@ -2120,6 +2120,12 @@
 free(range);
 range = next;
 }
+struct qemud_dhcp_statichost_def *statichost = def-statichosts;
+while (statichost) {
+struct qemud_dhcp_statichost_def *next = statichost-next;
+free(statichost);
+statichost = next;
+}
 free(def);
 }
 
@@ -2172,40 +2178,83 @@
 cur = node-children;
 while (cur != NULL) {
 struct qemud_dhcp_range_def *range;
-xmlChar *start, *end;
+struct qemud_dhcp_statichost_def *statichost;
+xmlChar *start, *end, *mac, *host, *staticip;
 
-if (cur-type != XML_ELEMENT_NODE ||
-!xmlStrEqual(cur-name, BAD_CAST range)) {
+if (cur-type != XML_ELEMENT_NODE) {
 cur = cur-next;
 continue;
 }
 
-if (!(range = calloc(1, sizeof(*range {
-qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, range);
-return 0;
-}
+if (xmlStrEqual(cur-name, BAD_CAST range)) {
+if (!(range = calloc(1, sizeof(*range {
+qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, range);
+return 0;
+}
 
-start = xmlGetProp(cur, BAD_CAST start);
-end = xmlGetProp(cur, BAD_CAST end);
+start = xmlGetProp(cur, BAD_CAST start);
+end = xmlGetProp(cur, BAD_CAST end);
 
-if (start  start[0]  end  end[0]) {
-strncpy(range-start, (const char *)start, BR_INET_ADDR_MAXLEN-1);
-range-start[BR_INET_ADDR_MAXLEN-1] = '\0';
-
-strncpy(range-end, (const char *)end, BR_INET_ADDR_MAXLEN-1);
-range-end[BR_INET_ADDR_MAXLEN-1] = '\0';
-
-range-next = def-ranges;
-def-ranges = range;
-def-nranges++;
-} else {
-free(range);
-}
+if (start  start[0]  end  end[0]) {
+strncpy(range-start, (const char *)start, BR_INET_ADDR_MAXLEN-1);
+range-start[BR_INET_ADDR_MAXLEN-1] = '\0';
+
+strncpy(range-end, (const char *)end, BR_INET_ADDR_MAXLEN-1);
+range-end[BR_INET_ADDR_MAXLEN-1] = '\0';
+
+range-next = def-ranges;
+def-ranges = range;
+def-nranges++;
+} else {
+free(range);
+}
+
+if (start)
+xmlFree(start);
+if (end)
+xmlFree(end);
+}
+else if (xmlStrEqual(cur-name, BAD_CAST statichost)) {
+if (!(statichost = calloc(1, sizeof(*statichost {
+qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, statichost);
+return 0;
+}
+
+mac = xmlGetProp(cur, BAD_CAST mac);
+host = xmlGetProp(cur, BAD_CAST host);
+staticip = xmlGetProp(cur, BAD_CAST ip);
+
+if (((mac  mac[0]) || (host  host[0]))  staticip  staticip[0]) {
+if (mac  mac[0]) {
+strncpy(statichost-mac, (const char *)mac, 18-1);
+statichost-mac[18-1] = '\0';
+} else {
+statichost-mac[0] = '\0';
+}
+if (host  host[0]) {
+strncpy(statichost-host, (const char *)host, QEMUD_MAX_NAME_LEN-1);
+statichost-host[QEMUD_MAX_NAME_LEN-1] = '\0';
+} else {
+statichost-host[0] = '\0';
+}
+
+strncpy(statichost-staticip, (const char *)staticip, BR_INET_ADDR_MAXLEN-1);
+statichost-staticip[BR_INET_ADDR_MAXLEN-1] = '\0';
+
+statichost-next = def-statichosts;
+def-statichosts = statichost;
+def-nstatichosts++;
+} else {
+free(statichost);
+}
 
-