[libvirt] net-info doc for virsh commands references

2010-11-17 Thread Osier Yang
Hi Justin

It's a rough doc, I'm not good at it. :-)
any problem please let me known.

Regards

- Osier


net-info.doc
Description: MS-Word document
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] OpenSource-Management of private Clouds and Virtualisation

2010-11-17 Thread Justin Clift
Taking a look through the site and docs, I didn't see anything related to 
libvirt.

Arno-Can, what does this have to do with the libvirt project?

Kind of seems like spam. :(

Regards,

Justin Clift

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


[libvirt] [PATCH] support sheepdog volumes

2010-11-17 Thread MORITA Kazutaka
Sheepdog is a distributed storage system for QEMU. It provides highly
available block level storage volumes to VMs like Amazon EBS.  This
patch adds support for Sheepdog; we can create VMs with sheepdog
volumes, and attach sheepdog volumes to running machines via the
attach-device command.

Sheepdog volumes can be declared like this:

disk type='sheepdog' device='disk'
  driver name='qemu' type='raw' /
  source vdi='volume_name' host='hostname' port='7000'/
  target dev='vda' bus='virtio' /
/disk

'host' and 'port' in the source element are optional.  If they are not
specified, sheepdog clients use the default value (localhost:7000).

Signed-off-by: MORITA Kazutaka morita.kazut...@lab.ntt.co.jp
---
 docs/schemas/domain.rng |   24 ++
 src/conf/domain_conf.c  |   26 ++-
 src/conf/domain_conf.h  |3 ++
 src/qemu/qemu_conf.c|   63 +-
 4 files changed, 113 insertions(+), 3 deletions(-)

diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index bbbc846..5802993 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -612,6 +612,30 @@
 ref name=diskspec/
   /interleave
 /group
+group
+  attribute name=type
+valuesheepdog/value
+  /attribute
+  interleave
+optional
+  element name=source
+attribute name=vdi
+  ref name=genericName/
+/attribute
+optional
+  attribute name=host
+ref name=genericName/
+  /attribute
+  attribute name=port
+ref name=unsignedInt/
+  /attribute
+/optional
+empty/
+  /element
+/optional
+ref name=diskspec/
+  /interleave
+/group
 ref name=diskspec/
   /choice
 /element
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 30c27db..d0ea0bb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -113,7 +113,8 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, 
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
 VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
   block,
   file,
-  dir)
+  dir,
+  sheepdog)
 
 VIR_ENUM_IMPL(virDomainDiskDevice, VIR_DOMAIN_DISK_DEVICE_LAST,
   disk,
@@ -505,6 +506,8 @@ void virDomainDiskDefFree(virDomainDiskDefPtr def)
 
 VIR_FREE(def-serial);
 VIR_FREE(def-src);
+VIR_FREE(def-host);
+VIR_FREE(def-port);
 VIR_FREE(def-dst);
 VIR_FREE(def-driverName);
 VIR_FREE(def-driverType);
@@ -1517,6 +1520,8 @@ virDomainDiskDefParseXML(virCapsPtr caps,
 char *driverName = NULL;
 char *driverType = NULL;
 char *source = NULL;
+char *host = NULL;
+char *port = NULL;
 char *target = NULL;
 char *bus = NULL;
 char *cachetag = NULL;
@@ -1557,6 +1562,11 @@ virDomainDiskDefParseXML(virCapsPtr caps,
 case VIR_DOMAIN_DISK_TYPE_DIR:
 source = virXMLPropString(cur, dir);
 break;
+case VIR_DOMAIN_DISK_TYPE_SHEEPDOG:
+source = virXMLPropString(cur, vdi);
+host = virXMLPropString(cur, host);
+port = virXMLPropString(cur, port);
+break;
 default:
 virDomainReportError(VIR_ERR_INTERNAL_ERROR,
  _(unexpected disk type %s),
@@ -1726,6 +1736,10 @@ virDomainDiskDefParseXML(virCapsPtr caps,
 
 def-src = source;
 source = NULL;
+def-host = host;
+host = NULL;
+def-port = port;
+port = NULL;
 def-dst = target;
 target = NULL;
 def-driverName = driverName;
@@ -1756,6 +1770,8 @@ cleanup:
 VIR_FREE(type);
 VIR_FREE(target);
 VIR_FREE(source);
+VIR_FREE(host);
+VIR_FREE(port);
 VIR_FREE(device);
 VIR_FREE(driverType);
 VIR_FREE(driverName);
@@ -5831,6 +5847,14 @@ virDomainDiskDefFormat(virBufferPtr buf,
 virBufferEscapeString(buf,   source dir='%s'/\n,
   def-src);
 break;
+case VIR_DOMAIN_DISK_TYPE_SHEEPDOG:
+virBufferEscapeString(buf,   source vdi='%s', def-src);
+if (def-host  def-port) {
+virBufferEscapeString(buf,  host='%s', def-host);
+virBufferEscapeString(buf,  port='%s', def-port);
+}
+virBufferVSprintf(buf, /\n);
+break;
 default:
 virDomainReportError(VIR_ERR_INTERNAL_ERROR,
  _(unexpected disk type %s),
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 7d2d6f5..9c929c4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -120,6 

Re: [libvirt] net-info doc for virsh commands references

2010-11-17 Thread Justin Clift
On 17/11/2010, at 7:42 PM, Osier Yang wrote:
 Hi Justin
 
 It's a rough doc, I'm not good at it. :-)
 any problem please let me known.

Thanks Osier, how's this:

  
http://justinclift.fedorapeople.org/virshcmdref/chap-Virsh_Command_Reference-Command_Listing.html

and:

  http://justinclift.fedorapeople.org/virshcmdref/sect-net-info.html

Changed around the Example in context, so that if flows better. (I think)

Workable?

Regards and best wishes,

Justin Clift

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


[libvirt] [PATCH] docs: added compiling page and significantly expanded windows page

2010-11-17 Thread Justin Clift
Also added an additional menu placement for the windows page, in
order to attract further potential testers.
---
 docs/compiling.html.in |   48 
 docs/downloads.html.in |   41 +
 docs/sitemap.html.in   |   10 +
 docs/windows.html.in   |   95 +---
 4 files changed, 142 insertions(+), 52 deletions(-)
 create mode 100644 docs/compiling.html.in

diff --git a/docs/compiling.html.in b/docs/compiling.html.in
new file mode 100644
index 000..471f52d
--- /dev/null
+++ b/docs/compiling.html.in
@@ -0,0 +1,48 @@
+?xml version=1.0?
+html
+  body
+h1a name=installationlibvirt Installation/a/h1
+
+ul id=toc/ul
+
+h2a name=CompilatioCompiling a release tarball/a/h2
+
+p
+  libvirt uses the standard configure/make/install steps:
+/p
+
+pre
+  gunzip -c libvirt-xxx.tar.gz | tar xvf -
+  cd libvirt-
+  ./configure --help/pre
+
+p
+  To see the options, then the compilation/installation proper:
+/p
+
+pre
+  ./configure [possible options]
+  make
+  make install/pre
+
+p
+  At that point you may have to rerun ldconfig or a similar utility to
+  update your list of installed shared libs.
+/p
+
+h2a name=buildBuilding from a GIT checkout/a/h2
+
+p
+  The libvirt build process uses GNU autotools, so after obtaining a
+  checkout it is necessary to generate the configure script and Makefile.in
+  templates using the codeautogen.sh/code command, passing the extra
+  arguments as for configure. As an example, to do a complete build and
+  install it into your home directory run:
+/p
+
+pre
+  ./autogen.sh --prefix=$HOME/usr --enable-compile-warnings=error
+  make
+  make install/pre
+  /body
+/html
diff --git a/docs/downloads.html.in b/docs/downloads.html.in
index 709bee8..64a16c9 100644
--- a/docs/downloads.html.in
+++ b/docs/downloads.html.in
@@ -91,46 +91,9 @@
 
 br /
 
-h1a name=installationlibvirt Installation/a/h1
-
-h2a name=CompilatioCompiling a release tarball/a/h2
-
-p
-  libvirt uses the standard configure/make/install steps:
-/p
-
-pre
-  gunzip -c libvirt-xxx.tar.gz | tar xvf -
-  cd libvirt-
-  ./configure --help/pre
-
-p
-  To see the options, then the compilation/installation proper:
-/p
-
-pre
-  ./configure [possible options]
-  make
-  make install/pre
-
 p
-  At that point you may have to rerun ldconfig or a similar utility to
-  update your list of installed shared libs.
+  Once you've have obtained the libvirt source code, you can compile it
+  using the a href=compiling.htmlinstructions here/a.
 /p
-
-h2a name=buildBuilding from a GIT checkout/a/h2
-
-p
-  The libvirt build process uses GNU autotools, so after obtaining a
-  checkout it is necessary to generate the configure script and Makefile.in
-  templates using the codeautogen.sh/code command, passing the extra
-  arguments as for configure. As an example, to do a complete build and
-  install it into your home directory run:
-/p
-
-pre
-  ./autogen.sh --prefix=$HOME/usr --enable-compile-warnings=error
-  make
-  make install/pre
   /body
 /html
diff --git a/docs/sitemap.html.in b/docs/sitemap.html.in
index 692da29..bd39e10 100644
--- a/docs/sitemap.html.in
+++ b/docs/sitemap.html.in
@@ -21,12 +21,22 @@
   li
 a href=downloads.htmlDownloads/a
 spanGet the latest source releases, binary builds and get access to 
the source repository/span
+ul
+  li
+a href=windows.htmlWindows/a
+spanDownloads for Windows/span
+  /li
+/ul
   /li
   li
 a href=docs.htmlDocumentation/a
 spanInformation for users, administrators and developers/span
 ul
   li
+a href=compiling.htmlCompiling/a
+spanHow to compile libvirt/span
+  /li
+  li
 a href=deployment.htmlDeployment/a
 spanInformation about deploying and using libvirt/span
 ul
diff --git a/docs/windows.html.in b/docs/windows.html.in
index 8ca6b0d..f973d76 100644
--- a/docs/windows.html.in
+++ b/docs/windows.html.in
@@ -3,20 +3,93 @@
   body
 h1 Windows support/h1
 
+ul id=toc/ul
+
+p
+  Libvirt is known to work as a client (not server) on Windows XP
+  (32-bit), Windows 7 (64-bit), and other Windows variants.
+/p
+
+h2a name=installerExperimental installation package/a/h2
+
+p
+  A windows installation package is in development.  An experimental
+  first version is available here:
+/p
+
+a 
href=http://libvirt.org/sources/win32_experimental/Libvirt-0.8.5-0.exe;http://libvirt.org/sources/win32_experimental/Libvirt-0.8.5-0.exe/a
+
 p
-  Libvirt can be compiled on Windows
-  using the free a 

Re: [libvirt] net-info doc for virsh commands references

2010-11-17 Thread Osier Yang

于 2010年11月17日 18:03, Justin Clift 写道:

On 17/11/2010, at 7:42 PM, Osier Yang wrote:

Hi Justin

It's a rough doc, I'm not good at it. :-)
any problem please let me known.


Thanks Osier, how's this:

   
http://justinclift.fedorapeople.org/virshcmdref/chap-Virsh_Command_Reference-Command_Listing.html

and:

   http://justinclift.fedorapeople.org/virshcmdref/sect-net-info.html

Changed around the Example in context, so that if flows better. (I think)

Workable?


yep, better than I did.. :-)

Regards

- Osier


Regards and best wishes,

Justin Clift


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

Re: [libvirt] [PATCH] docs: added compiling page and significantly expanded windows page

2010-11-17 Thread Matthias Bolte
2010/11/17 Justin Clift jcl...@redhat.com:
 Also added an additional menu placement for the windows page, in
 order to attract further potential testers.
 ---

 +      li
 +        The working connection types at the moment are very limited.  Only
 +        bqemu+tcp:///b is known to work for sure.  Anything using SSH,
 +        such as bqemu+ssh:///b, definitely doesn't work.  Connecting
 +        to ESX servers doesn't yet work either, due to a bug involving
 +        GnuTLS, which should be fixed in the next release.
 +      /li

Don't blame GnuTLS here. As stated on IRC my initial assumption was
wrong. The problem is probably not in GnuTLS, as gnutls-cli works
fine. The problem is in the way libcurl and GnuTLS interact. Therefore
libvirt's GnuTLS usage is not affected, only libcurl's.

I know how to fix it, but I don't understand in detail yet why it works.

Matthias

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

Re: [libvirt] [PATCH] docs: added compiling page and significantly expanded windows page

2010-11-17 Thread Daniel P. Berrange
On Wed, Nov 17, 2010 at 02:53:15PM +0100, Matthias Bolte wrote:
 2010/11/17 Justin Clift jcl...@redhat.com:
  Also added an additional menu placement for the windows page, in
  order to attract further potential testers.
  ---
 
  +      li
  +        The working connection types at the moment are very limited.  Only
  +        bqemu+tcp:///b is known to work for sure.  Anything using SSH,
  +        such as bqemu+ssh:///b, definitely doesn't work.  Connecting
  +        to ESX servers doesn't yet work either, due to a bug involving
  +        GnuTLS, which should be fixed in the next release.
  +      /li
 
 Don't blame GnuTLS here. As stated on IRC my initial assumption was
 wrong. The problem is probably not in GnuTLS, as gnutls-cli works
 fine. The problem is in the way libcurl and GnuTLS interact. Therefore
 libvirt's GnuTLS usage is not affected, only libcurl's.

Also this is mixing up two different drivers, the remote driver vs the
ESX driver. The remote driver with TLS should in fact work, and is indeed
the *only* transport for the driver which we can recommend using from
Windows clients. qemu+tcp:// should not be recommended, because there is
no SASL support yet  and no one wants to be using this unencrypted with
no auth.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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] docs: added compiling page and significantly expanded windows page

2010-11-17 Thread Daniel P. Berrange
On Wed, Nov 17, 2010 at 02:53:15PM +0100, Matthias Bolte wrote:
 2010/11/17 Justin Clift jcl...@redhat.com:
  Also added an additional menu placement for the windows page, in
  order to attract further potential testers.
  ---
 
  +      li
  +        The working connection types at the moment are very limited.  Only
  +        bqemu+tcp:///b is known to work for sure.  Anything using SSH,
  +        such as bqemu+ssh:///b, definitely doesn't work.  Connecting
  +        to ESX servers doesn't yet work either, due to a bug involving
  +        GnuTLS, which should be fixed in the next release.
  +      /li
 
 Don't blame GnuTLS here. As stated on IRC my initial assumption was
 wrong. The problem is probably not in GnuTLS, as gnutls-cli works
 fine. The problem is in the way libcurl and GnuTLS interact. Therefore
 libvirt's GnuTLS usage is not affected, only libcurl's.
 
 I know how to fix it, but I don't understand in detail yet why it works.

Are you referring to this message ?

  A TLS packet with unexpected length was received

The place you normally see this is from 'gnutls_handshake()', and it is
an indication that the handshake has been aborted by either the client
or server. Typical problems include bad certificates, bad choice of
encryption ciphers, bad TLS protocol, etc.  It is pretty hard to 
debug, likely want to turn on the verbose GnuTLS debugging options
in the code, and also verify how the ESX server is configured and
all your certificates

In particular, by default GnuTLS will reject certificates issued by
openssl which default to x509 v1, and thus lack the 'Basic Constraints'
extension from x509 v3.

Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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] doc: update virsh manual

2010-11-17 Thread Osier Yang
* tools/virsh.pod (change things like edit domain.xml into
  vi domain.xml, so that it's more clear for user)
---
 tools/virsh.pod |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/virsh.pod b/tools/virsh.pod
index 8032256..ca8ba74 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -306,7 +306,7 @@ Lhttp://libvirt.org/formatdomain.html#elementsCPU

 The following commands manipulate domains directly, as stated
 previously most commands take domain-id as the first parameter. The
-Idomain-id can be specified as an short integer, a name or a full UUID.
+Idomain-id can be specified as a short integer, a name or a full UUID.

 =over 4

@@ -334,7 +334,7 @@ If I--console is requested, attach to the console after 
creation.
 BExample

  virsh dumpxml domain-id  domain.xml
- edit domain.xml
+ vi domain.xml (or make changes with your other text editor)
  virsh create  domain.xml

 =item Bdefine IFILE
@@ -431,7 +431,7 @@ Edit the XML configuration file for a domain.
 This is equivalent to:

  virsh dumpxml domain  domain.xml
- edit domain.xml
+ vi domain.xml (or make changes with your other text editor)
  virsh define domain.xml

 except that it does some error checking.
@@ -631,7 +631,7 @@ is not available the processes will provide an exit code of 
1.
 =head1 DEVICE COMMANDS

 The following commands manipulate devices associated to domains.
-The domain-id can be specified as an short integer, a name or a full UUID.
+The domain-id can be specified as a short integer, a name or a full UUID.
 To better understand the values allowed as options for the command
 reading the documentation at Lhttp://libvirt.org/formatdomain.html on the
 format of the device sections to get the most accurate set of accepted values.
@@ -735,7 +735,7 @@ Edit the XML configuration file for a network.
 This is equivalent to:

  virsh net-dumpxml network  network.xml
- edit network.xml
+ vi network.xml (or make changes with your other text editor)
  virsh net-define network.xml

 except that it does some error checking.
@@ -851,7 +851,7 @@ Edit the XML configuration file for a storage pool.
 This is equivalent to:

  virsh pool-dumpxml pool  pool.xml
- edit pool.xml
+ vi pool.xml (or make changes with your other text editor)
  virsh pool-define pool.xml

 except that it does some error checking.
@@ -908,7 +908,7 @@ pre-existing volume.
 BExample

  virsh vol-dumpxml --pool storagepool1 appvolume1  newvolume.xml
- edit newvolume.xml
+ vi newvolume.xml (or make changes with your other text editor)
  virsh vol-create differentstoragepool newvolume.xml

 =item Bvol-create-from Ipool-or-uuid IFILE [optional I--inputpool
@@ -1138,7 +1138,7 @@ Edit the XML of a network filter.
 This is equivalent to:

  virsh nwfilter-dumpxml myfilter  myfilter.xml
- edit myfilter.xml
+ vi myfilter.xml (or make changes with your other text editor)
  virsh nwfilter-define myfilter.xml

 except that it does some error checking.
--
1.7.3.2

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


Re: [libvirt] [PATCH] maint: use gnulib configmake rather than open-coding things

2010-11-17 Thread Daniel P. Berrange
On Tue, Nov 16, 2010 at 10:53:03AM -0700, Eric Blake wrote:
 In some cases, we were just plain confusing (BINDIR expanded to
 $(libexecdir), GETTEXT_PACKAGE redefined PACKAGE for no apparant
 reason); in other cases, we might as well benefit from gnulib doing
 the work for us (PKGDATADIR), sometimes with different spellings
 (LOCAL_STATE_DIR vs. LOCALSTATEDIR).
 
 * bootstrap.conf (gnulib_modules): Add configmake.
 * daemon/Makefile.am (libvirtd_CFLAGS): Drop defines provided by
 gnulib.
 * src/Makefile.am (INCLUDES): Likewise.
 * tests/Makefile.am (INCLUDES): Likewise.
 * tools/Makefile.am (virsh_CFLAGS): Likewise.
 * daemon/libvirtd.c (qemudInitPaths, usage, main): Update
 clients.
 * src/cpu/cpu_map.c (CPUMAPFILE): Likewise.
 * src/driver.c (DEFAULT_DRIVER_DIR): Likewise.
 * src/internal.h (_): Likewise.
 * src/libvirt.c (virInitialize): Likewise.
 * src/lxc/lxc_conf.h (LXC_CONFIG_DIR, LXC_STATE_DIR, LXC_LOG_DIR):
 Likewise.
 * src/lxc/lxc_conf.c (lxcCapsInit, lxcLoadDriverConfig):
 Likewise.
 * src/network/bridge_driver.c (NETWORK_PID_DIR)
 (NETWORK_STATE_DIR, DNSMASQ_STATE_DIR, networkStartup): Likewise.
 * src/nwfilter/nwfilter_driver.c (nwfilterDriverStartup):
 Likewise.
 * src/qemu/qemu_conf.c (qemudLoadDriverConfig): Likewise.
 * src/qemu/qemu_driver.c (qemudStartup): Likewise.
 * src/remote/remote_driver.h (LIBVIRTD_PRIV_UNIX_SOCKET)
 (LIBVIRTD_PRIV_UNIX_SOCKET_RO, LIBVIRTD_CONFIGURATION_FILE)
 (LIBVIRT_PKI_DIR): Likewise.
 * src/secret/secret_driver.c (secretDriverStartup): Likewise.
 * src/security/security_apparmor.c (VIRT_AA_HELPER): Likewise.
 * src/security/virt-aa-helper.c (main): Likewise.
 * src/storage/storage_backend_disk.c (PARTHELPER): Likewise.
 * src/storage/storage_driver.c (storageDriverStartup): Likewise.
 * src/uml/uml_driver.c (TEMPDIR, umlStartup): Likewise.
 * src/util/hooks.c (LIBVIRT_HOOK_DIR): Likewise.
 * tools/virsh.c (main): Likewise.
 * docs/hooks.html.in: Likewise.
 ---
  bootstrap.conf |1 +
  daemon/Makefile.am |6 ++
  daemon/libvirtd.c  |   14 --
  docs/hooks.html.in |2 +-
  src/Makefile.am|8 
  src/cpu/cpu_map.c  |4 ++--
  src/driver.c   |3 ++-
  src/internal.h |2 +-
  src/libvirt.c  |3 ++-
  src/lxc/lxc_conf.c |7 ---
  src/lxc/lxc_conf.h |7 ---
  src/network/bridge_driver.c|   11 ++-
  src/nwfilter/nwfilter_driver.c |6 +++---
  src/qemu/qemu_conf.c   |6 --
  src/qemu/qemu_driver.c |   16 
  src/remote/remote_driver.h |   12 +++-
  src/secret/secret_driver.c |3 ++-
  src/security/security_apparmor.c   |5 +++--
  src/security/virt-aa-helper.c  |7 ---
  src/storage/storage_backend_disk.c |3 ++-
  src/storage/storage_driver.c   |5 +++--
  src/uml/uml_driver.c   |9 +
  src/util/hooks.c   |3 ++-
  tests/Makefile.am  |1 -
  tools/Makefile.am  |2 --
  tools/virsh.c  |5 +++--
  26 files changed, 79 insertions(+), 72 deletions(-)

ACK

 diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
 index 2b5a7c6..c5a876b 100644
 --- a/src/secret/secret_driver.c
 +++ b/src/secret/secret_driver.c
 @@ -42,6 +42,7 @@
  #include uuid.h
  #include virterror_internal.h
  #include files.h
 +#include configmake.h

Should we just put that in 'internal.h' so all source files
(in src/ at least) get it ?  We'd still need it separately
in some places

Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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 1/3] maint: improve i18n on non-Linux

2010-11-17 Thread Daniel P. Berrange
On Tue, Nov 16, 2010 at 03:35:16PM -0700, Eric Blake wrote:
 Per the gettext developer:
 http://lists.gnu.org/archive/html/bug-gnu-utils/2010-10/msg00019.html
 http://lists.gnu.org/archive/html/bug-gnu-utils/2010-10/msg00021.html
 
 gettext() doesn't work correctly on all platforms unless you have
 called setlocale().  Furthermore, gnulib's gettext.h has provisions
 for setting up a default locale, which is the preferred method for
 libraries to use gettext without having to call textdomain() and
 override the main program's default domain (virInitialize already
 calls bindtextdomain(), but this is insufficient without the
 setlocale() added in this patch; and a redundant bindtextdomain()
 in this patch doesn't hurt, but serves as a good example for other
 packages that need to bind a second translation domain).
 
 This patch is needed to silence a new gnulib 'make syntax-check'
 rule in the next patch.
 
 * daemon/libvirtd.c (main): Setup locale and gettext.
 * src/lxc/lxc_controller.c (main): Likewise.
 * src/security/virt-aa-helper.c (main): Likewise.
 * src/storage/parthelper.c (main): Likewise.
 * tools/virsh.c (main): Fix exit status.
 * src/internal.h (DEFAULT_TEXT_DOMAIN): Define, for gettext.h.
 (_): Simplify definition accordingly.
 * po/POTFILES.in: Add src/storage/parthelper.c.
 ---
 
  daemon/libvirtd.c|   10 +++---
  po/POTFILES.in   |1 +
  src/internal.h   |   11 ---
  src/lxc/lxc_controller.c |9 +
  src/security/security_apparmor.c |1 +
  src/security/virt-aa-helper.c|7 +++
  src/storage/parthelper.c |   15 ---
  tools/virsh.c|4 ++--
  8 files changed, 47 insertions(+), 11 deletions(-)

ACK

Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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 3/3] virt-aa-helper: translate error messages

2010-11-17 Thread Daniel P. Berrange
On Tue, Nov 16, 2010 at 03:35:18PM -0700, Eric Blake wrote:
 These messages are visible to the user, so they should be
 consistently translated.
 
 * cfg.mk (msg_gen_function): Add vah_error, vah_warning.
 * src/security/virt-aa-helper.c: Translate messages.
 (catchXMLError): Fix capitalization.
 ---
  cfg.mk|2 +
  src/security/virt-aa-helper.c |  187 
 +
  2 files changed, 98 insertions(+), 91 deletions(-)

ACK

Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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 2/3] maint: update to latest gnulib

