[libvirt] what is the net model syntax

2008-06-05 Thread Farkas Levente

hi,
how can i define the emulated network card model in libvirt's xml config 
files? i can't find it in the docs.

thanks.

--
  Levente   Si vis pacem para bellum!

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


Re: [libvirt] Re: [Libvir] Reopening the old discussion about virDomainBlockPeek

2008-06-05 Thread Daniel Veillard
On Wed, Jun 04, 2008 at 04:10:32PM +0100, Richard W.M. Jones wrote:
 Attached is an updated patch.  The changes are:
 
  - updated to latest CVS
  - run make check / syntax-check
  - remove virsh subcommand (as per Dan's suggestion - see below)
  - some more things that Dan pointed out - see below
 
 I would like to add this to CVS because it is quite a pain tracking
 CVS changes.  I know there's no remote support at the moment, but I
 can add that later.
[...]
 +int virDomainBlockPeek (virDomainPtr dom,
 +const char *path,
 +unsigned long long offset,
 +size_t size,
 +void *buffer);

  hum, we should add a flags extra data. And based on some IRC discussion
you already have an use for this.

  The API feels a bit dangerous to me, because this is a completely
unstructured API, you just get data, you have a priori no way to analyze
what it returns. But I understand why you need it and I don't see a workaround.
So I'm fine with this, it's a bit of a trick, it probably won't work 
in all cases, but it's still read only and allow to do some analysis,
so that's okay.
  Once you have commited the revised version of the API it woudl be nice
to not wait too much for the remote support if possible.

 Index: tests/sexpr2xmldata/sexpr2xml-curmem.xml
 ===
 RCS file: /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-curmem.xml,v
 retrieving revision 1.6
 diff -b -u -p -r1.6 sexpr2xml-curmem.xml
 --- tests/sexpr2xmldata/sexpr2xml-curmem.xml  8 May 2008 14:41:56 -   
 1.6
 +++ tests/sexpr2xmldata/sexpr2xml-curmem.xml  4 Jun 2008 15:08:24 -
 @@ -15,17 +15,17 @@
on_rebootrestart/on_reboot
on_crashrestart/on_crash
devices
 +disk type='file' device='disk'
 +  driver name='tap' type='aio'/
 +  source file='/xen/rhel5.img'/
 +  target dev='xvda' bus='xen'/
 +/disk
  interface type='bridge'
source bridge='xenbr0'/
target dev='vif5.0'/
mac address='00:16:3e:1d:06:15'/
script path='vif-bridge'/
  /interface
 -disk type='file' device='disk'
 -  driver name='tap' type='aio'/
 -  source file='/xen/rhel5.img'/
 -  target dev='xvda' bus='xen'/
 -/disk
  input type='mouse' bus='xen'/
  graphics type='vnc' port='-1'/
  console type='pty'
 Index: tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml
 ===
 RCS file: 
 /data/cvs/libvirt/tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml,v
 retrieving revision 1.10
 diff -b -u -p -r1.10 sexpr2xml-no-source-cdrom.xml
 --- tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml 8 May 2008 14:41:56 
 -   1.10
 +++ tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml 4 Jun 2008 15:08:25 
 -
 @@ -20,11 +20,6 @@
clock offset='utc'/
devices
  emulator/usr/lib/xen/bin/qemu-dm/emulator
 -interface type='bridge'
 -  source bridge='xenbr0'/
 -  target dev='vif6.0'/
 -  mac address='00:16:3e:0a:7b:39'/
 -/interface
  disk type='block' device='disk'
driver name='phy'/
source dev='/dev/sda8'/
 @@ -34,6 +29,11 @@
target dev='hdc' bus='ide'/
readonly/
  /disk
 +interface type='bridge'
 +  source bridge='xenbr0'/
 +  target dev='vif6.0'/
 +  mac address='00:16:3e:0a:7b:39'/
 +/interface
  input type='mouse' bus='ps2'/
  graphics type='vnc' port='-1'/
  serial type='pty'


  I don't understand why those 2 are changed in this patch.

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] Re: [Libvir] Reopening the old discussion about virDomainBlockPeek

2008-06-05 Thread Richard W.M. Jones
On Thu, Jun 05, 2008 at 08:38:15AM -0400, Daniel Veillard wrote:
   hum, we should add a flags extra data. And based on some IRC discussion
 you already have an use for this.

Thanks - I really need this so I'll commit it, with an extra (unused)
flags parameter.

   Once you have commited the revised version of the API it woudl be nice
 to not wait too much for the remote support if possible.

Sure.

   I don't understand why those 2 are changed in this patch.

The code changes the order in which disks  network interfaces are
processed, in the Xen code that turns sexprs into XML.  The disks are
now always listed first, whereas before disks and networks were listed
in whatever order they happened to appear in the sexpr.

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


[libvirt] [PATCH] Fix UUIDString for python bindings

2008-06-05 Thread Cole Robinson
The attached patch fixes a few issues in the python bindings.

First, UUIDString has, to my understanding, never worked. It expected
to be passed a buffer to fill with the uuid, which through my tests
isn't realistically doable from python. I added custom bindings to
fix this, and it now works as expected, taking no arguments and
returning a string.

UUID for a storage pool wasn't being generated with its custom function,
so it too was broken. This is also fixed.

I also removed some stale entries for virStorageVol UUID functions
from generator.py which were probably just carried along from an old
version of the storage api patches (storage volumes don't use UUID).

Thanks,
Cole
diff --git a/python/generator.py b/python/generator.py
index 68a7203..1514c02 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -291,8 +291,10 @@ skip_impl = (
 'virDomainGetInfo',
 'virNodeGetInfo',
 'virDomainGetUUID',
+'virDomainGetUUIDString',
 'virDomainLookupByUUID',
 'virNetworkGetUUID',
+'virNetworkGetUUIDString',
 'virNetworkLookupByUUID',
 'virDomainGetAutostart',
 'virNetworkGetAutostart',
@@ -305,9 +307,8 @@ skip_impl = (
 'virDomainGetVcpus',
 'virDomainPinVcpu',
 'virStoragePoolGetUUID',
+'virStoragePoolGetUUIDString',
 'virStoragePoolLookupByUUID',
-'virStorageVolGetUUID',
-'virStorageVolLookupByUUID',
 'virStoragePoolGetInfo',
 'virStorageVolGetInfo',
 'virStoragePoolGetAutostart',
diff --git a/python/libvir.c b/python/libvir.c
index 8258cc2..9cc0c81 100644
--- a/python/libvir.c
+++ b/python/libvir.c
@@ -864,6 +864,33 @@ libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, 
PyObject *args) {
 }
 
 static PyObject *
+libvirt_virDomainGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
+   PyObject *args) {
+PyObject *py_retval;
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+virDomainPtr dom;
+PyObject *pyobj_dom;
+int c_retval;
+
+if (!PyArg_ParseTuple(args, (char *)O:virDomainGetUUIDString,
+  pyobj_dom))
+return(NULL);
+dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom);
+
+if (dom == NULL)
+return VIR_PY_NONE;
+LIBVIRT_BEGIN_ALLOW_THREADS;
+c_retval = virDomainGetUUIDString(dom, uuidstr[0]);
+LIBVIRT_END_ALLOW_THREADS;
+
+if (c_retval  0)
+return VIR_PY_NONE;
+
+py_retval = PyString_FromString((char *) uuidstr[0]);
+return(py_retval);
+}
+
+static PyObject *
 libvirt_virDomainLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) 
{
 PyObject *py_retval;
 virDomainPtr c_retval;
@@ -997,6 +1024,33 @@ libvirt_virNetworkGetUUID(PyObject *self 
ATTRIBUTE_UNUSED, PyObject *args) {
 }
 
 static PyObject *
+libvirt_virNetworkGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
+PyObject *args) {
+PyObject *py_retval;
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+virNetworkPtr net;
+PyObject *pyobj_net;
+int c_retval;
+
+if (!PyArg_ParseTuple(args, (char *)O:virNetworkGetUUIDString,
+  pyobj_net))
+return(NULL);
+net = (virNetworkPtr) PyvirNetwork_Get(pyobj_net);
+
+if (net == NULL)
+return VIR_PY_NONE;
+LIBVIRT_BEGIN_ALLOW_THREADS;
+c_retval = virNetworkGetUUIDString(net, uuidstr[0]);
+LIBVIRT_END_ALLOW_THREADS;
+
+if (c_retval  0)
+return VIR_PY_NONE;
+
+py_retval = PyString_FromString((char *) uuidstr[0]);
+return(py_retval);
+}
+
+static PyObject *
 libvirt_virNetworkLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject 