2010-11-17 Thread Daniel P. Berrange
On Tue, Nov 16, 2010 at 03:35:17PM -0700, Eric Blake wrote:
 Allows bootstrap to work on FreeBSD, where gzip doesn't have a '.'
 in its version; and silences false positives in the new
 'make syntax-check' rule.
 
 * .gnulib: Update to latest.
 * bootstrap: Synchronize to upstream.
 * .x-sc_bindtextdomain: New exemptions.
 * Makefile.am (syntax_check_exceptions): Ship new file.
 * .gitignore: Regenerate per latest bootstrap, anchor entries that
 are only in the root directory, and consolidate entries from other
 generated .gitignore files.
 * build-aux/.gitignore, m4/.gitignore, po/.gitignore: Remove from
 version control, since bootstrap generates them.
 ---
  .gitignore   |   65 +++--
  .gnulib  |2 +-
  .x-sc_bindtextdomain |2 +
  Makefile.am  |1 +
  bootstrap|   44 +++--
  build-aux/.gitignore |   16 
  m4/.gitignore|   37 
  po/.gitignore|   17 -
  8 files changed, 70 insertions(+), 114 deletions(-)
  create mode 100644 .x-sc_bindtextdomain
  delete mode 100644 build-aux/.gitignore
  delete mode 100644 m4/.gitignore
  delete mode 100644 po/.gitignore

ACK

Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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 v2] replace last instances of close()

2010-11-17 Thread Daniel P. Berrange
On Tue, Nov 16, 2010 at 09:58:21PM -0500, Stefan Berger wrote:
 v2:
   - added comments about the monitor lock being used to protect the 
 file descriptor 'fd'
   - eofcb is not set anywhere, so also removing it; the if statement 
 checking on it seems dead code
 
 I am replacing the last instances of close() I found with VIR_CLOSE() / 
 VIR_FORCE_CLOSE respectively.
 
 The first part patches virsh, which I missed out on previously.
 
 The 2nd patch I had left out intentionally to look at it more carefully:
 The 'closed' variable could be easily removed since it wasn't used 
 anywhere else. The possible race condition that could result from the 
 filedescriptor being closed and not set to -1 (and possibly let us write 
 into 'something' totally different if the fd was allocated by another 
 thread) seems to be prevented by the qemuMonitorLock() already placed 
 around the code that reads from or writes to the fd. So the change of 
 this code as shown in the patch should not have any side-effects.
 
 Signed-off-by: Stefan Bergerstef...@us.ibm.com

ACK


Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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] docs: added compiling page and significantly expanded windows page

2010-11-17 Thread Matthias Bolte
2010/11/17 Daniel P. Berrange berra...@redhat.com:
 On Wed, Nov 17, 2010 at 02:53:15PM +0100, Matthias Bolte wrote:
 2010/11/17 Justin Clift jcl...@redhat.com:
  Also added an additional menu placement for the windows page, in
  order to attract further potential testers.
  ---

  +      li
  +        The working connection types at the moment are very limited.  Only
  +        bqemu+tcp:///b is known to work for sure.  Anything using SSH,
  +        such as bqemu+ssh:///b, definitely doesn't work.  Connecting
  +        to ESX servers doesn't yet work either, due to a bug involving
  +        GnuTLS, which should be fixed in the next release.
  +      /li

 Don't blame GnuTLS here. As stated on IRC my initial assumption was
 wrong. The problem is probably not in GnuTLS, as gnutls-cli works
 fine. The problem is in the way libcurl and GnuTLS interact. Therefore
 libvirt's GnuTLS usage is not affected, only libcurl's.

 I know how to fix it, but I don't understand in detail yet why it works.

 Are you referring to this message ?

  A TLS packet with unexpected length was received

 The place you normally see this is from 'gnutls_handshake()', and it is
 an indication that the handshake has been aborted by either the client
 or server. Typical problems include bad certificates, bad choice of
 encryption ciphers, bad TLS protocol, etc.  It is pretty hard to
 debug, likely want to turn on the verbose GnuTLS debugging options
 in the code, and also verify how the ESX server is configured and
 all your certificates

 In particular, by default GnuTLS will reject certificates issued by
 openssl which default to x509 v1, and thus lack the 'Basic Constraints'
 extension from x509 v3.

 Daniel


Well, yes that's the problem and it is the handshake. As I can tell
from Wireshark the client sends a RST package directly after the
Client Hello. So this is not certificate related or something like
that.

This problem also occurs with

  curl -kv https://www.google.com

and other HTTPS websites. This only happens when curl is compiled with
GnuTLS. curl compiled with OpenSSL or PolarSSL works just fine. Also
this only happens on Windows. I tried to find precompiled curl
binaries that use GnuTLS to check if the problem is in the way I
compile curl, but all binaries I could find use OpenSSL, even the
Fedora mingw32-curl package uses OpenSSL.

I traced the problem down to this libcurl commit

  https://github.com/bagder/curl/commit/fcccf9aa0d93c666e8ae31ebdde716cddd6b4482

from 2006. This commit makes sure that GnuTLS calls send() with the
MSG_NOSIGNAL flag to avoid SIGPIPE. If I revert this commit curl works
just fine with GnuTLS. Also this commit as is has no use on Windows,
because there is no MSG_NOSIGNAL flag for send() on Windows. But this
commit triggers the handshake problem and I didn't understand yet why
it does so.

Matthias

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

Re: [libvirt] [PATCH] docs: added compiling page and significantly expanded windows page

2010-11-17 Thread Daniel P. Berrange
On Wed, Nov 17, 2010 at 03:42:18PM +0100, Matthias Bolte wrote:
 2010/11/17 Daniel P. Berrange berra...@redhat.com:
  On Wed, Nov 17, 2010 at 02:53:15PM +0100, Matthias Bolte wrote:
  2010/11/17 Justin Clift jcl...@redhat.com:
   Also added an additional menu placement for the windows page, in
   order to attract further potential testers.
   ---
 
   +      li
   +        The working connection types at the moment are very limited.  
   Only
   +        bqemu+tcp:///b is known to work for sure.  Anything using 
   SSH,
   +        such as bqemu+ssh:///b, definitely doesn't work.  Connecting
   +        to ESX servers doesn't yet work either, due to a bug involving
   +        GnuTLS, which should be fixed in the next release.
   +      /li
 
  Don't blame GnuTLS here. As stated on IRC my initial assumption was
  wrong. The problem is probably not in GnuTLS, as gnutls-cli works
  fine. The problem is in the way libcurl and GnuTLS interact. Therefore
  libvirt's GnuTLS usage is not affected, only libcurl's.
 
  I know how to fix it, but I don't understand in detail yet why it works.
 
  Are you referring to this message ?
 
   A TLS packet with unexpected length was received
 
  The place you normally see this is from 'gnutls_handshake()', and it is
  an indication that the handshake has been aborted by either the client
  or server. Typical problems include bad certificates, bad choice of
  encryption ciphers, bad TLS protocol, etc.  It is pretty hard to
  debug, likely want to turn on the verbose GnuTLS debugging options
  in the code, and also verify how the ESX server is configured and
  all your certificates
 
  In particular, by default GnuTLS will reject certificates issued by
  openssl which default to x509 v1, and thus lack the 'Basic Constraints'
  extension from x509 v3.
 
  Daniel
 
 
 Well, yes that's the problem and it is the handshake. As I can tell
 from Wireshark the client sends a RST package directly after the
 Client Hello. So this is not certificate related or something like
 that.
 
 This problem also occurs with
 
   curl -kv https://www.google.com
 
 and other HTTPS websites. This only happens when curl is compiled with
 GnuTLS. curl compiled with OpenSSL or PolarSSL works just fine. Also
 this only happens on Windows. I tried to find precompiled curl
 binaries that use GnuTLS to check if the problem is in the way I
 compile curl, but all binaries I could find use OpenSSL, even the
 Fedora mingw32-curl package uses OpenSSL.
 
 I traced the problem down to this libcurl commit
 
   
 https://github.com/bagder/curl/commit/fcccf9aa0d93c666e8ae31ebdde716cddd6b4482
 
 from 2006. This commit makes sure that GnuTLS calls send() with the
 MSG_NOSIGNAL flag to avoid SIGPIPE. If I revert this commit curl works
 just fine with GnuTLS. Also this commit as is has no use on Windows,
 because there is no MSG_NOSIGNAL flag for send() on Windows. But this
 commit triggers the handshake problem and I didn't understand yet why
 it does so.

I'm not convinced that they should be calling  'gnutls_transport_set_lowat'
so try removing that.

Also, I think they might have broken the errno handling. The gnutls
push/pull funcs are returned to return '-1' and set 'errno' upon
failure. The windows send/recvmsg functions don't set errno though,
and you need to use WSAGetLastError() instead. If you don't set custom 
push/pull funcs GNUTLs does the WSAGetLastError() - errno conversion
itself. So their custom push/pull functions probably need to manually
set 'errno' based on WSAGetLastError() values, unless some other part
of the curl code already takes care of that

Regards,
Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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 v2] replace last instances of close()

2010-11-17 Thread Stefan Berger

On 11/17/2010 09:36 AM, Daniel P. Berrange wrote:

On Tue, Nov 16, 2010 at 09:58:21PM -0500, Stefan Berger wrote:

v2:
   - added comments about the monitor lock being used to protect the
file descriptor 'fd'
   - eofcb is not set anywhere, so also removing it; the if statement
checking on it seems dead code

I am replacing the last instances of close() I found with VIR_CLOSE() /
VIR_FORCE_CLOSE respectively.

The first part patches virsh, which I missed out on previously.

The 2nd patch I had left out intentionally to look at it more carefully:
The 'closed' variable could be easily removed since it wasn't used
anywhere else. The possible race condition that could result from the
filedescriptor being closed and not set to -1 (and possibly let us write
into 'something' totally different if the fd was allocated by another
thread) seems to be prevented by the qemuMonitorLock() already placed
around the code that reads from or writes to the fd. So the change of
this code as shown in the patch should not have any side-effects.

Signed-off-by: Stefan Bergerstef...@us.ibm.com

ACK


Daniel

Pushed.


Stefan

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


Re: [libvirt] [PATCHv3] maint: avoid remaining sprintf uses

2010-11-17 Thread Daniel P. Berrange
On Tue, Nov 16, 2010 at 04:16:40PM -0700, Eric Blake wrote:
 * cfg.mk (sc_prohibit_sprintf): New rule.
 (sc_prohibit_asprintf): Avoid false positives.
 * docs/hacking.html.in (Printf-style functions): Document the
 policy.
 * HACKING: Regenerate.
 * .x-sc_prohibit_sprintf: New exemptions.
 * Makefile.am (syntax-check_exceptions): Ship new file.
 * src/vbox/vbox_tmpl.c (vboxStartMachine, vboxAttachUSB): Use
 virAsprintf instead.
 * src/uml/uml_driver.c (umlOpenMonitor): Use snprintf instead.
 * tools/virsh.c (cmdDetachInterface): Likewise.
 * src/security/security_selinux.c (SELinuxGenSecurityLabel):
 Likewise.
 * src/openvz/openvz_driver.c (openvzDomainDefineCmd): Likewise,
 and ensure large enough buffer.
 ---
 
 diff in v3 - rebase on top of my pending patch to update gnulib
 diff in v2 - actually include the changes to src/vbox/vbox_templ.c
 
  .x-sc_prohibit_sprintf  |4 +++
  HACKING |6 +
  Makefile.am |1 +
  cfg.mk  |   13 --
  docs/hacking.html.in|9 +++
  src/openvz/openvz_driver.c  |5 ++-
  src/security/security_selinux.c |6 ++--
  src/uml/uml_driver.c|3 +-
  src/vbox/vbox_tmpl.c|   46 +-
  tools/virsh.c   |2 +-
  10 files changed, 69 insertions(+), 26 deletions(-)
  create mode 100644 .x-sc_prohibit_sprintf

ACK

Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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] docs: added compiling page and significantly expanded windows page

2010-11-17 Thread Matthias Bolte
2010/11/17 Daniel P. Berrange berra...@redhat.com:
 On Wed, Nov 17, 2010 at 03:42:18PM +0100, Matthias Bolte wrote:
 2010/11/17 Daniel P. Berrange berra...@redhat.com:
  On Wed, Nov 17, 2010 at 02:53:15PM +0100, Matthias Bolte wrote:
  2010/11/17 Justin Clift jcl...@redhat.com:
   Also added an additional menu placement for the windows page, in
   order to attract further potential testers.
   ---
 
   +      li
   +        The working connection types at the moment are very limited.  
   Only
   +        bqemu+tcp:///b is known to work for sure.  Anything using 
   SSH,
   +        such as bqemu+ssh:///b, definitely doesn't work.  
   Connecting
   +        to ESX servers doesn't yet work either, due to a bug involving
   +        GnuTLS, which should be fixed in the next release.
   +      /li
 
  Don't blame GnuTLS here. As stated on IRC my initial assumption was
  wrong. The problem is probably not in GnuTLS, as gnutls-cli works
  fine. The problem is in the way libcurl and GnuTLS interact. Therefore
  libvirt's GnuTLS usage is not affected, only libcurl's.
 
  I know how to fix it, but I don't understand in detail yet why it works.
 
  Are you referring to this message ?
 
   A TLS packet with unexpected length was received
 
  The place you normally see this is from 'gnutls_handshake()', and it is
  an indication that the handshake has been aborted by either the client
  or server. Typical problems include bad certificates, bad choice of
  encryption ciphers, bad TLS protocol, etc.  It is pretty hard to
  debug, likely want to turn on the verbose GnuTLS debugging options
  in the code, and also verify how the ESX server is configured and
  all your certificates
 
  In particular, by default GnuTLS will reject certificates issued by
  openssl which default to x509 v1, and thus lack the 'Basic Constraints'
  extension from x509 v3.
 
  Daniel
 

 Well, yes that's the problem and it is the handshake. As I can tell
 from Wireshark the client sends a RST package directly after the
 Client Hello. So this is not certificate related or something like
 that.

 This problem also occurs with

   curl -kv https://www.google.com

 and other HTTPS websites. This only happens when curl is compiled with
 GnuTLS. curl compiled with OpenSSL or PolarSSL works just fine. Also
 this only happens on Windows. I tried to find precompiled curl
 binaries that use GnuTLS to check if the problem is in the way I
 compile curl, but all binaries I could find use OpenSSL, even the
 Fedora mingw32-curl package uses OpenSSL.

 I traced the problem down to this libcurl commit

   
 https://github.com/bagder/curl/commit/fcccf9aa0d93c666e8ae31ebdde716cddd6b4482

 from 2006. This commit makes sure that GnuTLS calls send() with the
 MSG_NOSIGNAL flag to avoid SIGPIPE. If I revert this commit curl works
 just fine with GnuTLS. Also this commit as is has no use on Windows,
 because there is no MSG_NOSIGNAL flag for send() on Windows. But this
 commit triggers the handshake problem and I didn't understand yet why
 it does so.

 I'm not convinced that they should be calling  'gnutls_transport_set_lowat'
 so try removing that.

 Also, I think they might have broken the errno handling. The gnutls
 push/pull funcs are returned to return '-1' and set 'errno' upon
 failure. The windows send/recvmsg functions don't set errno though,
 and you need to use WSAGetLastError() instead. If you don't set custom
 push/pull funcs GNUTLs does the WSAGetLastError() - errno conversion
 itself. So their custom push/pull functions probably need to manually
 set 'errno' based on WSAGetLastError() values, unless some other part
 of the curl code already takes care of that

 Regards,
 Daniel