*args) {
 PyObject *py_retval;
 virNetworkPtr c_retval;
@@ -1363,6 +1417,31 @@ libvirt_virStoragePoolGetUUID(PyObject *self 
ATTRIBUTE_UNUSED, PyObject *args) {
 return(py_retval);
 }
 
+static PyObject *
+libvirt_virStoragePoolGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
+PyObject *args) {
+PyObject *py_retval;
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+virStoragePoolPtr pool;
+PyObject *pyobj_pool;
+int c_retval;
+
+if (!PyArg_ParseTuple(args, (char *)O:virStoragePoolGetUUIDString, 
pyobj_pool))
+return(NULL);
+pool = (virStoragePoolPtr) PyvirStoragePool_Get(pyobj_pool);
+
+if (pool == NULL)
+return VIR_PY_NONE;
+LIBVIRT_BEGIN_ALLOW_THREADS;
+c_retval = virStoragePoolGetUUIDString(pool, uuidstr[0]);
+LIBVIRT_END_ALLOW_THREADS;
+
+if (c_retval  0)
+return VIR_PY_NONE;
+
+py_retval = PyString_FromString((char *) uuidstr[0]);
+return(py_retval);
+}
 
 static PyObject *
 libvirt_virStoragePoolLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject 
*args) {
@@ -1403,6 +1482,7 @@ static PyMethodDef libvirtMethods[] = {
 {(char *) virDomainGetInfo, libvirt_virDomainGetInfo, METH_VARARGS, 
NULL},
 {(char *) virNodeGetInfo, libvirt_virNodeGetInfo, METH_VARARGS, NULL},
 {(char *) virDomainGetUUID, libvirt_virDomainGetUUID, 

[libvirt] [PATCH] QEMU remote support for virDomainBlockPeek

2008-06-05 Thread Richard W.M. Jones

This patch adds support for virDomainBlockPeek over remote.

Also adds a QEMU driver implementation.

Also there is a minor fix in the Xen driver impl.

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
? scripts/Makefile
? scripts/Makefile.in
Index: qemud/remote.c
===
RCS file: /data/cvs/libvirt/qemud/remote.c,v
retrieving revision 1.35
diff -u -r1.35 remote.c
--- qemud/remote.c  23 May 2008 08:24:44 -  1.35
+++ qemud/remote.c  5 Jun 2008 18:43:10 -
@@ -890,6 +890,54 @@
 }
 
 static int
+remoteDispatchDomainBlockPeek (struct qemud_server *server ATTRIBUTE_UNUSED,
+   struct qemud_client *client,
+   remote_message_header *req,
+   remote_domain_block_peek_args *args,
+   remote_domain_block_peek_ret *ret)
+{
+virDomainPtr dom;
+char *path;
+unsigned long long offset;
+size_t size;
+unsigned int flags;
+CHECK_CONN (client);
+
+dom = get_nonnull_domain (client-conn, args-dom);
+if (dom == NULL) {
+remoteDispatchError (client, req, %s, _(domain not found));
+return -2;
+}
+path = args-path;
+offset = args-offset;
+size = args-size;
+flags = args-flags;
+
+if (size  REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX) {
+remoteDispatchError (client, req,
+ %s, _(size  maximum buffer size));
+return -2;
+}
+
+ret-buffer.buffer_len = size;
+ret-buffer.buffer_val = malloc (size);
+if (!ret-buffer.buffer_val) {
+remoteDispatchError (client, req, %s, strerror (errno));
+return -2;
+}
+
+if (virDomainBlockPeek (dom, path, offset, size,
+ret-buffer.buffer_val, flags) == -1) {
+/* free (ret-buffer.buffer_val); - caller frees */
+virDomainFree (dom);
+return -1;
+}
+virDomainFree (dom);
+
+return 0;
+}
+
+static int
 remoteDispatchDomainAttachDevice (struct qemud_server *server ATTRIBUTE_UNUSED,
   struct qemud_client *client,
   remote_message_header *req,
Index: qemud/remote_protocol.x
===
RCS file: /data/cvs/libvirt/qemud/remote_protocol.x,v
retrieving revision 1.13
diff -u -r1.13 remote_protocol.x
--- qemud/remote_protocol.x 23 May 2008 08:24:44 -  1.13
+++ qemud/remote_protocol.x 5 Jun 2008 18:43:11 -
@@ -96,6 +96,12 @@
 /* Maximum number of auth types */
 const REMOTE_AUTH_TYPE_LIST_MAX = 20;
 
+/* Maximum length of a block or memory peek buffer message.
+ * Note applications need to be aware of this limit and issue multiple
+ * requests for large amounts of data.
+ */
+const REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX = 65536;
+
 /* UUID.  VIR_UUID_BUFLEN definition comes from libvirt.h */
 typedef opaque remote_uuid[VIR_UUID_BUFLEN];
 
@@ -322,6 +328,18 @@
 hyper tx_drop;
 };
 
+struct remote_domain_block_peek_args {
+remote_nonnull_domain dom;
+remote_nonnull_string path;
+unsigned hyper offset;
+unsigned size;
+unsigned flags;
+};
+
+struct remote_domain_block_peek_ret {
+opaque bufferREMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX;
+};
+
 struct remote_list_domains_args {
 int maxids;
 };
@@ -1036,7 +1054,9 @@
 REMOTE_PROC_STORAGE_VOL_GET_PATH = 100,
 
 REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY = 101,
-REMOTE_PROC_NODE_GET_FREE_MEMORY = 102
+REMOTE_PROC_NODE_GET_FREE_MEMORY = 102,
+
+REMOTE_PROC_DOMAIN_BLOCK_PEEK = 103
 };
 
 /* Custom RPC structure. */
Index: src/driver.h
===
RCS file: /data/cvs/libvirt/src/driver.h,v
retrieving revision 1.48
diff -u -r1.48 driver.h
--- src/driver.h5 Jun 2008 13:17:45 -   1.48
+++ src/driver.h5 Jun 2008 18:43:11 -
@@ -230,7 +230,8 @@
 (virDomainPtr domain,
  const char *path,
  unsigned long long offset, size_t size,
- void *buffer);
+ void *buffer,
+ unsigned int flags);
 
 typedef int
 (*virDrvDomainMigratePrepare)
Index: src/libvirt.c
===
RCS file: /data/cvs/libvirt/src/libvirt.c,v
retrieving revision 1.144
diff -u -r1.144 libvirt.c
--- src/libvirt.c   5 Jun 2008 13:17:45 -   1.144
+++ src/libvirt.c   5 Jun 2008 18:43:14 -
@@ -2659,7 +2659,8 @@
 }
 
 if (conn-driver-domainBlockPeek)
-return conn-driver-domainBlockPeek (dom, path, offset, size, buffer);
+return 

Re: [libvirt] [PATCH] Fix UUIDString for python bindings

2008-06-05 Thread Richard W.M. Jones
On Thu, Jun 05, 2008 at 02:08:41PM -0400, Cole Robinson wrote:
 The attached patch fixes a few issues in the python bindings.

+1, looks good to me.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/

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



Re: [libvirt] [PATCH] QEMU remote support for virDomainBlockPeek

2008-06-05 Thread Richard W.M. Jones
On Thu, Jun 05, 2008 at 07:42:10PM +0100, Richard W.M. Jones wrote:
 This patch adds support for virDomainBlockPeek over remote.
 Also adds a QEMU driver implementation.
 Also there is a minor fix in the Xen driver impl.

The latest virt-df has been updated to use this call, with the remote
 QEMU support, so I'm confident this is at least somewhat working.  A