Ah, the missing errno handling is the problem. When I use the same
WSAGetLastError() to errno translation as GnuTLS in libcurl's custom
send/recv functions then it works.

Removing the call to gnutls_transport_set_lowat makes no difference.

Thank you for this hint :)

Matthias

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

Re: [libvirt] [PATCH 3/3] virt-aa-helper: translate error messages

2010-11-17 Thread Eric Blake
On 11/17/2010 07:34 AM, Daniel P. Berrange wrote:
 On Tue, Nov 16, 2010 at 03:35:18PM -0700, Eric Blake wrote:
 These messages are visible to the user, so they should be
 consistently translated.

 * cfg.mk (msg_gen_function): Add vah_error, vah_warning.
 * src/security/virt-aa-helper.c: Translate messages.
 (catchXMLError): Fix capitalization.
 ---
  cfg.mk|2 +
  src/security/virt-aa-helper.c |  187 
 +
  2 files changed, 98 insertions(+), 91 deletions(-)
 
 ACK

Thanks; series is pushed.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCHv3] maint: avoid remaining sprintf uses

2010-11-17 Thread Eric Blake
On 11/17/2010 09:09 AM, Daniel P. Berrange wrote:
 On Tue, Nov 16, 2010 at 04:16:40PM -0700, Eric Blake wrote:
 * cfg.mk (sc_prohibit_sprintf): New rule.
 (sc_prohibit_asprintf): Avoid false positives.
 * docs/hacking.html.in (Printf-style functions): Document the
 policy.
 * HACKING: Regenerate.

 
 ACK

Thanks; pushed.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] maint: use gnulib configmake rather than open-coding things

2010-11-17 Thread Eric Blake
On 11/17/2010 07:32 AM, Daniel P. Berrange wrote:
 On Tue, Nov 16, 2010 at 10:53:03AM -0700, Eric Blake wrote:
 In some cases, we were just plain confusing (BINDIR expanded to
 $(libexecdir), GETTEXT_PACKAGE redefined PACKAGE for no apparant
 reason); in other cases, we might as well benefit from gnulib doing
 the work for us (PKGDATADIR), sometimes with different spellings
 (LOCAL_STATE_DIR vs. LOCALSTATEDIR).

 * bootstrap.conf (gnulib_modules): Add configmake.
 * daemon/Makefile.am (libvirtd_CFLAGS): Drop defines provided by
 gnulib.

  26 files changed, 79 insertions(+), 72 deletions(-)
 ACK

Pushing as is.  If we decide to do more cleanups, they can come as later
patches.

 +++ b/src/secret/secret_driver.c
 @@ -42,6 +42,7 @@
  #include uuid.h
  #include virterror_internal.h
  #include files.h
 +#include configmake.h
 
 Should we just put that in 'internal.h' so all source files
 (in src/ at least) get it ?  We'd still need it separately
 in some places

The documentation for configmake.h recommends that it be included
after all system headers.  In particular, internal.h is included prior
to windows.h in util/threads-win32.h, and I'm afraid that moving
configmake.h into internal.h would break a mingw build, since
windows.h is notorious for littering the namespace with conflicting
defines.  However, I have not tested that theory; would you like me to
try that as a possible subsequent cleanup?

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] doc: update virsh manual

2010-11-17 Thread Eric Blake
On 11/17/2010 07:15 AM, Osier Yang wrote:
 * tools/virsh.pod (change things like edit domain.xml into
   vi domain.xml, so that it's more clear for user)
 ---
  tools/virsh.pod |   16 
  1 files changed, 8 insertions(+), 8 deletions(-)
 
 diff --git a/tools/virsh.pod b/tools/virsh.pod
 index 8032256..ca8ba74 100644
 --- a/tools/virsh.pod
 +++ b/tools/virsh.pod
 @@ -306,7 +306,7 @@ Lhttp://libvirt.org/formatdomain.html#elementsCPU
 
  The following commands manipulate domains directly, as stated
  previously most commands take domain-id as the first parameter. The
 -Idomain-id can be specified as an short integer, a name or a full UUID.
 +Idomain-id can be specified as a short integer, a name or a full UUID.
 
  =over 4
 
 @@ -334,7 +334,7 @@ If I--console is requested, attach to the console after 
 creation.
  BExample
 
   virsh dumpxml domain-id  domain.xml
 - edit domain.xml
 + vi domain.xml (or make changes with your other text editor)

Thanks for reviving this; and your wording works for me (I'm sure I
could bike shed several other wording choices, but this one's reasonable
enough to avoid any further delays).

ACK, and applied.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] maint: use gnulib configmake rather than open-coding things

2010-11-17 Thread Daniel P. Berrange
On Wed, Nov 17, 2010 at 10:19:22AM -0700, Eric Blake wrote:
 On 11/17/2010 07:32 AM, Daniel P. Berrange wrote:
  On Tue, Nov 16, 2010 at 10:53:03AM -0700, Eric Blake wrote:
  In some cases, we were just plain confusing (BINDIR expanded to
  $(libexecdir), GETTEXT_PACKAGE redefined PACKAGE for no apparant
  reason); in other cases, we might as well benefit from gnulib doing
  the work for us (PKGDATADIR), sometimes with different spellings
  (LOCAL_STATE_DIR vs. LOCALSTATEDIR).
 
  * bootstrap.conf (gnulib_modules): Add configmake.
  * daemon/Makefile.am (libvirtd_CFLAGS): Drop defines provided by
  gnulib.
 
   26 files changed, 79 insertions(+), 72 deletions(-)
  ACK
 
 Pushing as is.  If we decide to do more cleanups, they can come as later
 patches.
 
  +++ b/src/secret/secret_driver.c
  @@ -42,6 +42,7 @@
   #include uuid.h
   #include virterror_internal.h
   #include files.h
  +#include configmake.h
  
  Should we just put that in 'internal.h' so all source files
  (in src/ at least) get it ?  We'd still need it separately
  in some places
 
 The documentation for configmake.h recommends that it be included
 after all system headers.  In particular, internal.h is included prior
 to windows.h in util/threads-win32.h, and I'm afraid that moving
 configmake.h into internal.h would break a mingw build, since
 windows.h is notorious for littering the namespace with conflicting
 defines.  However, I have not tested that theory; would you like me to
 try that as a possible subsequent cleanup?

Nah, don't worry about it.

Daniel
-- 
|: Red Hat, Engineering, London-o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.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] docs: added compiling page and significantly expanded windows page

2010-11-17 Thread jclift
On 18/11/2010, at 12:53 AM, Matthias Bolte matthias.bo...@googlemail.com 
wrote:

 2010/11/17 Justin Clift jcl...@redhat.com:
snip
 a bug involving
 +GnuTLS, which should be fixed in the next release.
 +  /li
 
 Don't blame GnuTLS here.

Heh.  Wasn't blaming GnuTLS in this page.  It says involving, rather than 
caused by. :)

Anyway, happy to substitute libcurl or whatever if that's a better idea?

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


Re: [libvirt] [PATCH] docs: added compiling page and significantly expanded windows page

2010-11-17 Thread jclift
On 18/11/2010, at 1:02 AM, Daniel P. Berrange berra...@redhat.com wrote:.
 Also this is mixing up two different drivers, the remote driver vs the
 ESX driver. The remote driver with TLS should in fact work, and is indeed
 the *only* transport for the driver which we can recommend using from
 Windows clients. qemu+tcp:// should not be recommended, because there is
 no SASL support yet  and no one wants to be using this unencrypted with
 no auth.

Good point, there should be some explicit warning about unencrypted tcp, and 
it's probably a good idea for point people towards TLS (after testing).

Will adjust.
 

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


Re: [libvirt] [PATCH] docs: added compiling page and significantly expanded windows page

2010-11-17 Thread Matthias Bolte
2010/11/17  jcl...@redhat.com:
 On 18/11/2010, at 12:53 AM, Matthias Bolte matthias.bo...@googlemail.com 
 wrote:

 2010/11/17 Justin Clift jcl...@redhat.com:
 snip
 a bug involving
 +        GnuTLS, which should be fixed in the next release.
 +      /li

 Don't blame GnuTLS here.

 Heh.  Wasn't blaming GnuTLS in this page.  It says involving, rather than 
 caused by. :)

 Anyway, happy to substitute libcurl or whatever if that's a better idea?

Yes, make it say involving libcurl.

Matthias

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

[libvirt] [PATCH] build: fix autobuild failures on gcov upgrade

2010-11-17 Thread Eric Blake
* autobuild.sh: Avoid syntax error on failed test.
* tools/Makefile.am (CLEANFILES): Clean coverage files.
---

Pushing under the build-breaker rule.  Last time I ran ./autobuild.sh
was on F13; and upgrading to F14 exposed these leftovers due to a
newer gcov than what was in the stale files, in the form of spurious
messages that break 'make check':

+profiling:/home/remote/eblake/libvirt-tmp/tools/virsh-console.gcda:Version 
mismatch - expected 405R got 404R

and concluding with a bug in the autobuild.sh script itself:

./autobuild.sh: line 44: test: =: unary operator expected

 autobuild.sh  |2 +-
 tools/Makefile.am |1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/autobuild.sh b/autobuild.sh
index 130f72d..8248a59 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -41,7 +41,7 @@ st=$(
   { make check syntax-check 21; echo $? 4; } | tee $RESULTS
 )
 exec 3-
-test $st = 0
+test $st = 0
 test -x /usr/bin/lcov  make cov

 rm -f *.tar.gz
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 376ffa8..8a5fb52 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -160,5 +160,6 @@ endif # LIBVIRT_INIT_SCRIPT_RED_HAT


 CLEANFILES = $(bin_SCRIPTS) $(man1_MANS)
+CLEANFILES += *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.i *.s

 DISTCLEANFILES = $(BUILT_SOURCES)
-- 
1.7.3.2

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


[libvirt] [PATCH 0/6] [RFC] Add disk streaming support to libvirt

2010-11-17 Thread Adam Litke
( Those on Cc: sorry for any duplicated messages.  git was configured to use
the wrong smtp relay )

I've been working with Anthony Liguori and Stefan Hajnoczi to enable data
streaming to copy-on-read disk images in qemu.  This work is working its way
through review and I expect it to be upstream soon as part of the support for
the new QED disk image format.

Disk streaming is extremely useful when provisioning domains from a central
repository of template images.  Currently the domain must be provisioned by
either: 1) copying the template image to local storage before the VM can be
started or, 2) creating a qcow2 image that backs to a base image in the remote
repository.  Option 1 can introduce a significant delay when provisioning large
disks.  Option 2 introduces a permanent dependency on a remote service,
increased network load to satisfy disk reads.

Device streaming provides the instant-on benefits of option 2 without
introducing a permanent dependency to the image repository.  Once the VM is
started, the contents of the disk can be streamed to the local image in
parallel.  Once streaming is finished, the domain has a complete and coherent
copy of the image and no longer depends on the central image repository.

Qemu will support two streaming modes: full device and single sector.  Full
device streaming is the easiest to use because one command will cause the whole
device to be streamed as fast as possible.  Single sector mode can be used if
one wants to throttle streaming to reduce I/O pressure.  In this mode, a
management tool issues individual commands to stream single sectors.

To enable this support in libvirt, I propose the following API...

virDomainStreamDisk() will start or stop a full device stream or stream a
single sector of a device.  The behavior is controlled by setting
virDomainStreamDiskFlags.  When either starting or stopping a full device
stream, the return value is either 0 or -1 to indicate whether the operation
succeeded.  For a single sector stream, a device offset is returned (or -1 on
failure).  This value can be used to continue streaming with a subsequent call
to virDomainStreamDisk().

virDomainStreamDiskInfo() returns information about active full device streams
(the device alias, current streaming position, and total size).

While streaming can be used to enable live block migration, this API addresses
the direct streaming use case.  If we can agree that the above use case is
compelling on its own, I would prefer to work on the block migration workflow
immediately after this series.  In that case, we just need to be careful not to
paint ourselves into a corner with respect to migration, but specifics about
that feature can be discussed later.  Does this seem reasonable?

Adam Litke (6):
  Add new API virDomainStreamDisk[Info] to header and drivers
  virDomainStreamDisk: Add public symbols to libvirt API
  Implement disk streaming in the qemu driver
  Add disk streaming support to the remote driver
  Add new disk streaming commands to virsh
  python: Add python bindings for virDomainStreamDisk[Info]

 daemon/remote.c |   96 +
 daemon/remote_dispatch_args.h   |2 +
 daemon/remote_dispatch_prototypes.h |   16 
 daemon/remote_dispatch_ret.h|2 +
 daemon/remote_dispatch_table.h  |   10 ++
 include/libvirt/libvirt.h.in|   34 
 python/generator.py |1 +
 python/libvirt-override-api.xml |5 +
 python/libvirt-override.c   |   46 ++
 src/driver.h|   11 +++
 src/esx/esx_driver.c|2 +
 src/libvirt.c   |  121 +++
 src/libvirt_public.syms |6 ++
 src/lxc/lxc_driver.c|2 +
 src/opennebula/one_driver.c |2 +
 src/openvz/openvz_driver.c  |2 +
 src/phyp/phyp_driver.c  |2 +
 src/qemu/qemu_driver.c  |   75 +
 src/qemu/qemu_monitor.c |   41 +
 src/qemu/qemu_monitor.h |6 ++
 src/qemu/qemu_monitor_json.c|  104 +++
 src/qemu/qemu_monitor_json.h|7 ++
 src/qemu/qemu_monitor_text.c|  156 ++
 src/qemu/qemu_monitor_text.h|8 ++
 src/remote/remote_driver.c  |   85 +++
 src/remote/remote_protocol.c|   63 ++
 src/remote/remote_protocol.h|   51 +++
 src/remote/remote_protocol.x|   37 -
 src/test/test_driver.c  |2 +
 src/uml/uml_driver.c|2 +
 src/vbox/vbox_tmpl.c|2 +
 src/xen/xen_driver.c|2 +
 tools/virsh.c   |  157 +++
 33 files changed, 1157 insertions(+), 1 deletions(-)

-- 
1.7.3.2.164.g6f10c

--
libvir-list mailing list
libvir-list@redhat.com

[libvirt] [PATCH 1/6] Add new API virDomainStreamDisk[Info] to header and drivers

2010-11-17 Thread Adam Litke
Set up the types for the disk streaming functions and insert it into the
virDriver structure definition.  Because of static initializers, update every
driver and set the new field to NULL.

* include/libvirt/libvirt.h.in: new API
* src/driver.h src/*/*_driver.c src/vbox/vbox_tmpl.c: add the new
  entry to the driver structure
* python/generator.py: fix compiler errors, the actual python bindings are
  implemented later

Signed-off-by: Adam Litke a...@us.ibm.com
---
 include/libvirt/libvirt.h.in |   34 ++
 python/generator.py  |3 +++
 src/driver.h |   11 +++
 src/esx/esx_driver.c |2 ++
 src/lxc/lxc_driver.c |2 ++
 src/opennebula/one_driver.c  |2 ++
 src/openvz/openvz_driver.c   |2 ++
 src/phyp/phyp_driver.c   |2 ++
 src/qemu/qemu_driver.c   |2 ++
 src/remote/remote_driver.c   |2 ++
 src/test/test_driver.c   |2 ++
 src/uml/uml_driver.c |2 ++
 src/vbox/vbox_tmpl.c |2 ++
 src/xen/xen_driver.c |2 ++
 14 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 81db3a2..b46e0cb 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1046,6 +1046,40 @@ int virDomainUpdateDeviceFlags(virDomainPtr domain,
const char *xml, unsigned int flags);
 
 /*
+ * Disk Streaming
+ */
+typedef enum {
+VIR_STREAM_DISK_ONE   = 1,  /* Stream a single disk unit */
+VIR_STREAM_DISK_START = 2,  /* Stream the entire disk */
+VIR_STREAM_DISK_STOP  = 4,  /* Stop streaming a disk */
+} virDomainStreamDiskFlags;
+
+#define VIR_STREAM_PATH_BUFLEN 1024
+#define VIR_STREAM_DISK_MAX_STREAMS 10
+
+typedef struct _virStreamDiskState virStreamDiskState;
+struct _virStreamDiskState {
+char path[VIR_STREAM_PATH_BUFLEN];
+/*
+ * The unit of measure for size and offset is unspecified.  These fields
+ * are meant to indicate the progress of a continuous streaming operation.
+ */
+unsigned long long offset; /* Current offset of active streaming */
+unsigned long long size;   /* Disk size */
+};
+typedef virStreamDiskState *virStreamDiskStatePtr;
+
+unsigned long long   virDomainStreamDisk(virDomainPtr dom,
+ const char *path,
+ unsigned long long offset,
+ unsigned int flags);
+
+int  virDomainStreamDiskInfo(virDomainPtr dom,
+ virStreamDiskStatePtr states,
+ unsigned int nr_states,
+ unsigned int flags);
+
+/*
  * NUMA support
  */
 