trace of virt-df running with LIBVIRT_DEBUG=1 is below.

Rich.

--
$ LIBVIRT_DEBUG=1 ./virt-df/virt-df.opt -a -h
DEBUG: libvirt.c: virInitialize (register drivers)
DEBUG: libvirt.c: virConnectOpenReadOnly (name=(null))
DEBUG: libvirt.c: do_open (Probed qemu:///session)
DEBUG: libvirt.c: do_open (Using qemu:///session as default URI, 1 hypervisor 
found)
DEBUG: libvirt.c: do_open (name qemu:///session to URI components:
  scheme qemu
  opaque (null)
  authority (null)
  server (null)
  user (null)
  port 0
  path /session
)
DEBUG: libvirt.c: do_open (trying driver 0 (Test) ...)
DEBUG: libvirt.c: do_open (driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 1 (QEMU) ...)
DEBUG: libvirt.c: do_open (driver 1 QEMU returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 2 (Xen) ...)
DEBUG: libvirt.c: do_open (driver 2 Xen returned DECLINED)
DEBUG: libvirt.c: do_open (trying driver 3 (remote) ...)
DEBUG: remote_internal.c: doRemoteOpen (proceeding with name = qemu:///session)
DEBUG: libvirt.c: do_open (driver 3 remote returned SUCCESS)
DEBUG: libvirt.c: do_open (network driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (network driver 1 QEMU returned DECLINED)
DEBUG: libvirt.c: do_open (network driver 2 remote returned SUCCESS)
DEBUG: libvirt.c: do_open (storage driver 0 Test returned DECLINED)
DEBUG: libvirt.c: do_open (storage driver 1 remote returned SUCCESS)
DEBUG: libvirt.c: virConnectNumOfDomains (conn=0x6d69e0)
DEBUG: libvirt.c: virConnectListDomains (conn=0x6d69e0, ids=0x7fff3eb3fd50, 
maxids=0)
DEBUG: libvirt.c: virConnectNumOfDefinedDomains (conn=0x6d69e0)
DEBUG: libvirt.c: virConnectListDefinedDomains (conn=0x6d69e0, 
names=0x7fff3eb3fd30, maxnames=1)
DEBUG: libvirt.c: virDomainLookupByName (conn=0x6d69e0, name=rhel51x32kvm)
DEBUG: hash.c: __virGetDomain (New hash entry 0x6d7dc0)
DEBUG: libvirt.c: virDomainGetXMLDesc (domain=0x6d7dc0, flags=0)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=0, size=0, buffer=0x683290)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=0, size=512, 
buffer=0x2ad87230)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=33280, size=1024, 
buffer=0x2ad84320)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=106929664, size=1024, 
buffer=0x2ad7f9a0)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=106928640, size=4096, 
buffer=0x2ae24f80)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=106928640, size=4096, 
buffer=0x2ae23f70)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=106928640, size=512, 
buffer=0x2ad7db98)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=106928640, size=512, 
buffer=0x2ad7d808)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=106928640, size=4608, 
buffer=0x2ae22d60)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=106928640, size=4608, 
buffer=0x2ae21b50)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=106935296, size=1114, 
buffer=0x2ad7bf98)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=107126272, size=1024, 
buffer=0x2ad714d8)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=7321329152, size=1024, 
buffer=0x2ad6c240)
DEBUG: libvirt.c: virDomainBlockPeek (domain=0x6d7dc0, 
path=/var/lib/xen/images/rhel51x32kvm.img, offset=7321328128, size=4096, 
buffer=0x2ae143e0)
Filesystem Size   Used  Available Type
rhel51x32kvm:hda1  96.8 MiB   14.6 MiB   82.2 MiB Linux ext2/3
rhel51x32kvm:VolGroup00/LogVol006.4 GiB3.6 GiB2.8 GiB Linux ext2/3
rhel51x32kvm:VolGroup00/LogVol01  992.0 MiB   Linux swap
--

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual 

Re: [libvirt] [PATCH] QEMU remote support for virDomainBlockPeek

2008-06-05 Thread Richard W.M. Jones
On Thu, Jun 05, 2008 at 04:32:41PM -0400, Daniel Veillard wrote:
 On Thu, Jun 05, 2008 at 08:45:40PM +0100, Richard W.M. Jones wrote:
  On Thu, Jun 05, 2008 at 07:42:10PM +0100, Richard W.M. Jones wrote:
   This patch adds support for virDomainBlockPeek over remote.
   Also adds a QEMU driver implementation.
   Also there is a minor fix in the Xen driver impl.
  
  The latest virt-df has been updated to use this call, with the remote
   QEMU support, so I'm confident this is at least somewhat working.  A
  trace of virt-df running with LIBVIRT_DEBUG=1 is below.
 
   okay, go for it, push !
 
thanks !

Committed.

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


[libvirt] [PATCH] virDomainMemoryPeek - peek into guest memory

2008-06-05 Thread Richard W.M. Jones

This patch implements virDomainMemoryPeek, which allows callers to
peek into guest (virtual) memory.

Currently the patch contains a QEMU driver and remote support.
There's also a big comment in the source describing how to do Xen.

Obviously the use case for this is virt-mem:
http://et.redhat.com/~rjones/virt-mem/

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: docs/hvsupport.html.in
===
RCS file: /data/cvs/libvirt/docs/hvsupport.html.in,v
retrieving revision 1.2
diff -u -p -r1.2 hvsupport.html.in
--- docs/hvsupport.html.in  5 Jun 2008 13:17:45 -   1.2
+++ docs/hvsupport.html.in  5 Jun 2008 21:26:24 -
@@ -145,9 +145,9 @@ updated on i2008-06-05/i.
   tr
 td virDomainBlockPeek /td
 td 0.4.3 /td
-td x /td
-td x /td
-td x /td
+td 0.4.3 /td
+td 0.4.3 /td
+td 0.4.3 /td
 td x /td
   /tr
   tr
@@ -487,6 +487,14 @@ updated on i2008-06-05/i.
 td colspan=4 not a HV function /td
   /tr
   tr
+td virDomainMemoryPeek /td
+td 0.4.3 /td
+td x /td
+td 0.4.3 /td
+td 0.4.3 /td
+td x /td
+  /tr
+  tr
 td virNodeGetInfo /td
 td 0.1.0 /td
 td #x2265; 0.1.0 /td
Index: include/libvirt/libvirt.h
===
RCS file: /data/cvs/libvirt/include/libvirt/libvirt.h,v
retrieving revision 1.75
diff -u -p -r1.75 libvirt.h
--- include/libvirt/libvirt.h   5 Jun 2008 13:17:45 -   1.75
+++ include/libvirt/libvirt.h   5 Jun 2008 21:26:25 -
@@ -537,6 +537,17 @@ int virDomainBlockPe
 void *buffer,
 unsigned int flags);
 
+/* Memory peeking flags. */
+typedef enum {
+  VIR_MEMORY_VIRTUAL  = 1, /* addresses are virtual addresses */
+} virDomainMemoryFlags;
+
+int virDomainMemoryPeek (virDomainPtr dom,
+ unsigned long long start,
+ size_t size,
+ void *buffer,
+ unsigned int flags);
+
 /*
  * defined but not running domains
  */
Index: include/libvirt/libvirt.h.in
===
RCS file: /data/cvs/libvirt/include/libvirt/libvirt.h.in,v
retrieving revision 1.50
diff -u -p -r1.50 libvirt.h.in
--- include/libvirt/libvirt.h.in5 Jun 2008 13:17:45 -   1.50
+++ include/libvirt/libvirt.h.in5 Jun 2008 21:26:26 -
@@ -537,6 +537,17 @@ int virDomainBlockPe
 void *buffer,
 unsigned int flags);
 
+/* Memory peeking flags. */
+typedef enum {
+  VIR_MEMORY_VIRTUAL  = 1, /* addresses are virtual addresses */
+} virDomainMemoryFlags;
+
+int virDomainMemoryPeek (virDomainPtr dom,
+ unsigned long long start,
+ size_t size,
+ void *buffer,
+ unsigned int flags);
+
 /*
  * defined but not running domains
  */