diff --git a/python/generator.py b/python/generator.py
index 68009b9..2477b59 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -161,6 +161,8 @@ def enum(type, name, value):
 functions_failed = []
 functions_skipped = [
 virConnectListDomains,
+virDomainStreamDisk,
+virDomainStreamDiskInfo,
 ]
 
 skipped_modules = {
@@ -175,6 +177,7 @@ skipped_types = {
  'virConnectDomainEventIOErrorCallback': No function types in python,
  'virConnectDomainEventGraphicsCallback': No function types in python,
  'virEventAddHandleFunc': No function types in python,
+ 'virStreamDiskStatePtr': Not implemented yet,
 }
 
 ###
diff --git a/src/driver.h b/src/driver.h
index 79a96c1..3c83cf5 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -476,6 +476,15 @@ typedef int
 (*virDrvDomainSnapshotDelete)(virDomainSnapshotPtr snapshot,
   unsigned int flags);
 
+typedef unsigned long long
+(*virDrvDomainStreamDisk)(virDomainPtr dom, const char *path,
+  unsigned long long offset, unsigned int flags);
+
+typedef int
+(*virDrvDomainStreamDiskInfo)(virDomainPtr dom,
+  virStreamDiskStatePtr states,
+  unsigned int nr_states, unsigned int flags);
+
 typedef int
 (*virDrvQemuDomainMonitorCommand)(virDomainPtr domain, const char *cmd,
   char **result, unsigned int flags);
@@ -598,6 +607,8 @@ struct _virDriver {
 virDrvQemuDomainMonitorCommand qemuDomainMonitorCommand;
 virDrvDomainSetMemoryParameters domainSetMemoryParameters;
 virDrvDomainGetMemoryParameters domainGetMemoryParameters;
+virDrvDomainStreamDisk domainStreamDisk;
+virDrvDomainStreamDiskInfo domainStreamDiskInfo;
 };
 
 typedef int
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index b3e1284..39c6e43 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -4253,6 +4253,8 @@ static virDriver esxDriver = {
 NULL,/* 

[libvirt] [PATCH 5/6] Add new disk streaming commands to virsh

2010-11-17 Thread Adam Litke
Define two new virsh commands: one to control disk streaming and one to print
the status of active disk streams.

* tools/virsh.c: implement the new commands

Signed-off-by: Adam Litke a...@us.ibm.com
---
 tools/virsh.c |  157 +
 1 files changed, 157 insertions(+), 0 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index ab83976..17957ac 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -229,6 +229,8 @@ static char *vshCommandOptString(const vshCmd *cmd, const 
char *name,
  int *found);
 static long long vshCommandOptLongLong(const vshCmd *cmd, const char *name,
int *found);
+static unsigned long long vshCommandOptULL(const vshCmd *cmd, const char *name,
+   int *found);
 static int vshCommandOptBool(const vshCmd *cmd, const char *name);
 static char *vshCommandOptArgv(const vshCmd *cmd, int count);
 
@@ -3490,6 +3492,141 @@ done:
 }
 
 /*
+ * domstreamdisk command
+ */
+static const vshCmdInfo info_domstreamdisk[] = {
+{help, gettext_noop(Stream data to a disk)},
+{desc, gettext_noop(Stream data to a disk connected to a running 
domain)},
+{ NULL, NULL },
+};
+
+static const vshCmdOptDef opts_domstreamdisk[] = {
+{domain, VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop(domain name, id or 
uuid)},
+{start, VSH_OT_BOOL, VSH_OFLAG_NONE, N_(Start streaming a disk) },
+{stop, VSH_OT_BOOL, VSH_OFLAG_NONE, N_(Stop streaming a disk) },
+{incremental, VSH_OT_BOOL, VSH_OFLAG_NONE, N_(Perform an incremental 
stream) },
+{path, VSH_OT_DATA, VSH_OFLAG_REQ, N_(block device)},
+{offset, VSH_OT_DATA, VSH_OFLAG_NONE, N_(Device offset for incremental 
stream)},
+{ NULL, 0, 0, NULL },
+};
+
+static int
+cmdDomStreamDisk(vshControl *ctl, const vshCmd *cmd)
+{
+virDomainPtr dom;
+char *name;
+const char *path;
+int found;
+unsigned long long offset, next;
+unsigned int flags, start, stop, incr;
+
+if (!vshConnectionUsability(ctl, ctl-conn))
+return FALSE;
+
+flags = start = stop = incr = 0;
+if (vshCommandOptBool(cmd, start)) {
+start = 1;
+flags = VIR_STREAM_DISK_START;
+}
+if (vshCommandOptBool(cmd, stop)) {
+stop = 1;
+flags = VIR_STREAM_DISK_STOP;
+}
+if (vshCommandOptBool(cmd, incremental)) {
+incr = 1;
+flags = VIR_STREAM_DISK_ONE;
+}
+if (start + stop + incr != 1) {
+vshError(ctl, _(Exactly one mode: --start, --stop, --incremental, 
+is required));
+return FALSE;
+}
+
+if (!(dom = vshCommandOptDomain(ctl, cmd, name)))
+return FALSE;
+
+path = vshCommandOptString(cmd, path, NULL);
+
+if (flags == VIR_STREAM_DISK_ONE) {
+offset = vshCommandOptULL(cmd, offset, found);
+if (!found) {
+vshError(ctl, _(An offset is required for incremental 
streaming));
+virDomainFree(dom);
+return FALSE;
+}
+} else {
+offset = 0;
+}
+
+next = virDomainStreamDisk(dom, path, offset, flags);
+if (next == (unsigned long long) -1) {
+vshError(ctl, _(Stream operation failed for the device
+'%s' connected to the domain '%s'), path, name);
+virDomainFree(dom);
+return FALSE;
+}
+
+if (flags == VIR_STREAM_DISK_START)
+vshPrint (ctl, Stream successfully started\n);
+else if (flags == VIR_STREAM_DISK_STOP)
+vshPrint (ctl, Stream successfully stopped\n);
+else
+vshPrint (ctl, Strem successful.  Continue at offset %llu\n, next);
+
+virDomainFree(dom);
+return TRUE;
+}
+
+/*
+ * domstreamdiskinfo command
+ */
+static const vshCmdInfo info_domstreamdiskinfo[] = {
+{help, gettext_noop(Get disk streaming status for a domain)},
+{desc, gettext_noop(Get disk streaming status for a running domain)},
+{ NULL, NULL },
+};
+
+static const vshCmdOptDef opts_domstreamdiskinfo[] = {
+{domain, VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop(domain name, id or 
uuid)},
+{ NULL, 0, 0, NULL },
+};
+
+static int
+cmdDomStreamDiskInfo(vshControl *ctl, const vshCmd *cmd)
+{
+virDomainPtr dom;
+char *name;
+struct _virStreamDiskState streams[VIR_STREAM_DISK_MAX_STREAMS];
+int nr_streams, i;
+
+if (!vshConnectionUsability(ctl, ctl-conn))
+return FALSE;
+
+if (!(dom = vshCommandOptDomain(ctl, cmd, name)))
+return FALSE;
+
+nr_streams = virDomainStreamDiskInfo(dom, streams,
+VIR_STREAM_DISK_MAX_STREAMS, 0);
+if (nr_streams  0) {
+vshError(ctl, _(Failed to get disk stream information for domain %s),
+name);
+virDomainFree(dom);
+return FALSE;
+}
+
+vshPrint (ctl, %-30s %-10s %-10s\n, _(Device), _(Offset),
+  _(Size));
+vshPrint (ctl, 

[libvirt] [PATCH 6/6] python: Add python bindings for virDomainStreamDisk[Info]

2010-11-17 Thread Adam Litke
Enable virDomainStreamDiskInfo in the python API.  dom.StreamDiskInfo() will
return a list containing a dictionary for each active stream.  Each dictionary
contains items to report: the disk alias, the current stream offset, and the
total disk size.

virDomainStreamDisk() works with the automatic wrappers.

* python/generator.py: reenable bindings for this entry point
* python/libvirt-override-api.xml python/libvirt-override.c: the
  generator can't handle this new function, add the new binding,
  and the XML description

Signed-off-by: Adam Litke a...@us.ibm.com
---
 python/generator.py |4 +--
 python/libvirt-override-api.xml |5 
 python/libvirt-override.c   |   46 +++
 3 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/python/generator.py b/python/generator.py
index 2477b59..d523afd 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -161,8 +161,6 @@ def enum(type, name, value):
 functions_failed = []
 functions_skipped = [
 virConnectListDomains,
-virDomainStreamDisk,
-virDomainStreamDiskInfo,
 ]
 
 skipped_modules = {
@@ -177,7 +175,6 @@ skipped_types = {
  'virConnectDomainEventIOErrorCallback': No function types in python,
  'virConnectDomainEventGraphicsCallback': No function types in python,
  'virEventAddHandleFunc': No function types in python,
- 'virStreamDiskStatePtr': Not implemented yet,
 }
 
 ###
@@ -337,6 +334,7 @@ skip_impl = (
 'virNodeDeviceListCaps',
 'virConnectBaselineCPU',
 'virDomainRevertToSnapshot',
+'virDomainStreamDiskInfo',
 )
 
 
diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml
index f209608..207a874 100644
--- a/python/libvirt-override-api.xml
+++ b/python/libvirt-override-api.xml
@@ -296,5 +296,10 @@
   arg name='flags' type='unsigned int' info='flags, curently unused'/
   return type='int' info=0 on success, -1 on error/
 /function
+function name='virDomainStreamDiskInfo' file='python'
+  infocollect information about active disk streams/info
+  arg name='domain' type='virDomainPtr' info='pointer to the domain'/
+  return type='virDomainStreamDiskInfo *' info='A list containing one 
dictionary of statistics for each active stream' /
+/function 
   /symbols
 /api
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 4a03d72..4b91279 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -3491,6 +3491,51 @@ 
libvirt_virConnectDomainEventDeregisterAny(ATTRIBUTE_UNUSED PyObject * self,
 return (py_retval);
 }
 
+static PyObject *
+libvirt_virDomainStreamDiskInfo(PyObject *self ATTRIBUTE_UNUSED,
+PyObject *args) {
+virDomainPtr domain;
+PyObject *pyobj_domain;
+unsigned int nr_streams, i;
+struct _virStreamDiskState streams[VIR_STREAM_DISK_MAX_STREAMS];
+PyObject *ret;
+
+if (!PyArg_ParseTuple(args, (char *)O:virDomainStreamDiskInfo,
+  pyobj_domain))
+return(NULL);
+domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
+
+nr_streams = virDomainStreamDiskInfo(domain, streams,
+ VIR_STREAM_DISK_MAX_STREAMS, 0);
+if (nr_streams == -1)
+return VIR_PY_NONE;
+
+if ((ret = PyList_New(nr_streams)) == NULL)
+return VIR_PY_NONE;
+
+for (i = 0; i  nr_streams; i++) {
+PyObject *dict = PyDict_New();
+if (dict == NULL)
+goto error;
+PyDict_SetItem(dict, libvirt_constcharPtrWrap(path),
+   libvirt_constcharPtrWrap(streams[i].path));
+PyDict_SetItem(dict, libvirt_constcharPtrWrap(offset),
+   libvirt_ulonglongWrap(streams[i].offset));
+PyDict_SetItem(dict, libvirt_constcharPtrWrap(size),
+   libvirt_ulonglongWrap(streams[i].size));
+PyList_SetItem(ret, i, dict);
+}
+return ret;
+
+error:
+for (i = 0; i  PyList_Size(ret); i++) {
+PyObject *item = PyList_GET_ITEM(ret, i);
+Py_XDECREF(item);
+}
+Py_DECREF(ret);
+return VIR_PY_NONE;
+}
+
 
 /
  * *
@@ -3566,6 +3611,7 @@ static PyMethodDef libvirtMethods[] = {
 {(char *) virDomainGetJobInfo, libvirt_virDomainGetJobInfo, 
METH_VARARGS, NULL},
 {(char *) virDomainSnapshotListNames, 
libvirt_virDomainSnapshotListNames, METH_VARARGS, NULL},
 {(char *) virDomainRevertToSnapshot, libvirt_virDomainRevertToSnapshot, 
METH_VARARGS, NULL},
+{(char *) virDomainStreamDiskInfo, libvirt_virDomainStreamDiskInfo, 
METH_VARARGS, NULL},
 {NULL, NULL, 0, NULL}
 };
 
-- 
1.7.3.2.164.g6f10c

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


[libvirt] [PATCH 3/6] Implement disk streaming in the qemu driver

2010-11-17 Thread Adam Litke
Add support for: starting/stopping full device streaming, streaming a single
sector, and getting the status of streaming.  These operations are done by
using the 'stream' and 'info stream' qemu monitor commands.

* src/qemu/qemu_driver.c src/qemu/qemu_monitor_text.[ch]: implement disk
  streaming by using the stream and info stream text monitor commands
* src/qemu/qemu_monitor_json.[ch]: implement commands using the qmp monitor

Signed-off-by: Adam Litke a...@us.ibm.com
---
 src/qemu/qemu_driver.c   |   77 -
 src/qemu/qemu_monitor.c  |   41 +++
 src/qemu/qemu_monitor.h  |6 ++
 src/qemu/qemu_monitor_json.c |  104 
 src/qemu/qemu_monitor_json.h |7 ++
 src/qemu/qemu_monitor_text.c |  156 ++
 src/qemu/qemu_monitor_text.h |8 ++
 7 files changed, 397 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index dbde9e7..d7c049a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13143,6 +13143,79 @@ cleanup:
 return ret;
 }
 
+static unsigned long long
+qemudDomainStreamDisk (virDomainPtr dom, const char *path,
+   unsigned long long offset, unsigned int flags)
+{
+struct qemud_driver *driver = dom-conn-privateData;
+virDomainObjPtr vm;
+unsigned long long ret = -1;
+
+qemuDriverLock(driver);
+vm = virDomainFindByUUID(driver-domains, dom-uuid);
+qemuDriverUnlock(driver);
+
+if (!vm) {
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+virUUIDFormat(dom-uuid, uuidstr);
+qemuReportError(VIR_ERR_NO_DOMAIN,
+_(no domain with matching uuid '%s'), uuidstr);
+goto cleanup;
+}
+
+if (virDomainObjIsActive(vm)) {
+qemuDomainObjPrivatePtr priv = vm-privateData;
+qemuDomainObjEnterMonitor(vm);
+ret = qemuMonitorStreamDisk(priv-mon, path, offset, flags);
+qemuDomainObjExitMonitor(vm);
+} else {
+qemuReportError(VIR_ERR_OPERATION_INVALID,
+%s, _(domain is not running));
+}
+
+cleanup:
+if (vm)
+virDomainObjUnlock(vm);
+return ret;
+}
+
+static int
+qemudDomainStreamDiskInfo (virDomainPtr dom, virStreamDiskStatePtr states,
+   unsigned int nr_states,
+   unsigned int flags ATTRIBUTE_UNUSED)
+{
+struct qemud_driver *driver = dom-conn-privateData;
+virDomainObjPtr vm;
+unsigned int ret = -1;
+
+qemuDriverLock(driver);
+vm = virDomainFindByUUID(driver-domains, dom-uuid);
+qemuDriverUnlock(driver);
+
+if (!vm) {
+char uuidstr[VIR_UUID_STRING_BUFLEN];
+virUUIDFormat(dom-uuid, uuidstr);
+qemuReportError(VIR_ERR_NO_DOMAIN,
+_(no domain with matching uuid '%s'), uuidstr);
+goto cleanup;
+}
+
+if (virDomainObjIsActive(vm)) {
+qemuDomainObjPrivatePtr priv = vm-privateData;
+qemuDomainObjEnterMonitor(vm);
+ret = qemuMonitorStreamDiskInfo(priv-mon, states, nr_states);
+qemuDomainObjExitMonitor(vm);
+} else {
+qemuReportError(VIR_ERR_OPERATION_INVALID,
+%s, _(domain is not running));
+}
+
+cleanup:
+if (vm)
+virDomainObjUnlock(vm);
+return ret;
+}
+
 static int qemuDomainMonitorCommand(virDomainPtr domain, const char *cmd,
 char **result, unsigned int flags)
 {
@@ -13298,8 +13371,8 @@ static virDriver qemuDriver = {
 qemuDomainMonitorCommand, /* qemuDomainMonitorCommand */
 qemuDomainSetMemoryParameters, /* domainSetMemoryParameters */
 qemuDomainGetMemoryParameters, /* domainGetMemoryParameters */
-NULL, /* domainStreamDisk */
-NULL, /* domainStreamDiskInfo */
+qemudDomainStreamDisk, /* domainStreamDisk */
+qemudDomainStreamDiskInfo, /* domainStreamDiskInfo */
 };
 
 
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 2366fdb..9169e23 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1917,6 +1917,47 @@ int qemuMonitorDeleteSnapshot(qemuMonitorPtr mon, const 
char *name)
 return ret;
 }
 
+unsigned long long
+qemuMonitorStreamDisk(qemuMonitorPtr mon, const char *path,
+  unsigned long long offset, unsigned int flags)
+{
+unsigned long long ret;
+
+DEBUG(mon=%p, path=%p, offset=%llu, flags=%u, mon, path, offset, flags);
+
+if (!mon) {
+qemuReportError(VIR_ERR_INVALID_ARG, %s,
+_(monitor must not be NULL));
+return -1;
+}
+
+if (mon-json)
+ret = qemuMonitorJSONStreamDisk(mon, path, offset, flags);
+else
+ret = qemuMonitorTextStreamDisk(mon, path, offset, flags);
+return ret;
+}
+
+int qemuMonitorStreamDiskInfo(qemuMonitorPtr mon, virStreamDiskStatePtr states,
+  unsigned int nr_states)
+{
+int ret;
+
+DEBUG(mon=%p, 

[libvirt] [PATCH 2/6] virDomainStreamDisk: Add public symbols to libvirt API

2010-11-17 Thread Adam Litke
* src/libvirt.c: implement the main entry points
* src/libvirt_public.syms: add them to the exported symbols

Signed-off-by: Adam Litke a...@us.ibm.com
---
 src/libvirt.c   |  121 +++
 src/libvirt_public.syms |6 ++
 2 files changed, 127 insertions(+), 0 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index aebd3bc..4244d23 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -5897,6 +5897,127 @@ error:
 }
 
 /**
+ * virDomainStreamDisk:
+ * @dom: pointer to the domain object
+ * @path: path to the block device
+ * @offset: when streaming a single disk unit, the offset of the unit to stream
+ * @flags: flags to control disk streaming behavior
+ *
+ * Returns: Next offset or 0 on success, -1 on failure.
+ */
+unsigned long long
+virDomainStreamDisk(virDomainPtr dom,
+const char *path,
+unsigned long long offset,
+unsigned int flags)
+{
+virConnectPtr conn;
+unsigned long long ret = -1;
+
+DEBUG(domain=%p, path=%p, offset=%llu, flags=%u,
+  dom, path, offset, flags);
+
+if (path == NULL) {
+virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+   _(path must not be NULL));
+goto error;
+}
+
+if (flags == VIR_STREAM_DISK_START || flags == VIR_STREAM_DISK_STOP) {
+if (offset != 0) {
+virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+   _(offset must be 0 for continuous streaming));
+goto error;
+}
+} else if (flags != VIR_STREAM_DISK_ONE) {
+virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+   _(Invalid value for flags));
+goto error;
+}
+
+virResetLastError();
+if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
+virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+return -1;
+}
+
+conn = dom-conn;
+if (conn-driver-domainStreamDisk) {
+ret = conn-driver-domainStreamDisk (dom, path, offset, flags);
+if (ret == -1)
+goto error;
+return ret;
+}
+
+virLibDomainError (dom, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+virDispatchError(dom-conn);
+return -1;
+}
+
+/**
+ * virDomainStreamDiskInfo:
+ * @dom: pointer to the domain object
+ * @states: An array of virStreamDiskState structures to store stream info
+ * @nr_states: The maximimum number of stream states to report
+ * @flags: future flags, use 0 for now
+ *
+ * Returns: The number of streams reported or -1 on failure.
+ */
+int
+virDomainStreamDiskInfo(virDomainPtr dom,
+virStreamDiskStatePtr states,
+unsigned int nr_states,
+unsigned int flags)
+{
+virConnectPtr conn;
+int ret = -1;
+
+DEBUG(dom=%p, states=%p, nr_states=%u, flags=%u,
+  dom, states, nr_states, flags);
+
+if (states == NULL) {
+virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+   _(states must not be NULL));
+goto error;
+}
+
+if (nr_states == 0) {
+virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+   _(nr_states must be positive));
+goto error;
+}
+
+if (flags != 0) {
+virLibDomainError (dom, VIR_ERR_INVALID_ARG,
+   _(flags must be 0));
+goto error;
+}
+
+virResetLastError();
+if (!VIR_IS_CONNECTED_DOMAIN (dom)) {
+virLibDomainError (NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+return -1;
+}
+
+conn = dom-conn;
+if (conn-driver-domainStreamDiskInfo) {
+ret = conn-driver-domainStreamDiskInfo (dom, states, nr_states,
+  flags);
+if (ret == -1)
+goto error;
+return ret;
+}
+
+virLibDomainError (dom, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+virDispatchError(dom-conn);
+return -1;
+}
+
+/**
  * virNodeGetCellsFreeMemory:
  * @conn: pointer to the hypervisor connection
  * @freeMems: pointer to the array of unsigned long long
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index a8091b1..a25596c 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -413,4 +413,10 @@ LIBVIRT_0.8.5 {
 virDomainSetVcpusFlags;
 } LIBVIRT_0.8.2;
 
+LIBVIRT_0.8.6 {
+global:
+virDomainStreamDisk;
+virDomainStreamDiskInfo;
+} LIBVIRT_0.8.5;
+
 #  define new API here using predicted next version number 
-- 
1.7.3.2.164.g6f10c

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


[libvirt] [PATCH 4/6] Add disk streaming support to the remote driver

2010-11-17 Thread Adam Litke
* src/remote/remote_protocol.x: provide defines for the new entry points
* src/remote/remote_driver.c daemon/remote.c: implement the client and
  server side
* daemon/remote_dispatch_args.h daemon/remote_dispatch_prototypes.h
  daemon/remote_dispatch_ret.h daemon/remote_dispatch_table.h
  src/remote/remote_protocol.c src/remote/remote_protocol.h: generated
  stubs

Signed-off-by: Adam Litke a...@us.ibm.com
---
 daemon/remote.c |   96 +++
 daemon/remote_dispatch_args.h   |2 +
 daemon/remote_dispatch_prototypes.h |   16 ++
 daemon/remote_dispatch_ret.h|2 +
 daemon/remote_dispatch_table.h  |   10 
 src/remote/remote_driver.c  |   87 +++-
 src/remote/remote_protocol.c|   63 +++
 src/remote/remote_protocol.h|   51 ++
 src/remote/remote_protocol.x|   37 +-
 9 files changed, 361 insertions(+), 3 deletions(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 886d53d..69709b3 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -6591,6 +6591,102 @@ cleanup:
 return rc;
 }
 
+static int
+remoteDispatchDomainStreamDisk (struct qemud_server *server ATTRIBUTE_UNUSED,
+struct qemud_client *client ATTRIBUTE_UNUSED,
+virConnectPtr conn,
+remote_message_header *hdr ATTRIBUTE_UNUSED,
+remote_error *rerr,
+remote_domain_stream_disk_args *args,
+remote_domain_stream_disk_ret *ret)
+{
+virDomainPtr dom;
+const char *path;
+unsigned long long offset;
+unsigned int flags;
+int rc;
+
+dom = get_nonnull_domain (conn, args-dom);
+if (dom == NULL) {
+remoteDispatchConnError(rerr, conn);
+return -1;
+}
+
+path = args-path;
+offset = args-offset;
+flags = args-flags;
+
+rc = virDomainStreamDisk(dom, path, offset, flags);
+if (rc == (unsigned long long) -1) {
+remoteDispatchConnError(rerr, conn);
+return -1;
+}
+ret-offset = rc;
+return 0;
+}
+
+static int
+remoteDispatchDomainStreamDiskInfo (struct qemud_server *server 
ATTRIBUTE_UNUSED,
+struct qemud_client *client 
ATTRIBUTE_UNUSED,
+virConnectPtr conn,
+remote_message_header *hdr 
ATTRIBUTE_UNUSED,
+remote_error *rerr,
+remote_domain_stream_disk_info_args *args,
+remote_domain_stream_disk_info_ret *ret)
+{
+virDomainPtr dom;
+struct _virStreamDiskState *states;
+unsigned int nr_states, flags, i;
+int nr_returned;
+
+if (args-nr_results  REMOTE_DOMAIN_STREAM_DISK_STATES_MAX) {
+remoteDispatchFormatError (rerr, %s,
+_(nr_results  
REMOTE_DOMAIN_STREAM_DISK_STATES_MAX));
+return -1;
+}
+
+dom = get_nonnull_domain (conn, args-dom);
+if (dom == NULL) {
+remoteDispatchConnError(rerr, conn);
+return -1;
+}
+
+nr_states = args-nr_results;
+flags = args-flags;
+
+/* Allocate array of stats structs for making dispatch call */
+if (VIR_ALLOC_N(states, nr_states)  0) {
+virDomainFree (dom);
+remoteDispatchOOMError(rerr);
+return -1;
+}
+
+nr_returned = virDomainStreamDiskInfo (dom, states, nr_states, flags);
+virDomainFree (dom);
+if (nr_returned  0) {
+VIR_FREE(states);
+remoteDispatchConnError(rerr, conn);
+return -1;
+}
+
+/* Allocate return buffer */
+if (VIR_ALLOC_N(ret-states.states_val, nr_returned)  0) {
+VIR_FREE(states);
+remoteDispatchOOMError(rerr);
+return -1;
+}
+
+/* Copy the stats into the return structure */
+ret-states.states_len = nr_returned;
+for (i = 0; i  nr_returned; i++) {
+ret-states.states_val[i].path.path_val = strdup(states[i].path);
+ret-states.states_val[i].path.path_len = strlen(states[i].path);
+ret-states.states_val[i].offset = states[i].offset;
+ret-states.states_val[i].size = states[i].size;
+}
+VIR_FREE(states);
+return 0;
+}
 
 static int
 remoteDispatchDomainEventsRegisterAny (struct qemud_server *server 
ATTRIBUTE_UNUSED,
diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h
index 9583e9c..91cbd52 100644
--- a/daemon/remote_dispatch_args.h
+++ b/daemon/remote_dispatch_args.h
@@ -169,3 +169,5 @@
 remote_domain_get_memory_parameters_args 
val_remote_domain_get_memory_parameters_args;
 remote_domain_set_vcpus_flags_args val_remote_domain_set_vcpus_flags_args;
 remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args;
+remote_domain_stream_disk_args 

[libvirt] [PATCH 1/2] QED: Basic support for QED images

2010-11-17 Thread Adam Litke
Add an entry in fileTypeInfo for QED image files.

Signed-off-by: Adam Litke a...@us.ibm.com
Cc: Stefan Hajnoczi stefan.hajno...@uk.ibm.com
Cc: Anthony Liguori aligu...@linux.vnet.ibm.com
---
 src/util/storage_file.c |9 -
 src/util/storage_file.h |1 +
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index 4098383..6e099ed 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -43,7 +43,7 @@ VIR_ENUM_IMPL(virStorageFileFormat,
   VIR_STORAGE_FILE_LAST,
   raw, dir, bochs,
   cloop, cow, dmg, iso,
-  qcow, qcow2, vmdk, vpc)
+  qcow, qcow2, qed, vmdk, vpc)
 
 enum lv_endian {
 LV_LITTLE_ENDIAN = 1, /* 1234 */
@@ -104,6 +104,8 @@ static int vmdk4GetBackingStore(char **, int *,
 #define QCOW2_HDR_EXTENSION_END 0
 #define QCOW2_HDR_EXTENSION_BACKING_FORMAT 0xE2792ACA
 
+#define QED_HDR_IMAGE_SIZE 40
+
 /* VMDK needs at least this to find backing store,
  * other formats need less */
 #define STORAGE_MAX_HEAD (20*512)
@@ -151,6 +153,11 @@ static struct FileTypeInfo const fileTypeInfo[] = {
 LV_BIG_ENDIAN, 4, 2,
 QCOWX_HDR_IMAGE_SIZE, 8, 1, QCOW2_HDR_CRYPT, qcow2GetBackingStore,
 },
+[VIR_STORAGE_FILE_QED] = {
+QED\0, NULL,
+LV_LITTLE_ENDIAN, -1, -1,
+QED_HDR_IMAGE_SIZE, 8, 1, -1, NULL,
+},
 [VIR_STORAGE_FILE_VMDK] = {
 KDMV, NULL,
 LV_LITTLE_ENDIAN, 4, 1,
diff --git a/src/util/storage_file.h b/src/util/storage_file.h
index a3703f5..c4d4650 100644
--- a/src/util/storage_file.h
+++ b/src/util/storage_file.h
@@ -38,6 +38,7 @@ enum virStorageFileFormat {
 VIR_STORAGE_FILE_ISO,
 VIR_STORAGE_FILE_QCOW,
 VIR_STORAGE_FILE_QCOW2,
+VIR_STORAGE_FILE_QED,
 VIR_STORAGE_FILE_VMDK,
 VIR_STORAGE_FILE_VPC,
 VIR_STORAGE_FILE_LAST,
-- 
1.7.3.2.164.g6f10c

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


[libvirt] [PATCH 0/2] Support the QED disk image format

2010-11-17 Thread Adam Litke
Qemu is about to gain support for a new disk image format: QED.  Details on
this format (including specification) can be found here:
http://wiki.qemu.org/Features/QED.  This short series of patches allows QED
images to be used with libvirt.

Adam Litke (2):
  QED: Basic support for QED images
  Support for probing qed image metadata

 src/util/storage_file.c |   85 ++-
 src/util/storage_file.h |1 +
 2 files changed, 85 insertions(+), 1 deletions(-)

-- 
1.7.3.2.164.g6f10c

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


[libvirt] [PATCH 2/2] Support for probing qed image metadata

2010-11-17 Thread Adam Litke
Implement getBackingStore() for QED images.  The header format is defined in
the QED spec: http://wiki.qemu.org/Features/QED .

Signed-off-by: Adam Litke a...@us.ibm.com
Cc: Stefan Hajnoczi stefan.hajno...@uk.ibm.com
Cc: Anthony Liguori aligu...@linux.vnet.ibm.com
---
 src/util/storage_file.c |   78 ++-
 1 files changed, 77 insertions(+), 1 deletions(-)

diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index 6e099ed..51ee0c8 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -89,6 +89,8 @@ static int qcow2GetBackingStore(char **, int *,
 const unsigned char *, size_t);
 static int vmdk4GetBackingStore(char **, int *,
 const unsigned char *, size_t);
+static int
+qedGetBackingStore(char **, int *, const unsigned char *, size_t);
 
 #define QCOWX_HDR_VERSION (4)
 #define QCOWX_HDR_BACKING_FILE_OFFSET (QCOWX_HDR_VERSION+4)
@@ -105,6 +107,11 @@ static int vmdk4GetBackingStore(char **, int *,
 #define QCOW2_HDR_EXTENSION_BACKING_FORMAT 0xE2792ACA
 
 #define QED_HDR_IMAGE_SIZE 40
+#define QED_HDR_FEATURES_OFFSET 16
+#define QED_HDR_BACKING_FILE_OFFSET 56
+#define QED_HDR_BACKING_FILE_SIZE 60
+#define QED_F_BACKING_FILE 0x01
+#define QED_F_BACKING_FORMAT_NO_PROBE 0x04
 
 /* VMDK needs at least this to find backing store,
  * other formats need less */
@@ -156,7 +163,7 @@ static struct FileTypeInfo const fileTypeInfo[] = {
 [VIR_STORAGE_FILE_QED] = {
 QED\0, NULL,
 LV_LITTLE_ENDIAN, -1, -1,
-QED_HDR_IMAGE_SIZE, 8, 1, -1, NULL,
+QED_HDR_IMAGE_SIZE, 8, 1, -1, qedGetBackingStore,
 },
 [VIR_STORAGE_FILE_VMDK] = {
 KDMV, NULL,
@@ -416,6 +423,75 @@ cleanup:
 return ret;
 }
 
+static unsigned long
+qedGetHeaderUL(const unsigned char *loc)
+{
+return ( ((unsigned long)loc[3]  24)
+   | ((unsigned long)loc[2]  16)
+   | ((unsigned long)loc[1]  8)
+   | ((unsigned long)loc[0]  0));
+}
+
+static unsigned long long
+qedGetHeaderULL(const unsigned char *loc)
+{
+return ( ((unsigned long)loc[7]  56)
+   | ((unsigned long)loc[6]  48)
+   | ((unsigned long)loc[5]  40)
+   | ((unsigned long)loc[4]  32)
+   | ((unsigned long)loc[3]  24)
+   | ((unsigned long)loc[2]  16)
+   | ((unsigned long)loc[1]  8)
+   | ((unsigned long)loc[0]  0));
+}
+
+static int
+qedGetBackingStore(char **res,
+   int *format,
+   const unsigned char *buf,
+   size_t buf_size)
+{
+unsigned long long flags;
+unsigned long offset, size;
+
+*res = NULL;
+/* Check if this image has a backing file */
+if (buf_size  QED_HDR_FEATURES_OFFSET+8)
+return BACKING_STORE_INVALID;
+flags = qedGetHeaderULL(buf + QED_HDR_FEATURES_OFFSET);
+if (!(flags  QED_F_BACKING_FILE))
+return BACKING_STORE_OK;
+
+/* Parse the backing file */
+if (buf_size  QED_HDR_BACKING_FILE_OFFSET+8)
+return BACKING_STORE_INVALID;
+offset = qedGetHeaderUL(buf + QED_HDR_BACKING_FILE_OFFSET);
+if (offset  buf_size)
+return BACKING_STORE_INVALID;
+size = qedGetHeaderUL(buf + QED_HDR_BACKING_FILE_SIZE);
+if (size == 0)
+return BACKING_STORE_OK;
+if (offset + size  buf_size || offset + size  offset)
+return BACKING_STORE_INVALID;
+if (size + 1 == 0)
+return BACKING_STORE_INVALID;
+if (VIR_ALLOC_N(*res, size + 1)  0) {
+virReportOOMError();
+return BACKING_STORE_ERROR;
+}
+memcpy(*res, buf + offset, size);
+(*res)[size] = '\0';
+
+if (format) {
+if (flags  QED_F_BACKING_FORMAT_NO_PROBE)
+*format = virStorageFileFormatTypeFromString(raw);
+else
+*format = VIR_STORAGE_FILE_AUTO;
+}
+
+return BACKING_STORE_OK;
+}
+
 /**
  * Return an absolute path corresponding to PATH, which is absolute or relative
  * to the directory containing BASE_FILE, or NULL on error
-- 
1.7.3.2.164.g6f10c

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


[libvirt] [PATCH] virt-aa-helper: Fix several compile errors

2010-11-17 Thread Matthias Bolte
Include locale.h for setlocale().

Revert the usage string back to it's original form.

Use puts() instead of fputs(), as fputs() expects a FILE*.

Add closing parenthesis to some vah_error() calls.

Use argv[0] instead of an undefined argv0.
---
 src/security/virt-aa-helper.c |   39 ---
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 12adbbb..41bc598 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -26,6 +26,7 @@
 #include getopt.h
 #include stdbool.h
 #include sys/utsname.h
+#include locale.h
 
 #include internal.h
 #include buf.h
@@ -84,21 +85,21 @@ vahDeinit(vahControl * ctl)
 static void
 vah_usage(void)
 {
-fprintf(stdout, _(\n%s [options] [ def.xml]\n\n
-  Options:\n
--a | --add load profile\n
--c | --create  create profile from template\n
--D | --delete  unload and delete profile\n
--f | --add-file file add file to profile\n
--F | --append-file file  append file to profile\n
--r | --replace reload profile\n
--R | --remove  unload profile\n
--h | --helpthis help\n
--u | --uuid uuid uuid (profile name)\n
-\n, progname);
-
-fputs(_(This command is intended to be used by libvirtd 
-and not used directly.\n));
+printf(_(\n%s [options] [ def.xml]\n\n
+  Options:\n
+-a | --add load profile\n
+-c | --create  create profile from template\n
+-D | --delete  unload and delete profile\n
+-f | --add-file file add file to profile\n
+-F | --append-file file  append file to profile\n
+-r | --replace reload profile\n
+-R | --remove  unload profile\n
+-h | --helpthis help\n
+-u | --uuid uuid uuid (profile name)\n
+\n), progname);
+
+puts(_(This command is intended to be used by libvirtd 
+   and not used directly.\n));
 return;
 }
 
@@ -289,7 +290,7 @@ update_include_file(const char *include_file, const char 
*included_files,
 }
 
 if (VIR_CLOSE(fd) != 0) {
-vah_error(NULL, 0, _(failed to close or write to profile)_;
+vah_error(NULL, 0, _(failed to close or write to profile));
 goto clean;
 }
 rc = 0;
@@ -396,7 +397,7 @@ create_profile(const char *profile, const char 
*profile_name,
 }
 
 if (VIR_CLOSE(fd) != 0) {
-vah_error(NULL, 0, _(failed to close or write to profile)_;
+vah_error(NULL, 0, _(failed to close or write to profile));
 goto clean_all;
 }
 rc = 0;
@@ -1061,7 +1062,7 @@ vahParseArgv(vahControl * ctl, int argc, char **argv)
 case 'f':
 case 'F':
 if ((ctl-newfile = strdup(optarg)) == NULL)
-vah_error(ctl, 1, _(could not allocate memory for disk)_;
+vah_error(ctl, 1, _(could not allocate memory for disk));
 ctl-append = arg == 'F';
 break;
 case 'h':
@@ -1140,7 +1141,7 @@ main(int argc, char **argv)
 if (setlocale(LC_ALL, ) == NULL ||
 bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
 textdomain(PACKAGE) == NULL) {
-fprintf(stderr, _(%s: initialization failed\n), argv0);
+fprintf(stderr, _(%s: initialization failed\n), argv[0]);
 exit(EXIT_FAILURE);
 }
 
-- 
1.7.0.4

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


Re: [libvirt] [PATCH] virt-aa-helper: Fix several compile errors

2010-11-17 Thread Eric Blake
On 11/17/2010 01:39 PM, Matthias Bolte wrote:
 Include locale.h for setlocale().
 
 Revert the usage string back to it's original form.
 
 Use puts() instead of fputs(), as fputs() expects a FILE*.
 
 Add closing parenthesis to some vah_error() calls.
 
 Use argv[0] instead of an undefined argv0.
 ---
  src/security/virt-aa-helper.c |   39 ---
  1 files changed, 20 insertions(+), 19 deletions(-)

ACK.  And that's what I get for passing 'make syntax-check' on Fedora,
but not testing on ubuntu before actually pushing.  :(

Sorry, and I'll go crawl back in my hole now.  ;)

  {
 -fprintf(stdout, _(\n%s [options] [ def.xml]\n\n
 -  Options:\n
 --a | --add load profile\n

This would have worked if I'd used line continuations (in fact, that's
what coreutils does, to get a good feel for where the 80 column boundary is:

  fprintf(stdout, _(\
...\n\
...\n\
, ...);

but those missing \ got me.

 +printf(_(\n%s [options] [ def.xml]\n\n
 +  Options:\n
 +-a | --add load profile\n

But this approach works as well.

 @@ -289,7 +290,7 @@ update_include_file(const char *include_file, const char 
 *included_files,
  }
  
  if (VIR_CLOSE(fd) != 0) {
 -vah_error(NULL, 0, _(failed to close or write to profile)_;
 +vah_error(NULL, 0, _(failed to close or write to profile));

I can't touch type very well, can I; my only excuse is that ) and _ are
neighbors.

 @@ -1140,7 +1141,7 @@ main(int argc, char **argv)
  if (setlocale(LC_ALL, ) == NULL ||
  bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
  textdomain(PACKAGE) == NULL) {
 -fprintf(stderr, _(%s: initialization failed\n), argv0);
 +fprintf(stderr, _(%s: initialization failed\n), argv[0]);

copy-and-paste bytes again. :(

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] virt-aa-helper: Fix several compile errors

2010-11-17 Thread Matthias Bolte
2010/11/17 Eric Blake ebl...@redhat.com:
 On 11/17/2010 01:39 PM, Matthias Bolte wrote:
 Include locale.h for setlocale().

 Revert the usage string back to it's original form.

 Use puts() instead of fputs(), as fputs() expects a FILE*.

 Add closing parenthesis to some vah_error() calls.

 Use argv[0] instead of an undefined argv0.
 ---
  src/security/virt-aa-helper.c |   39 ---
  1 files changed, 20 insertions(+), 19 deletions(-)

 ACK.  And that's what I get for passing 'make syntax-check' on Fedora,
 but not testing on ubuntu before actually pushing.  :(

 Sorry, and I'll go crawl back in my hole now.  ;)


No problem :) Pushed it now.

Matthias

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

Re: [libvirt] VMware Workstation/Player support

2010-11-17 Thread Matthias Bolte
2010/11/15 Jean-Baptiste Rouault jean-baptiste.roua...@diateam.net:
 On Sunday 14 November 2010 23:11:22 Matthias Bolte wrote:
 2010/11/12 Jean-Baptiste Rouault jean-baptiste.roua...@diateam.net:
  On Tuesday 27 July 2010 20:42:01 Matthias Bolte wrote:
  We'll need to move the VMX handling code from src/esx to src/util,
  because drivers are not allowed to depend on each other.
 
  That should be possible, but will require some refactoring, because
  this code is currently closely entangled with the reset of the ESX
  driver in some places and parts of it are probably quite ESX specific.
 
  Hi,
 
  As of today we have a proof of concept vmware driver with
  basic functions implemented (open/close, define/undefine, create,
  start/shutdown...)
  However it currently depends on the esx driver for the VMX handling code.
  Has anyone started to think of the needed refactoring ? If any help is
  needed to refactor I guess I could find some time to work on it.
 
  Jean-Baptiste

 A while ago I started to refactor some obviously ESX specific stuff
 out of the VMX code into a callback mechanism.

 One thing I'm going to change is the product version handling.

 There should be no major problem left in the VMX code that could stop
 it from being moved to src/util/.

 As you say you have some basic stuff working now, maybe it's a good
 idea that you show you code here for an initial review and let me do
 the refactoring once I can see how you use the VMX code.

 Matthias

 Here is the patch, I can try to split it if it's easier for the review.
 The major part of this patch was done by an old colleague of mine,
 there is still work and a bit of cleaning to do.

 Regards,

 Jean-Baptiste


 diff --git a/configure.ac b/configure.ac
 index d21d558..90b3181 100644
 --- a/configure.ac
 +++ b/configure.ac
 @@ -227,6 +227,8 @@ AC_ARG_WITH([uml],
AC_HELP_STRING([--with-uml], [add UML support 
 @:@default=check@:@]),[],[with_uml=check])
  AC_ARG_WITH([openvz],
AC_HELP_STRING([--with-openvz], [add OpenVZ support 
 @:@default=yes@:@]),[],[with_openvz=yes])
 +AC_ARG_WITH([vmware],
 +  AC_HELP_STRING([--with-vmware], [add VMware support 
 @:@default=yes@:@]),[],[with_wmware=yes])

Typo here, with_wmware=yes should be with_vmware=yes

  AC_ARG_WITH([libssh2],
AC_HELP_STRING([--with-libssh2=@:@PFX@:@], [libssh2 location 
 @:@default=/usr/local/lib@:@]),[],[with_libssh2=yes])
  AC_ARG_WITH([phyp],
 @@ -316,6 +318,10 @@ if test $with_openvz = yes; then
  fi
  AM_CONDITIONAL([WITH_OPENVZ], [test $with_openvz = yes])

 +if test $with_vmware = yes; then
 +AC_DEFINE_UNQUOTED([WITH_VMWARE], 1, [whether VMware driver is enabled])
 +fi
 +AM_CONDITIONAL([WITH_VMWARE], [test $with_vmware = yes])

  dnl
  dnl check for XDR
 @@ -2274,6 +2280,7 @@ AC_MSG_NOTICE([ Xen: $with_xen])
  AC_MSG_NOTICE([QEMU: $with_qemu])
  AC_MSG_NOTICE([ UML: $with_uml])
  AC_MSG_NOTICE([  OpenVZ: $with_openvz])
 +AC_MSG_NOTICE([  VMware: $with_vmware])
  AC_MSG_NOTICE([VBox: $with_vbox])
  AC_MSG_NOTICE([  XenAPI: $with_xenapi])
  AC_MSG_NOTICE([ LXC: $with_lxc])

IMHO VMware as name for this driver is too generic, but I don't have
a better alternative, so we'll probably just stick with it.

 diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
 index eaeb477..de05d0f 100644
 --- a/include/libvirt/virterror.h
 +++ b/include/libvirt/virterror.h
 @@ -52,6 +52,7 @@ typedef enum {
  VIR_FROM_TEST,   /* Error from test driver */
  VIR_FROM_REMOTE, /* Error from remote driver */
  VIR_FROM_OPENVZ,/* Error from OpenVZ driver */
 +VIR_FROM_VMWARE,/* Error from Vmware driver */

s/Vmware/VMware/

 diff --git a/src/libvirt.c b/src/libvirt.c
 index 3c8bf30..6bf490a 100644
 --- a/src/libvirt.c
 +++ b/src/libvirt.c

 @@ -364,6 +367,12 @@ virInitialize(void)
  # ifdef WITH_OPENVZ
  virDriverLoadModule(openvz);
  # endif
 +# ifdef WITH_VMWARE
 +virDriverLoadModule(vmware);
 +# endif
 +# ifdef WITH_VMWARE
 +virDriverLoadModule(vmware);
 +# endif

One call to virDriverLoadModule for each driver is enough.

 diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
 new file mode 100644
 index 000..4036d9b
 --- /dev/null
 +++ b/src/vmware/vmware_conf.c
 @@ -0,0 +1,447 @@
 +/*---*/
 +/* Copyright 2010, diateam (www.diateam.net)
 + *
 + * This library is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU Lesser General Public
 + * License as published by the Free Software Foundation; either
 + * version 2.1 of the License, or (at your option) any later version.
 + *
 + * This library is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * Lesser General Public License for more details.
 + *
 + * You should have received a copy of the GNU 

Re: [libvirt] VMware Workstation/Player support

2010-11-17 Thread Eric Blake
On 11/17/2010 03:32 PM, Matthias Bolte wrote:
 +
 +#include config.h
 +
 +#include sys/utsname.h
 
 So this driver is going to be Linux-only. Any intention to make it
 work on Windows too?

gnulib provides sys/utsname.h for mingw

 +uname(utsname);
 +
 +if ((caps = virCapabilitiesNew(utsname.machine, 0, 0)) == NULL)
 +goto no_memory;
 +
 +if (nodeCapsInitNUMA(caps)  0)
 +goto no_memory;
 +
 +virCapabilitiesSetMacPrefix(caps, (unsigned char[]) {
 +0x52, 0x54, 0x00});
 +
 +if ((guest = virCapabilitiesAddGuest(caps,
 + hvm,
 + utsname.machine,
 + sizeof(int) == 4 ? 32 : 8,
 
 I don't think that you can use utsname.machine to determine the
 supported architectures, as you can install and run a 32bit VMware
 Player/Workstation on a 64bit system and only use 32bit guests. Or am
 I wrong here?

However, you are entirely correct that using uname() as the deciding
factor is wrong.  The autoconf rule is feature-tests, not version tests
(and uname() is the most hard-coded of version test out there).

 Also fclose(fp) is missing and we are currently deprecating fclose in
 libvirt, use the VIR_FCLOSE macro instead.

I still need to get around to patching cfg.mk to automate 'make
syntax-check' in enforcing that.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] rbd storage pool support for libvirt

2010-11-17 Thread Josh Durgin

Hi Daniel,

On 11/08/2010 05:16 AM, Daniel P. Berrange wrote:

In any case, before someone goes off and implements something, does this
look like the right general approach to adding rbd support to libvirt?


I think this looks reasonable. I'd be inclined to get the storage pool
stuff working with the kernel RBD driver  UDEV rules for stable path
names, since that avoids needing to make any changes to guest XML
format. Support for QEMU with the native librados CEPH driver could
be added as a second patch.


Okay, that sounds reasonable.  Supporting the QEMU librados driver is
definitely something we want to target, though, and seems to be route that
more users are interested in.  Is defining the XML syntax for a guest VM
something we can discuss now as well?

(BTW this is biting NBD users too.  Presumably the guest VM XML should
look similar?


And also Sheepdog storage volumes. To define a syntax for all these we need
to determine what configuration metadata is required at a per-VM level for
each of them. Then try and decide how to represent that in the guest XML.
It looks like at a VM level we'd need a hostname, port number and a volume
name (or path).


It looks like that's what Sheepdog needs from the patch that was
submitted earlier today. For RBD, we would want to allow multiple hosts,
and specify the pool and image name when the QEMU librados driver is
used, e.g.:

disk type=rbd device=disk
  driver name=qemu type=raw /
  source vdi=image_name pool=pool_name
host name=mon1.example.org port=6000
host name=mon2.example.org port=6000
host name=mon3.example.org port=6000
  /source
  target dev=vda bus=virtio /
/disk

As you mentioned earlier, we could just use the existing source format
for the kernel RBD driver.

Does this seem like a reasonable format for the VM XML? Any suggestions?

Thanks,
Josh

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


Re: [libvirt] rbd storage pool support for libvirt

2010-11-17 Thread Josh Durgin

On 11/17/2010 04:33 PM, Josh Durgin wrote:

Hi Daniel,

On 11/08/2010 05:16 AM, Daniel P. Berrange wrote:

In any case, before someone goes off and implements something, does
this
look like the right general approach to adding rbd support to libvirt?


I think this looks reasonable. I'd be inclined to get the storage pool
stuff working with the kernel RBD driver UDEV rules for stable path
names, since that avoids needing to make any changes to guest XML
format. Support for QEMU with the native librados CEPH driver could
be added as a second patch.


Okay, that sounds reasonable. Supporting the QEMU librados driver is
definitely something we want to target, though, and seems to be route
that
more users are interested in. Is defining the XML syntax for a guest VM
something we can discuss now as well?

(BTW this is biting NBD users too. Presumably the guest VM XML should
look similar?


And also Sheepdog storage volumes. To define a syntax for all these we
need
to determine what configuration metadata is required at a per-VM level
for
each of them. Then try and decide how to represent that in the guest XML.
It looks like at a VM level we'd need a hostname, port number and a
volume
name (or path).


It looks like that's what Sheepdog needs from the patch that was
submitted earlier today. For RBD, we would want to allow multiple hosts,
and specify the pool and image name when the QEMU librados driver is
used, e.g.:

disk type=rbd device=disk
driver name=qemu type=raw /
source vdi=image_name pool=pool_name
host name=mon1.example.org port=6000
host name=mon2.example.org port=6000
host name=mon3.example.org port=6000
/source
target dev=vda bus=virtio /
/disk

As you mentioned earlier, we could just use the existing source format
for the kernel RBD driver.

Does this seem like a reasonable format for the VM XML? Any suggestions?


Also, it would be convenient to be able to specify which RBD driver to 
use in the guest XML, so that it's independent of the libvirt pool 
configuration. Would having two different rbd disk types be the right 
approach here?


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


[libvirt] [PATCH 00/10] virCommand

2010-11-17 Thread Eric Blake
This revives a couple of patch series from the past, and
rebases them on top of the current tree.  I've tested
that the daemon hook on SIGHUP works with this rewrite,
so I'm fairly confident that it is in decent shape, but
there's still a lot more to do for both converting
VIR_REALLOC_N to newer VIR_EXPAND_N or VIR_RESIZE_N, as
well as converting virExec uses to virCommand.

I wanted to get this posted for first reviews while I
continue porting more instances.

Daniel P. Berrange (5):
  Fix bug in setting up child stderr/out with /dev/null
  Remove bogus includes
  Introduce new APIs for spawning processes
  virCommand: docs for usage of new command APIs
  Port hooks and iptables code to new command execution APIs

Eric Blake (5):
  memory: make it safer to expand arrays
  memory: make it easier to avoid quadratic scaling of arrays
  daemon: use safer memory growth macros
  capabilities, cpu: use new array API
  maint: tighten strncmp syntax check

 .x-sc_avoid_write |1 +
 .x-sc_prohibit_strcmp_and_strncmp |9 -
 .x-sc_prohibit_strncmp|1 +
 HACKING   |   59 ++-
 Makefile.am   |2 +-
 cfg.mk|   15 +-
 daemon/event.c|   44 +-
 daemon/libvirtd.c |8 +-
 daemon/libvirtd.h |   11 +-
 docs/Makefile.am  |   11 +-
 docs/hacking.html.in  |   64 ++-
 docs/internals.html.in|9 +
 docs/internals/command.html.in|  491 +++
 docs/sitemap.html.in  |4 +
 docs/subsite.xsl  |   25 +
 po/POTFILES.in|1 +
 src/Makefile.am   |1 +
 src/conf/capabilities.c   |   37 +-
 src/conf/capabilities.h   |   20 +-
 src/conf/cpu_conf.c   |7 +-
 src/conf/cpu_conf.h   |5 +-
 src/conf/domain_conf.c|1 -
 src/libvirt_private.syms  |   32 ++
 src/util/command.c|  960 +
 src/util/command.h|  213 
 src/util/hooks.c  |  217 +
 src/util/iptables.c   |   73 +---
 src/util/memory.c |   94 -
 src/util/memory.h |   77 +++-
 src/util/util.c   |2 +-
 tests/.gitignore  |4 +
 tests/Makefile.am |   18 +-
 tests/commanddata/test10.log  |   14 +
 tests/commanddata/test11.log  |   14 +
 tests/commanddata/test12.log  |   12 +
 tests/commanddata/test13.log  |   12 +
 tests/commanddata/test14.log  |   12 +
 tests/commanddata/test15.log  |   12 +
 tests/commanddata/test2.log   |   12 +
 tests/commanddata/test3.log   |   14 +
 tests/commanddata/test4.log   |   12 +
 tests/commanddata/test5.log   |   10 +
 tests/commanddata/test6.log   |6 +
 tests/commanddata/test7.log   |   11 +
 tests/commanddata/test8.log   |7 +
 tests/commanddata/test9.log   |   18 +
 tests/commandhelper.c |  136 ++
 tests/commandtest.c   |  572 ++
 tests/testutilsqemu.c |1 +
 49 files changed, 3009 insertions(+), 382 deletions(-)
 delete mode 100644 .x-sc_prohibit_strcmp_and_strncmp
 create mode 100644 .x-sc_prohibit_strncmp
 create mode 100644 docs/internals/command.html.in
 create mode 100644 docs/subsite.xsl
 create mode 100644 src/util/command.c
 create mode 100644 src/util/command.h
 create mode 100644 tests/commanddata/test10.log
 create mode 100644 tests/commanddata/test11.log
 create mode 100644 tests/commanddata/test12.log
 create mode 100644 tests/commanddata/test13.log
 create mode 100644 tests/commanddata/test14.log
 create mode 100644 tests/commanddata/test15.log
 create mode 100644 tests/commanddata/test2.log
 create mode 100644 tests/commanddata/test3.log
 create mode 100644 tests/commanddata/test4.log
 create mode 100644 tests/commanddata/test5.log
 create mode 100644 tests/commanddata/test6.log
 create mode 100644 tests/commanddata/test7.log
 create mode 100644 tests/commanddata/test8.log
 create mode 100644 tests/commanddata/test9.log
 create mode 100644 tests/commandhelper.c
 create mode 100644 tests/commandtest.c

-- 
1.7.3.2

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


[libvirt] [PATCH 04/10] capabilities, cpu: use new array API

2010-11-17 Thread Eric Blake
* src/conf/capabilities.h (_virCaps, _virCapsHost, _virCapsGuest)
(_virCapsGuestArch): Add additional fields.
* src/conf/cpu_conf.h (_virCPUDef): Likewise.
* src/conf/capabilities.c (virCapabilitiesFormatXML): Reflect
updated type.
(virCapabilitiesAddGuest, virCapabilitiesAddHostFeature)
(virCapabilitiesAddHostMigrateTransport)
(virCapabilitiesAddHostNUMACell, virCapabilitiesAddGuestFeature)
(virCapabilitiesAddGuestDomain): Use new array APIs.
* src/conf/cpu_conf.c (virCPUDefAddFeature, virCPUDefCopy)
(virCPUDefParseXML): Likewise.
* tests/testutilsqemu.c (testQemuCapsInit): Adjust test.
---
 src/conf/capabilities.c |   37 +
 src/conf/capabilities.h |   20 +---
 src/conf/cpu_conf.c |7 +--
 src/conf/cpu_conf.h |5 +++--
 tests/testutilsqemu.c   |1 +
 5 files changed, 39 insertions(+), 31 deletions(-)

diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index 4478d85..99d5a56 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -1,7 +1,7 @@
 /*
  * capabilities.c: hypervisor capabilities
  *
- * Copyright (C) 2006-2008 Red Hat, Inc.
+ * Copyright (C) 2006-2008, 2010 Red Hat, Inc.
  * Copyright (C) 2006-2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -190,8 +190,8 @@ int
 virCapabilitiesAddHostFeature(virCapsPtr caps,
   const char *name)
 {
-if (VIR_REALLOC_N(caps-host.features,
-  caps-host.nfeatures + 1)  0)
+if (VIR_RESIZE_N(caps-host.features, caps-host.nfeatures_max,
+ caps-host.nfeatures, 1)  0)
 return -1;

 if ((caps-host.features[caps-host.nfeatures] = strdup(name)) == NULL)
@@ -213,8 +213,8 @@ int
 virCapabilitiesAddHostMigrateTransport(virCapsPtr caps,
const char *name)
 {
-if (VIR_REALLOC_N(caps-host.migrateTrans,
-  caps-host.nmigrateTrans + 1)  0)
+if (VIR_RESIZE_N(caps-host.migrateTrans, caps-host.nmigrateTrans_max,
+ caps-host.nmigrateTrans, 1)  0)
 return -1;

 if ((caps-host.migrateTrans[caps-host.nmigrateTrans] = strdup(name)) == 
NULL)
@@ -243,8 +243,8 @@ virCapabilitiesAddHostNUMACell(virCapsPtr caps,
 {
 virCapsHostNUMACellPtr cell;

-if (VIR_REALLOC_N(caps-host.numaCell,
-  caps-host.nnumaCell + 1)  0)
+if (VIR_RESIZE_N(caps-host.numaCell, caps-host.nnumaCell_max,
+ caps-host.nnumaCell, 1)  0)
 return -1;

 if (VIR_ALLOC(cell)  0)
@@ -261,8 +261,7 @@ virCapabilitiesAddHostNUMACell(virCapsPtr caps,
 cell-ncpus = ncpus;
 cell-num = num;

-caps-host.numaCell[caps-host.nnumaCell] = cell;
-caps-host.nnumaCell++;
+caps-host.numaCell[caps-host.nnumaCell++] = cell;

 return 0;
 }
@@ -380,11 +379,10 @@ virCapabilitiesAddGuest(virCapsPtr caps,
 (guest-arch.defaultInfo.loader = strdup(loader)) == NULL)
 goto no_memory;

-if (VIR_REALLOC_N(caps-guests,
-  caps-nguests + 1)  0)
+if (VIR_RESIZE_N(caps-guests, caps-nguests_max,
+ caps-nguests, 1)  0)
 goto no_memory;
-caps-guests[caps-nguests] = guest;
-caps-nguests++;
+caps-guests[caps-nguests++] = guest;

 if (nmachines) {
 guest-arch.defaultInfo.nmachines = nmachines;
@@ -434,8 +432,8 @@ virCapabilitiesAddGuestDomain(virCapsGuestPtr guest,
 (dom-info.loader = strdup(loader)) == NULL)
 goto no_memory;

-if (VIR_REALLOC_N(guest-arch.domains,
-  guest-arch.ndomains + 1)  0)
+if (VIR_RESIZE_N(guest-arch.domains, guest-arch.ndomains_max,
+ guest-arch.ndomains, 1)  0)
 goto no_memory;
 guest-arch.domains[guest-arch.ndomains] = dom;
 guest-arch.ndomains++;
@@ -478,11 +476,10 @@ virCapabilitiesAddGuestFeature(virCapsGuestPtr guest,
 feature-defaultOn = defaultOn;
 feature-toggle = toggle;

-if (VIR_REALLOC_N(guest-features,
-  guest-nfeatures + 1)  0)
+if (VIR_RESIZE_N(guest-features, guest-nfeatures_max,
+ guest-nfeatures, 1)  0)
 goto no_memory;
-guest-features[guest-nfeatures] = feature;
-guest-nfeatures++;
+guest-features[guest-nfeatures++] = feature;

 return feature;

@@ -706,7 +703,7 @@ virCapabilitiesFormatXML(virCapsPtr caps)

 if (caps-host.nnumaCell) {
 virBufferAddLit(xml, topology\n);
-virBufferVSprintf(xml,   cells num='%d'\n,
+virBufferVSprintf(xml,   cells num='%zu'\n,
   caps-host.nnumaCell);
 for (i = 0 ; i  caps-host.nnumaCell ; i++) {
 virBufferVSprintf(xml, cell id='%d'\n,
diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h
index f41be1c..759265d 100644
--- a/src/conf/capabilities.h
+++ b/src/conf/capabilities.h
@@ -1,7 +1,7 @@
 /*
  * capabilities.h: hypervisor 

[libvirt] [PATCH 03/10] daemon: use safer memory growth macros

2010-11-17 Thread Eric Blake
* daemon/libvirtd.h (qemud_server): Change types of members
tracking array sizes, and add allocation trackers.
* daemon/event.c (virEventLoop): Likewise.
(virEventAddHandleImpl, virEventAddTimeoutImpl)
(virEventCleanupTimeouts, virEventCleanupHandles): Use
VIR_RESIZE_N instead of VIR_REALLOC_N.  Tweak debug messages to
match type changes.
* daemon/libvirtd.c (qemudDispatchServer, qemudRunLoop): Likewise.
---
 daemon/event.c|   44 +++-
 daemon/libvirtd.c |8 +++-
 daemon/libvirtd.h |   11 ++-
 3 files changed, 28 insertions(+), 35 deletions(-)

diff --git a/daemon/event.c b/daemon/event.c
index 06f9aad..a983b35 100644
--- a/daemon/event.c
+++ b/daemon/event.c
@@ -73,11 +73,11 @@ struct virEventLoop {
 int running;
 virThread leader;
 int wakeupfd[2];
-int handlesCount;
-int handlesAlloc;
+size_t handlesCount;
+size_t handlesAlloc;
 struct virEventHandle *handles;
-int timeoutsCount;
-int timeoutsAlloc;
+size_t timeoutsCount;
+size_t timeoutsAlloc;
 struct virEventTimeout *timeouts;
 };

@@ -103,14 +103,13 @@ int virEventAddHandleImpl(int fd, int events,
 EVENT_DEBUG(Add handle fd=%d events=%d cb=%p opaque=%p, fd, events, cb, 
opaque);
 virMutexLock(eventLoop.lock);
 if (eventLoop.handlesCount == eventLoop.handlesAlloc) {
-EVENT_DEBUG(Used %d handle slots, adding %d more,
+EVENT_DEBUG(Used %zu handle slots, adding at least %d more,
 eventLoop.handlesAlloc, EVENT_ALLOC_EXTENT);
-if (VIR_REALLOC_N(eventLoop.handles,
-  (eventLoop.handlesAlloc + EVENT_ALLOC_EXTENT))  0) {
+if (VIR_RESIZE_N(eventLoop.handles, eventLoop.handlesAlloc,
+ eventLoop.handlesCount, EVENT_ALLOC_EXTENT)  0) {
 virMutexUnlock(eventLoop.lock);
 return -1;
 }
-eventLoop.handlesAlloc += EVENT_ALLOC_EXTENT;
 }

 watch = nextWatch++;
@@ -204,14 +203,13 @@ int virEventAddTimeoutImpl(int frequency,

 virMutexLock(eventLoop.lock);
 if (eventLoop.timeoutsCount == eventLoop.timeoutsAlloc) {
-EVENT_DEBUG(Used %d timeout slots, adding %d more,
+EVENT_DEBUG(Used %zu timeout slots, adding at least %d more,
 eventLoop.timeoutsAlloc, EVENT_ALLOC_EXTENT);
-if (VIR_REALLOC_N(eventLoop.timeouts,
-  (eventLoop.timeoutsAlloc + EVENT_ALLOC_EXTENT))  0) 
{
+if (VIR_RESIZE_N(eventLoop.timeouts, eventLoop.timeoutsAlloc,
+ eventLoop.timeoutsCount, EVENT_ALLOC_EXTENT)  0) {
 virMutexUnlock(eventLoop.lock);
 return -1;
 }
-eventLoop.timeoutsAlloc += EVENT_ALLOC_EXTENT;
 }

 eventLoop.timeouts[eventLoop.timeoutsCount].timer = nextTimer++;
@@ -301,7 +299,7 @@ int virEventRemoveTimeoutImpl(int timer) {
 static int virEventCalculateTimeout(int *timeout) {
 unsigned long long then = 0;
 int i;
-EVENT_DEBUG(Calculate expiry of %d timers, eventLoop.timeoutsCount);
+EVENT_DEBUG(Calculate expiry of %zu timers, eventLoop.timeoutsCount);
 /* Figure out if we need a timeout */
 for (i = 0 ; i  eventLoop.timeoutsCount ; i++) {
 if (eventLoop.timeouts[i].frequency  0)
@@ -482,7 +480,7 @@ static int virEventDispatchHandles(int nfds, struct pollfd 
*fds) {
  */
 static int virEventCleanupTimeouts(void) {
 int i;
-DEBUG(Cleanup %d, eventLoop.timeoutsCount);
+DEBUG(Cleanup %zu, eventLoop.timeoutsCount);

 /* Remove deleted entries, shuffling down remaining
  * entries as needed to form contiguous series
@@ -507,12 +505,10 @@ static int virEventCleanupTimeouts(void) {

 /* Release some memory if we've got a big chunk free */
 if ((eventLoop.timeoutsAlloc - EVENT_ALLOC_EXTENT)  
eventLoop.timeoutsCount) {
-EVENT_DEBUG(Releasing %d out of %d timeout slots used, releasing %d,
+EVENT_DEBUG(Releasing %zu out of %zu timeout slots used, releasing 
%d,
eventLoop.timeoutsCount, eventLoop.timeoutsAlloc, 
EVENT_ALLOC_EXTENT);
-if (VIR_REALLOC_N(eventLoop.timeouts,
-  (eventLoop.timeoutsAlloc - EVENT_ALLOC_EXTENT))  0)
-return -1;
-eventLoop.timeoutsAlloc -= EVENT_ALLOC_EXTENT;
+VIR_SHRINK_N(eventLoop.timeouts, eventLoop.timeoutsAlloc,
+ EVENT_ALLOC_EXTENT);
 }
 return 0;
 }
@@ -523,7 +519,7 @@ static int virEventCleanupTimeouts(void) {
  */
 static int virEventCleanupHandles(void) {
 int i;
-DEBUG(Cleanupo %d, eventLoop.handlesCount);
+DEBUG(Cleanup %zu, eventLoop.handlesCount);

 /* Remove deleted entries, shuffling down remaining
  * entries as needed to form contiguous series
@@ -547,12 +543,10 @@ static int virEventCleanupHandles(void) {

 /* Release some memory if we've got a big chunk free */
 if ((eventLoop.handlesAlloc - EVENT_ALLOC_EXTENT)  

[libvirt] [PATCH 01/10] memory: make it safer to expand arrays

2010-11-17 Thread Eric Blake
* src/util/memory.h (VIR_REALLOC_N): Update docs.
(VIR_EXPAND_N, VIR_SHRINK_N): New macros.
(virAlloc, virAllocN, virReallocN, virAllocVar, virFree): Add some
gcc attributes.
* src/util/memory.c (virExpandN, virShrinkN): New functions.
(virReallocN): Update docs.
* docs/hacking.html.in: Prefer newer interfaces over
VIR_REALLOC_N, since uninitialized memory can bite us.
* HACKING: Regenerate.
* src/libvirt_private.syms: Export new helpers.
---
 HACKING  |   24 +++---
 docs/hacking.html.in |   25 +++---
 src/libvirt_private.syms |2 +
 src/util/memory.c|   59 +-
 src/util/memory.h|   51 +++
 5 files changed, 134 insertions(+), 27 deletions(-)

diff --git a/HACKING b/HACKING
index 17ad344..2b19fe4 100644
--- a/HACKING
+++ b/HACKING
@@ -280,9 +280,9 @@ Low level memory management
 Use of the malloc/free/realloc/calloc APIs is deprecated in the libvirt
 codebase, because they encourage a number of serious coding bugs and do not
 enable compile time verification of checks for NULL. Instead of these
-routines, use the macros from memory.h
+routines, use the macros from memory.h.

-- e.g. to allocate a single object:
+- To allocate a single object:

   virDomainPtr domain;

@@ -293,10 +293,10 @@ routines, use the macros from memory.h



-- e.g. to allocate an array of objects
+- To allocate an array of objects:

   virDomainPtr domains;
-  int ndomains = 10;
+  size_t ndomains = 10;

   if (VIR_ALLOC_N(domains, ndomains)  0) {
   virReportOOMError();
@@ -305,7 +305,7 @@ routines, use the macros from memory.h



-- e.g. to allocate an array of object pointers
+- To allocate an array of object pointers:

   virDomainPtr *domains;
   int ndomains = 10;
@@ -317,18 +317,22 @@ routines, use the macros from memory.h



-- e.g. to re-allocate the array of domains to be longer
-
-  ndomains = 20
+- To re-allocate the array of domains to be longer:

-  if (VIR_REALLOC_N(domains, ndomains)  0) {
+  if (VIR_EXPAND_N(domains, ndomains, 10)  0) {
   virReportOOMError();
   return NULL;
   }



-- e.g. to free the domain
+- To trim an array of domains to have one less element:
+
+  VIR_SHRINK_N(domains, ndomains, 1);
+
+
+
+- To free the domain:

   VIR_FREE(domain);

diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index e1b5185..ffe6aea 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -354,11 +354,12 @@
   Use of the malloc/free/realloc/calloc APIs is deprecated in the libvirt
   codebase, because they encourage a number of serious coding bugs and do
   not enable compile time verification of checks for NULL. Instead of these
-  routines, use the macros from memory.h
+  routines, use the macros from memory.h.
 /p

 ul
-  lipe.g. to allocate  a single object:/p
+  lipTo allocate a single object:/p
+
 pre
   virDomainPtr domain;

@@ -369,10 +370,10 @@
 /pre
   /li

-  lipe.g. to allocate an array of objects/p
+  lipTo allocate an array of objects:/p
 pre
   virDomainPtr domains;
-  int ndomains = 10;
+  size_t ndomains = 10;

   if (VIR_ALLOC_N(domains, ndomains) lt; 0) {
   virReportOOMError();
@@ -381,7 +382,7 @@
 /pre
   /li

-  lipe.g. to allocate an array of object pointers/p
+  lipTo allocate an array of object pointers:/p
 pre
   virDomainPtr *domains;
   int ndomains = 10;
@@ -393,18 +394,22 @@
 /pre
   /li

-  lipe.g. to re-allocate the array of domains to be longer/p
+  lipTo re-allocate the array of domains to be longer:/p
 pre
-  ndomains = 20
-
-  if (VIR_REALLOC_N(domains, ndomains) lt; 0) {
+  if (VIR_EXPAND_N(domains, ndomains, 10) lt; 0) {
   virReportOOMError();
   return NULL;
   }
 /pre
   /li

-  lipe.g. to free the domain/p
+  lipTo trim an array of domains to have one less element:/p
+
+pre
+  VIR_SHRINK_N(domains, ndomains, 1);
+/pre/li
+
+  lipTo free the domain:/p
 pre
   VIR_FREE(domain);
 /pre
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 50eceba..796559c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -503,8 +503,10 @@ virLogUnlock;
 # memory.h
 virAlloc;
 virAllocN;
+virExpandN;
 virFree;
 virReallocN;
+virShrinkN;


 # network.h
diff --git a/src/util/memory.c b/src/util/memory.c
index dd1216b..59685b3 100644
--- a/src/util/memory.c
+++ b/src/util/memory.c
@@ -1,6 +1,7 @@
 /*
  * memory.c: safer memory allocation
  *
+ * Copyright (C) 2010 Red Hat, Inc.
  * Copyright (C) 2008 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -24,6 +25,7 @@
 #include stddef.h

 #include memory.h
+#include ignore-value.h


 #if TEST_OOM
@@ -141,7 +143,7 @@ int virAllocN(void *ptrptr, size_t size, size_t count)
  * 'count' elements, each 'size' bytes in length. Update 'ptrptr'
  * with the address of the newly allocated memory. On failure,
  * 'ptrptr' is 

[libvirt] [PATCH 05/10] Fix bug in setting up child stderr/out with /dev/null

2010-11-17 Thread Eric Blake
From: Daniel P. Berrange berra...@redhat.com

---
 src/util/util.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util/util.c b/src/util/util.c
index 2d6485f..f2fe58a 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -463,7 +463,7 @@ __virExec(const char *const*argv,
 int childerr = -1;
 int tmpfd;

-if ((null = open(/dev/null, O_RDONLY))  0) {
+if ((null = open(/dev/null, O_RDWR))  0) {
 virReportSystemError(errno,
  _(cannot open %s),
  /dev/null);
-- 
1.7.3.2

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


[libvirt] [PATCH 02/10] memory: make it easier to avoid quadratic scaling of arrays

2010-11-17 Thread Eric Blake
* src/util/memory.h (VIR_RESIZE_N): New macro.
* src/util/memory.c (virResizeN): New function.
* docs/hacking.html.in: Document it.
* HACKING: Regenerate.
* src/libvirt_private.syms: Export new helper.
---
 HACKING  |   43 +
 docs/hacking.html.in |   47 -
 src/libvirt_private.syms |1 +
 src/util/memory.c|   35 ++
 src/util/memory.h|   26 +
 5 files changed, 141 insertions(+), 11 deletions(-)

diff --git a/HACKING b/HACKING
index 2b19fe4..e54af05 100644
--- a/HACKING
+++ b/HACKING
@@ -308,7 +308,7 @@ routines, use the macros from memory.h.
 - To allocate an array of object pointers:

   virDomainPtr *domains;
-  int ndomains = 10;
+  size_t ndomains = 10;

   if (VIR_ALLOC_N(domains, ndomains)  0) {
   virReportOOMError();
@@ -317,24 +317,57 @@ routines, use the macros from memory.h.



-- To re-allocate the array of domains to be longer:
+- To re-allocate the array of domains to be 1 element longer (however, note 
that
+repeatedly expanding an array by 1 scales quadratically, so this is
+recommended only for smaller arrays):
+
+  virDomainPtr domains;
+  size_t ndomains = 0;

-  if (VIR_EXPAND_N(domains, ndomains, 10)  0) {
+  if (VIR_EXPAND_N(domains, ndomains, 1)  0) {
   virReportOOMError();
   return NULL;
   }
+  domains[ndomains - 1] = domain;
+
+
+
+- To ensure an array has room to hold at least one more element (this approach
+scales better, but requires tracking allocation separately from usage)
+
+  virDomainPtr domains;
+  size_t ndomains = 0;
+  size_t ndomains_max = 0;
+
+  if (VIR_RESIZE_N(domains, ndomains_max, ndomains, 1)  0) {
+  virReportOOMError();
+  return NULL;
+  }
+  domains[ndomains++] = domain;



 - To trim an array of domains to have one less element:

+  virDomainPtr domains;
+  size_t ndomains = x;
+  size_t ndomains_max = y;
+
   VIR_SHRINK_N(domains, ndomains, 1);



-- To free the domain:
+- To free an array of domains:

-  VIR_FREE(domain);
+  virDomainPtr domains;
+  size_t ndomains = x;
+  size_t ndomains_max = y;
+  size_t i;
+
+  for (i = 0; i  ndomains; i++)
+  VIR_FREE(domains[i]);
+  VIR_FREE(domains)
+  ndomains_max = ndomains = 0;



diff --git a/docs/hacking.html.in b/docs/hacking.html.in
index ffe6aea..138a1ef 100644
--- a/docs/hacking.html.in
+++ b/docs/hacking.html.in
@@ -385,7 +385,7 @@
   lipTo allocate an array of object pointers:/p
 pre
   virDomainPtr *domains;
-  int ndomains = 10;
+  size_t ndomains = 10;

   if (VIR_ALLOC_N(domains, ndomains) lt; 0) {
   virReportOOMError();
@@ -394,26 +394,61 @@
 /pre
   /li

-  lipTo re-allocate the array of domains to be longer:/p
+  lipTo re-allocate the array of domains to be 1 element
+  longer (however, note that repeatedly expanding an array by 1
+  scales quadratically, so this is recommended only for smaller
+  arrays):/p
 pre
-  if (VIR_EXPAND_N(domains, ndomains, 10) lt; 0) {
+  virDomainPtr domains;
+  size_t ndomains = 0;
+
+  if (VIR_EXPAND_N(domains, ndomains, 1) lt; 0) {
   virReportOOMError();
   return NULL;
   }
+  domains[ndomains - 1] = domain;
+/pre/li
+
+  lipTo ensure an array has room to hold at least one more
+  element (this approach scales better, but requires tracking
+  allocation separately from usage)/p
+
+pre
+  virDomainPtr domains;
+  size_t ndomains = 0;
+  size_t ndomains_max = 0;
+
+  if (VIR_RESIZE_N(domains, ndomains_max, ndomains, 1) lt; 0) {
+  virReportOOMError();
+  return NULL;
+  }
+  domains[ndomains++] = domain;
 /pre
   /li

   lipTo trim an array of domains to have one less element:/p

 pre
+  virDomainPtr domains;
+  size_t ndomains = x;
+  size_t ndomains_max = y;
+
   VIR_SHRINK_N(domains, ndomains, 1);
 /pre/li

-  lipTo free the domain:/p
+  lipTo free an array of domains:/p
 pre
-  VIR_FREE(domain);
+  virDomainPtr domains;
+  size_t ndomains = x;
+  size_t ndomains_max = y;
+  size_t i;
+
+  for (i = 0; i lt; ndomains; i++)
+  VIR_FREE(domains[i]);
+  VIR_FREE(domains)
+  ndomains_max = ndomains = 0;
 /pre
-   /li
+  /li
 /ul

 h2a name=file_handlingFile handling/a/h2
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 796559c..8bf1028 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -506,6 +506,7 @@ virAllocN;
 virExpandN;
 virFree;
 virReallocN;
+virResizeN;
 virShrinkN;


diff --git a/src/util/memory.c b/src/util/memory.c
index 59685b3..d1237e3 100644
--- a/src/util/memory.c
+++ b/src/util/memory.c
@@ -198,6 +198,41 @@ int virExpandN(void *ptrptr, size_t size, size_t 
*countptr, size_t add)
 }

 /**
+ * virResizeN:
+ * @ptrptr: pointer to pointer for address of allocated memory
+ * @size: number of bytes per element
+ * @allocptr: pointer to number of elements allocated in array
+ * @count: number of elements currently 

[libvirt] [PATCH 07/10] Remove bogus includes

2010-11-17 Thread Eric Blake
From: Daniel P. Berrange berra...@redhat.com

---
 src/conf/domain_conf.c |1 -
 src/util/hooks.c   |1 -
 2 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 30c27db..dc6f198 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -42,7 +42,6 @@
 #include c-ctype.h
 #include logging.h
 #include network.h
-#include macvtap.h
 #include nwfilter_conf.h
 #include ignore-value.h
 #include storage_file.h
diff --git a/src/util/hooks.c b/src/util/hooks.c
index 8e24564..2a9df20 100644
--- a/src/util/hooks.c
+++ b/src/util/hooks.c
@@ -33,7 +33,6 @@
 #include virterror_internal.h
 #include hooks.h
 #include util.h
-#include conf/domain_conf.h
 #include logging.h
 #include memory.h
 #include files.h
-- 
1.7.3.2

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


[libvirt] [PATCH 06/10] maint: tighten strncmp syntax check

2010-11-17 Thread Eric Blake
Using 'int ret = strcmp(a, b)' in a qsort function is a valid use of
str[n]cmp that should _not_ be turned to STREQ, but it was falling
foul of our specific syntax-check.  Meanwhile, gnulib's maint.mk
already has a tighter bound for strcmp, so we can copy that regex and
just check for strncmp, which results in fewer false positives that
require exceptions.

* cfg.mk (sc_prohibit_strcmp_and_strncmp): Rename...
(sc_prohibit_strncmp): ...to this, and tighten, to mirror
maint.mk's sc_prohibit_strcmp's better regex.
* Makefile.am (syntax_check_exceptions): Update exception rule.
* .x-sc_prohibit_strcmp_and_strncmp: Rename...
* .x-sc_prohibit_strncmp: ...and trim.
---
 .x-sc_prohibit_strcmp_and_strncmp |9 -
 .x-sc_prohibit_strncmp|1 +
 Makefile.am   |2 +-
 cfg.mk|   14 --
 4 files changed, 10 insertions(+), 16 deletions(-)
 delete mode 100644 .x-sc_prohibit_strcmp_and_strncmp
 create mode 100644 .x-sc_prohibit_strncmp

diff --git a/.x-sc_prohibit_strcmp_and_strncmp 
b/.x-sc_prohibit_strcmp_and_strncmp
deleted file mode 100644
index 77c3ee6..000
--- a/.x-sc_prohibit_strcmp_and_strncmp
+++ /dev/null
@@ -1,9 +0,0 @@
-^gnulib/
-^ChangeLog-old$
-^docs/
-^examples/domain-events/events-c/event-test\.c$
-^src/internal\.h$
-^src/lxc/lxc_container\.c$
-^src/node_device/node_device_devkit\.c$
-^src/node_device/node_device_hal\.c$
-^src/storage/parthelper\.c$
diff --git a/.x-sc_prohibit_strncmp b/.x-sc_prohibit_strncmp
new file mode 100644
index 000..8be2055
--- /dev/null
+++ b/.x-sc_prohibit_strncmp
@@ -0,0 +1 @@
+^src/internal\.h$
diff --git a/Makefile.am b/Makefile.am
index d34313a..efdc204 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,7 +33,7 @@ syntax_check_exceptions = \
   .x-sc_prohibit_readlink \
   .x-sc_prohibit_sprintf \
   .x-sc_prohibit_strcmp \
-  .x-sc_prohibit_strcmp_and_strncmp \
+  .x-sc_prohibit_strncmp \
   .x-sc_prohibit_strncpy \
   .x-sc_prohibit_test_minus_ao \
   .x-sc_prohibit_VIR_ERR_NO_MEMORY \
diff --git a/cfg.mk b/cfg.mk
index 19a4622..1863bf1 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -231,12 +231,14 @@ sc_avoid_write:
halt='consider using safewrite instead of write'\
  $(_sc_search_regexp)

-# Use STREQ rather than comparing strcmp == 0, or != 0.
-# Similarly, use STREQLEN or STRPREFIX rather than strncmp.
-sc_prohibit_strcmp_and_strncmp:
-   @prohibit='strn?cmp *\('\
-   halt='use STREQ() in place of the above uses of str[n]cmp'  \
- $(_sc_search_regexp)
+# Similar to the gnulib maint.mk rule for sc_prohibit_strcmp
+# Use STREQLEN or STRPREFIX rather than comparing strncmp == 0, or != 0.
+sc_prohibit_strncmp:
+   @grep -nE '! *str''ncmp *\(|\str''ncmp *\([^)]+\) *==' \
+   $$($(VC_LIST_EXCEPT))   \
+ | grep -vE ':# *define STREQ\(' \
+ { echo '$(ME): use STREQLEN or STRPREFIX instead of str''ncmp' \
+   12; exit 1; } || :

 # Use virAsprintf rather than as'printf since *strp is undefined on error.
 sc_prohibit_asprintf:
-- 
1.7.3.2

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


[libvirt] [PATCH 10/10] Port hooks and iptables code to new command execution APIs

2010-11-17 Thread Eric Blake
From: Daniel P. Berrange berra...@redhat.com

This proof of concept shows how two existing uses of virExec
and virRun can be ported to the new virCommand APIs, and how
much simpler the code becomes
---
 src/util/hooks.c|  216 +++
 src/util/iptables.c |   73 +++--
 2 files changed, 24 insertions(+), 265 deletions(-)

diff --git a/src/util/hooks.c b/src/util/hooks.c
index 2a9df20..1139d88 100644
--- a/src/util/hooks.c
+++ b/src/util/hooks.c
@@ -37,6 +37,7 @@
 #include memory.h
 #include files.h
 #include configmake.h
+#include command.h

 #define VIR_FROM_THIS VIR_FROM_HOOK

@@ -189,36 +190,15 @@ virHookPresent(int driver) {
  * Returns: 0 if the execution succeeded, 1 if the script was not found or
  *  invalid parameters, and -1 if script returned an error
  */
-#ifdef WIN32
-int
-virHookCall(int driver ATTRIBUTE_UNUSED,
-const char *id ATTRIBUTE_UNUSED,
-int op ATTRIBUTE_UNUSED,
-int sub_op ATTRIBUTE_UNUSED,
-const char *extra ATTRIBUTE_UNUSED,
-const char *input ATTRIBUTE_UNUSED) {
-virReportSystemError(ENOSYS, %s,
- _(spawning hooks not supported on this platform));
-return -1;
-}
-#else
 int
 virHookCall(int driver, const char *id, int op, int sub_op, const char *extra,
 const char *input) {
-int ret, waitret, exitstatus, i;
+int ret;
 char *path;
-int argc = 0, arga = 0;
-const char **argv = NULL;
-int envc = 0, enva = 0;
-const char **env = NULL;
+virCommandPtr cmd;
 const char *drvstr;
 const char *opstr;
 const char *subopstr;
-pid_t pid;
-int outfd = -1, errfd = -1;
-int pipefd[2] = { -1, -1};
-char *outbuf = NULL;
-char *errbuf = NULL;

 if ((driver  VIR_HOOK_DRIVER_DAEMON) ||
 (driver = VIR_HOOK_DRIVER_LAST))
@@ -270,192 +250,20 @@ virHookCall(int driver, const char *id, int op, int 
sub_op, const char *extra,
 return(-1);
 }

-/*
- * Convenience macros borrowed from qemudBuildCommandLine()
- */
-# define ADD_ARG_SPACE   \
-do {\
-if (argc == arga) { \
-arga += 10; \
-if (VIR_REALLOC_N(argv, arga)  0)  \
-goto no_memory; \
-}   \
-} while (0)
-
-# define ADD_ARG(thisarg)\
-do {\
-ADD_ARG_SPACE;  \
-argv[argc++] = thisarg; \
-} while (0)
-
-# define ADD_ARG_LIT(thisarg)\
-do {\
-ADD_ARG_SPACE;  \
-if ((argv[argc++] = strdup(thisarg)) == NULL)   \
-goto no_memory; \
-} while (0)
-
-# define ADD_ENV_SPACE   \
-do {\
-if (envc == enva) { \
-enva += 10; \
-if (VIR_REALLOC_N(env, enva)  0)   \
-goto no_memory; \
-}   \
-} while (0)
-
-# define ADD_ENV(thisarg)\
-do {\
-ADD_ENV_SPACE;  \
-env[envc++] = thisarg;  \
-} while (0)
-
-# define ADD_ENV_LIT(thisarg)\
-do {\
-ADD_ENV_SPACE;  \
-if ((env[envc++] = strdup(thisarg)) == NULL)\
-goto no_memory; \
-} while (0)
-
-# define ADD_ENV_PAIR(envname, val)  \
-do {\
-char *envval;   \
-ADD_ENV_SPACE;  \
-if (virAsprintf(envval, %s=%s, envname, val)  0) 

[libvirt] [PATCH 09/10] virCommand: docs for usage of new command APIs

2010-11-17 Thread Eric Blake
From: Daniel P. Berrange berra...@redhat.com

---
 docs/Makefile.am   |   11 +-
 docs/internals.html.in |9 +
 docs/internals/command.html.in |  491 
 docs/sitemap.html.in   |4 +
 docs/subsite.xsl   |   25 ++
 5 files changed, 539 insertions(+), 1 deletions(-)
 create mode 100644 docs/internals/command.html.in
 create mode 100644 docs/subsite.xsl

diff --git a/docs/Makefile.am b/docs/Makefile.am
index b28e04e..ce0b391 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -60,7 +60,8 @@ gif = \
   architecture.gif \
   node.gif

-dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in)) todo.html.in
+dot_html_in = $(notdir $(wildcard $(srcdir)/*.html.in)) todo.html.in \
+  $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in))
 dot_html = $(dot_html_in:%.html.in=%.html)

 patches = $(wildcard api_extension/*.patch)
@@ -113,6 +114,14 @@ todo:
 %.png: %.fig
convert -rotate 90 $ $@

+internals/%.html.tmp: internals/%.html.in subsite.xsl page.xsl sitemap.html.in
+   @if [ -x $(XSLTPROC) ] ; then \
+ echo Generating $@; \
+ name=`echo $@ | sed -e 's/.tmp//'`; \
+ $(XSLTPROC) --stringparam pagename $$name --nonet --html \
+   $(top_srcdir)/docs/subsite.xsl $  $@ \
+   || { rm $@  exit 1; }; fi
+
 %.html.tmp: %.html.in site.xsl page.xsl sitemap.html.in
@if [ -x $(XSLTPROC) ] ; then \
  echo Generating $@; \
diff --git a/docs/internals.html.in b/docs/internals.html.in
index d39098e..dc88eab 100644
--- a/docs/internals.html.in
+++ b/docs/internals.html.in
@@ -7,5 +7,14 @@
   internals, adding new public APIs, new hypervisor drivers or extending
   the libvirtd daemon code.
 /p
+
+ul
+  liIntroduction to basic rules and guidelines for a 
href=hacking.htmlhackinga
+   on libvirt code/li
+  liGuide to adding a href=api_extension.htmlpublic APIsa/li
+  liApproach for a href=internals/command.htmlspawning commands/a 
from
+   libvirt driver code/li
+/ul
+
   /body
 /html
diff --git a/docs/internals/command.html.in b/docs/internals/command.html.in
new file mode 100644
index 000..3d28cd4
--- /dev/null
+++ b/docs/internals/command.html.in
@@ -0,0 +1,491 @@
+html
+  body
+h1Spawning processes / commands from libvirt drivers/h1
+
+ul id=toc/ul
+
+p
+  This page describes the usage of libvirt APIs for
+  spawning processes / commands from libvirt drivers.
+  All code is required to use these APIs
+/p
+
+h2a name=posixProblems with standard POSIX APIs/a/h2
+
+p
+  The POSIX specification includes a number of APIs for
+  spawning processes / commands, but they suffer from
+  a number of flaws
+/p
+
+ul
+  licodefork+exec/code: The lowest amp; most flexible
+   level, but very hard to use correctly / safely. It
+   is easy to leak file descriptors, have unexpected
+   signal handler behaviour and not handle edge cases.
+   Furthermore, it is not portable to mingw.
+   /li
+  licodesystem/code: Convenient if you don't care
+   about capturing command output, but has the serious
+   downside that the command string is interpreted by
+   the shell. This makes it very dangerous to use, because
+   improperly validated user input can lead to exploits
+   via shell meta characters.
+  /li
+  licodepopen/code: Inherits the flaws of
+   codesystem/code, and has no option for bi-directional
+   communication.
+  /li
+  licodeposix_spawn/code: A half-way house between
+   simplicity of system() and the flexibility of fork+exec.
+   It does not allow for a couple of important features
+   though, such as running a hook between the fork+exec
+   stage, or closing all open file descriptors./li
+/ul
+
+p
+  Due to the problems mentioned with each of these,
+  libvirt driver code strongmust not use/strong any
+  of the above APIs. Historically libvirt provided a
+  higher level API known as virExec. This was wrapper
+  around fork+exec, in a similar style to posix_spawn,
+  but with a few more features.
+/p
+
+p
+  This wrapper still suffered from a number of problems.
+  Handling command cleanup via waitpid() is overly
+  complex amp; error prone for most usage. Building up the
+  argv[] + env[] string arrays is quite cumbersome and
+  error prone, particularly wrt memory leak / OOM handling.
+/p
+
+h2a name=apiThe libvirt command execution API/a/h2
+
+p
+  There is now a high level API that provides a safe and
+  flexible way to spawn commands, which prevents the most
+  common errors amp; is easy to code against.  This
+  code is provided in the codesrc/util/command.h/code
+  header which can be imported using code#include command.h/code
+/p
+
+h3a name=initialDefining commands in 

[libvirt] polkit auth issue

2010-11-17 Thread Jim Fehlig
I'm trying to debug a PolicyKit auth issue in libvirt and looking for
some suggestions.

Server has the following policy for user ski52 in
/etc/PolicyKit/PolicyKit.conf :

match action=org.libvirt.unix.manage
match user=ski52
return result=auth_self_keep_always/
/match
/match

I can authenticate via polkit  when logged directly into server via ssh
as ski52

sk...@vhost52:~ virsh -c qemu:///system list
Attempting to obtain authorization for org.libvirt.unix.manage.
Authentication is required.
Password:
Successfully obtained the authorization for org.libvirt.unix.manage.
 Id Name State
--
 33 vm1   running

But when using qemu+ssh remotely

sk...@vhost53:~ virsh -c qemu+ssh://sk...@vhost52/system list
Attempting to obtain authorization for org.libvirt.unix.manage.
Authentication as an administrative user is required.
Password:
polkit-grant-helper-pam: pam_authenticated failed: Authentication failure
Failed to obtain authorization for org.libvirt.unix.manage.
error: authentication failed
error: failed to connect to the hypervisor

AFAICT by tracing with gdb, the client calls polkit-auth *locally* when
authentication is needed, instead of invoking polkit-auth on the
server.  This backtrace from gdb on the client machine shows
'polkit-auth --obtain' being called locally from virConnectAuthGainPolkit()

#0  virConnectAuthGainPolkit (privilege=0x77b8b3ba
org.libvirt.unix.manage) at libvirt.c:111
#1  0x77a912a3 in virConnectAuthCallbackDefault
(cred=0x7fffdd20, ncred=1, cbdata=0x0)
at libvirt.c:149
#2  0x77ac367f in remoteAuthPolkit (conn=0x63ec10,
priv=0x77e25010, in_open=1,
auth=0x77dc9bc0) at remote/remote_driver.c:7431
#3  0x77ac1d8d in remoteAuthenticate (conn=0x63ec10,
priv=0x77e25010, in_open=1,
auth=0x77dc9bc0, authtype=0x0) at remote/remote_driver.c:6864
#4  0x77ab5936 in doRemoteOpen (conn=0x63ec10,
priv=0x77e25010, auth=0x77dc9bc0, flags=0)
at remote/remote_driver.c:854
..

Has anyone else observed such behavior?  Any hints on how to forward the
polkit-auth call to the server?  Both client and server are libvirt
0.8.5 btw.

Regards,
Jim

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


[libvirt] Interesting Mobile apps food for thought

2010-11-17 Thread Justin Clift
Just came across this.  There's a Linux distribution based off of
Centos, called ClearOS, that's targeted at a router/gateway/vpn/etc.

They've designed their own API for managing things (nice looking
site), and people are creating nifty looking visual mobile apps for it.

  http://www.clearfoundation.com/docs/developer/api/start

Here's screenshot of an Android app, monitoring bandwidth on a
remote host (worth looking at):

  
http://www.clearfoundation.com/docs/_detail/developer/api/android_monitor02.png?id=developer%3Aapi%3Astart

This is the kind of thing I can see people making virt apps for, as
we get our doc coverage done properly, mobile friendly API's
well documented, and our Community really built. :)

Regards and best wishes,

Justin Clift

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


[libvirt] [PATCH] virsh: tell if domain is updated in dominfo

2010-11-17 Thread Osier Yang
* tools/virsh.c (introduce new information 'Updated' for 'dominfo',
standsfor if a domain is updated via operations like 'update-device',
'update-disk', etc.)
---
 tools/virsh.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index ae88cc0..d260443 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1992,6 +1992,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
 virSecurityModel secmodel;
 virSecurityLabel seclabel;
 int persistent = 0;
+int updated = -1;
 int ret = TRUE, autostart;
 unsigned int id;
 char *str, uuid[VIR_UUID_STRING_BUFLEN];
@@ -2053,6 +2054,12 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
 else
 vshPrint(ctl, %-15s %s\n, _(Persistent:), persistent ? _(yes) : 
_(no));

+updated = virDomainIsUpdated(dom);
+if (updated  0)
+vshPrint(ctl, %-15s %s\n, _(Updated:), _(unknown));
+else
+vshPrint(ctl, %-15s %s\n, _(Updated:), updated ? _(yes) : 
_(no));
+
 /* Check and display whether the domain autostarts or not */
 if (!virDomainGetAutostart(dom, autostart)) {
 vshPrint(ctl, %-15s %s\n, _(Autostart:),
--
1.7.3.2

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


Re: [libvirt] [PATCH] virsh: tell if domain is updated in dominfo

2010-11-17 Thread Osier Yang

This patch is based on following 4 patches:

https://www.redhat.com/archives/libvir-list/2010-November/msg00661.html
https://www.redhat.com/archives/libvir-list/2010-November/msg00662.html
https://www.redhat.com/archives/libvir-list/2010-November/msg00663.html
https://www.redhat.com/archives/libvir-list/2010-November/msg00664.html

These 4 patches are still not ACKed, could anyone help review it? Thanks

- Osier

于 2010年11月18日 15:26, Osier Yang 写道:

* tools/virsh.c (introduce new information 'Updated' for 'dominfo',
standsfor if a domain is updated via operations like 'update-device',
'update-disk', etc.)
---
  tools/virsh.c |7 +++
  1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index ae88cc0..d260443 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1992,6 +1992,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
  virSecurityModel secmodel;
  virSecurityLabel seclabel;
  int persistent = 0;
+int updated = -1;
  int ret = TRUE, autostart;
  unsigned int id;
  char *str, uuid[VIR_UUID_STRING_BUFLEN];
@@ -2053,6 +2054,12 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
  else
  vshPrint(ctl, %-15s %s\n, _(Persistent:), persistent ? _(yes) : 
_(no));

+updated = virDomainIsUpdated(dom);
+if (updated  0)
+vshPrint(ctl, %-15s %s\n, _(Updated:), _(unknown));
+else
+vshPrint(ctl, %-15s %s\n, _(Updated:), updated ? _(yes) : 
_(no));
+
  /* Check and display whether the domain autostarts or not */
  if (!virDomainGetAutostart(dom,autostart)) {
  vshPrint(ctl, %-15s %s\n, _(Autostart:),
--
1.7.3.2

--
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

[libvirt] [PATCH] doc: add doc for missed parameters of attach-disk

2010-11-17 Thread Osier Yang
* tools/virsh.pod (add docs for --persistent and --sourcetype
of attach-disk, break the long lines in the meantime)
---
 tools/virsh.pod |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/virsh.pod b/tools/virsh.pod
index b4644d8..c4a5803 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -645,7 +645,9 @@ See the documentation to learn about libvirt XML format for 
a device.
 For cdrom and floppy devices, this command only replaces the media within
 the single existing device; consider using Bupdate-device for this usage.

-=item Battach-disk Idomain-id Isource Itarget optional I--driver 
driver I--subdriver subdriver I--type type I--mode mode
+=item Battach-disk Idomain-id Isource Itarget optional
+I--driver driver I--subdriver subdriver I--type type
+I--mode mode I--persistent I--sourcetype soucetype

 Attach a new disk device to the domain.
 Isource and Itarget are paths for the files and devices.
@@ -654,8 +656,12 @@ Itype can indicate Icdrom or Ifloppy as alternative 
to the disk default,
 although this use only replaces the media within the existing virtual cdrom or
 floppy device; consider using Bupdate-device for this usage instead.
 Imode can specify the two specific mode Ireadonly or Ishareable.
+Ipersistent indicates the changes will affect the next boot of the domain.
+Isourcetype can indicate the type of source (block|file)

-=item Battach-interface Idomain-id Itype Isource optional I--target 
target I--mac mac I--script script I--model model I--persistent
+=item Battach-interface Idomain-id Itype Isource optional
+I--target target I--mac mac I--script script I--model model
+I--persistent

 Attach a new network interface to the domain.
 Itype can be either Inetwork to indicate a physical network device or 
Ibridge to indicate a bridge to a device.
--
1.7.3.2

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