Index: qemud/remote.c
===
RCS file: /data/cvs/libvirt/qemud/remote.c,v
retrieving revision 1.36
diff -u -p -r1.36 remote.c
--- qemud/remote.c  5 Jun 2008 21:12:26 -   1.36
+++ qemud/remote.c  5 Jun 2008 21:26:29 -
@@ -938,6 +938,52 @@ remoteDispatchDomainBlockPeek (struct qe
 }
 
 static int
+remoteDispatchDomainMemoryPeek (struct qemud_server *server ATTRIBUTE_UNUSED,
+struct qemud_client *client,
+remote_message_header *req,
+remote_domain_memory_peek_args *args,
+remote_domain_memory_peek_ret *ret)
+{
+virDomainPtr dom;
+unsigned long long offset;
+size_t size;
+unsigned int flags;
+CHECK_CONN (client);
+
+dom = get_nonnull_domain (client-conn, args-dom);
+if (dom == NULL) {
+remoteDispatchError (client, req, %s, _(domain not found));
+return -2;
+}
+offset = args-offset;
+size = args-size;
+flags = args-flags;
+
+if (size  REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX) {
+remoteDispatchError (client, req,
+ %s, _(size  maximum buffer size));
+return -2;
+}
+
+ret-buffer.buffer_len 

[libvirt] qemudDomainSetMemory() / qemudDomainSetVcpus() error codes

2008-06-05 Thread Kaitlin Rupert

Hello,

I noticed qemudDomainSetMemory() / qemudDomainSetVcpus() use the 
VIR_ERR_INTERNAL_ERROR error code when the caller attempts to set the 
mem/vcpus of an active domain.


In this case, returning something like VIR_ERR_NO_SUPPORT would indicate 
that this is an invalid call - which would distinguish the error from a 
failure that occurred during the call.


Is it possible to use such a return code to indicate what is supported 
by QEMU/KVM and what isn't?


Thanks!
--
Kaitlin Rupert
IBM Linux Technology Center
[EMAIL PROTECTED]

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


** PLEASE REVIEW THIS PATCH INSTEAD ** (was: Re: [libvirt] [PATCH] virDomainMemoryPeek - peek into guest memory)

2008-06-05 Thread Richard W.M. Jones

This patch removes a file descriptor leak.  I've now tested this patch
with virt-mem and it appears to work.

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/hvsupport.html.in
===
RCS file: /data/cvs/libvirt/docs/hvsupport.html.in,v
retrieving revision 1.2
diff -u -p -r1.2 hvsupport.html.in
--- docs/hvsupport.html.in  5 Jun 2008 13:17:45 -   1.2
+++ docs/hvsupport.html.in  5 Jun 2008 23:05:32 -
@@ -145,9 +145,9 @@ updated on i2008-06-05/i.
   tr
 td virDomainBlockPeek /td
 td 0.4.3 /td
-td x /td
-td x /td
-td x /td
+td 0.4.3 /td
+td 0.4.3 /td
+td 0.4.3 /td
 td x /td
   /tr
   tr
@@ -487,6 +487,14 @@ updated on i2008-06-05/i.
 td colspan=4 not a HV function /td
   /tr
   tr
+td virDomainMemoryPeek /td
+td 0.4.3 /td
+td x /td
+td 0.4.3 /td
+td 0.4.3 /td
+td x /td
+  /tr
+  tr
 td virNodeGetInfo /td
 td 0.1.0 /td
 td #x2265; 0.1.0 /td
Index: include/libvirt/libvirt.h
===
RCS file: /data/cvs/libvirt/include/libvirt/libvirt.h,v
retrieving revision 1.75
diff -u -p -r1.75 libvirt.h
--- include/libvirt/libvirt.h   5 Jun 2008 13:17:45 -   1.75
+++ include/libvirt/libvirt.h   5 Jun 2008 23:05:33 -
@@ -537,6 +537,17 @@ int virDomainBlockPe
 void *buffer,
 unsigned int flags);
 
+/* Memory peeking flags. */
+typedef enum {
+  VIR_MEMORY_VIRTUAL  = 1, /* addresses are virtual addresses */
+} virDomainMemoryFlags;
+
+int virDomainMemoryPeek (virDomainPtr dom,
+ unsigned long long start,
+ size_t size,
+ void *buffer,
+ unsigned int flags);
+
 /*
  * defined but not running domains
  */
Index: include/libvirt/libvirt.h.in
===
RCS file: /data/cvs/libvirt/include/libvirt/libvirt.h.in,v
retrieving revision 1.50
diff -u -p -r1.50 libvirt.h.in
--- include/libvirt/libvirt.h.in5 Jun 2008 13:17:45 -   1.50
+++ include/libvirt/libvirt.h.in5 Jun 2008 23:05:34 -
@@ -537,6 +537,17 @@ int virDomainBlockPe
 void *buffer,
 unsigned int flags);
 
+/* Memory peeking flags. */
+typedef enum {
+  VIR_MEMORY_VIRTUAL  = 1, /* addresses are virtual addresses */
+} virDomainMemoryFlags;
+
+int virDomainMemoryPeek (virDomainPtr dom,
+ unsigned long long start,
+ size_t size,
+ void *buffer,
+ unsigned int flags);
+
 /*
  * defined but not running domains
  */
Index: qemud/remote.c
===
RCS file: /data/cvs/libvirt/qemud/remote.c,v
retrieving revision 1.36
diff -u -p -r1.36 remote.c
--- qemud/remote.c  5 Jun 2008 21:12:26 -   1.36
+++ qemud/remote.c  5 Jun 2008 23:05:36 -
@@ -938,6 +938,52 @@ remoteDispatchDomainBlockPeek (struct qe
 }
 
 static int
+remoteDispatchDomainMemoryPeek (struct qemud_server *server ATTRIBUTE_UNUSED,
+struct qemud_client *client,
+remote_message_header *req,
+remote_domain_memory_peek_args *args,
+remote_domain_memory_peek_ret *ret)
+{
+virDomainPtr dom;
+unsigned long long offset;
+size_t size;
+unsigned int flags;
+CHECK_CONN (client);
+
+dom = get_nonnull_domain (client-conn, args-dom);
+if (dom == NULL) {
+remoteDispatchError (client, req, %s, _(domain not found));
+return -2;
+}
+offset = args-offset;
+size = args-size;
+flags = args-flags;
+
+if (size  REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX) {
+remoteDispatchError (client, req,
+ %s, _(size  maximum buffer size));
+return -2;
+}
+
+ret-buffer.buffer_len = size;
+ret-buffer.buffer_val = malloc (size);
+if (!ret-buffer.buffer_val) {
+remoteDispatchError (client, req, %s, strerror (errno));
+return -2;
+}
+
+if (virDomainMemoryPeek (dom, offset, 

Re: [libvirt] qemudDomainSetMemory() / qemudDomainSetVcpus() error codes

2008-06-05 Thread Atsushi SAKAI
Hi, Kaitlin

I agree your point. and It should use such an error code.

I am looking around the discussion but it is not discussed your point.
https://www.redhat.com/archives/libvir-list/2008-March/msg00160.html

If any policy exists, I also want to know the reason.

Thanks
Atsushi SAKAI



Kaitlin Rupert [EMAIL PROTECTED] wrote:

 Hello,
 
 I noticed qemudDomainSetMemory() / qemudDomainSetVcpus() use the 
 VIR_ERR_INTERNAL_ERROR error code when the caller attempts to set the 
 mem/vcpus of an active domain.
 
 In this case, returning something like VIR_ERR_NO_SUPPORT would indicate 
 that this is an invalid call - which would distinguish the error from a 
 failure that occurred during the call.
 
 Is it possible to use such a return code to indicate what is supported 
 by QEMU/KVM and what isn't?
 
 Thanks!
 -- 
 Kaitlin Rupert
 IBM Linux Technology Center
 [EMAIL PROTECTED]
 
 --
 Libvir-list mailing list
 Libvir-list@redhat.com
 https://www.redhat.com/mailman/listinfo/libvir-list


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