[libvirt] Fwd: Abandoning php-virt-control project
>On Mon, May 21, 2018 at 11:05:13AM +0200, Michal Novotny wrote: >> Hi Dan, >> thanks and I completely understand. I was funding the domain name from my >> own resources for several years already. If somebody is interested in >> taking over the domain it would be great however if nobody is interested >> the domain will expire and cease to exist. As already said I'm willing to >> prolong the domain by 1 years till June 27 2019 but it would be nice if >> somebody can take over the domain ownership and the funding. As far as I >> know the project php-virt-control.org is basically an alias for the same >> server hosting libvirt.org so just the domain cease to exist but the git >> will still be available at [1]. > > Yes, that's correct the git will always be available there, and it also > gets auto-mirrored to both github and gitlab, so essentially it will > exist forever. > Ok, I'm glad to hear that :-) >> Is it worth it prolonging the domain by 1 year as mentioned above or should >> I let the domain expire if nobody is interested in taking it over >> considering the fact it will still remain on the server? > I'm terrible at making decisions like this - I still keep renewing domains > for personal project's I've long since abandoned, because I hate the idea > of domain squatters grabbing them and extorting money :-( > > Since I've not seen anyone actively sending patches for php-virt-control, > I fear you're unlikely to see anyone volunteer to take the domain name. > I guess you've got a month still you can wait though for anyone to take > interest until you need to decide. You are most likely right about that. Maybe it' s better to let the domain expire in one month if nobody takes it over because the project will still exist on the libvirt.org site. That said I won't prolong the domain name anymore and I'll let it expire if nobody is interested in taking over the domain. Regards, Michal > > > Regards, > Daniel -- |: https://berrange.com -o-https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o-https://fstop138.berrange.com :| |: https://entangle-photo.org-o-https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Abandoning php-virt-control project
Hi, since I'm pretty busy last few months and I didn't do any commit to the php-virt-control project [1] for a pretty long time it's time to hand over this project to somebody that is interested in continuing the project so please if anyone is interested please tell me. It's essentially the PHP binding to the libvirt virtualization API so you can check the php-virt-control website however I no longer have access to the site and I think Dan P. Berrange (CC'ed) owns this server so he can grant access to the server hosting the project. It would be a pitty if this project dies entirely when I'm no longer having any time for the project as I've been receiving many replies of people liking the project. Also I'm the owner of the domain ([1]) and it expires on June 27 2018. Although I'm willing to prolong the domain by 1 year (till June 27 2019) it would be nice if I can also hand over the domain to somebody else. Please tell me if you're interested in taking over the project and/or the domain so we could faciliate the change (usually by domain ownership transfer done by link going to my mailbox). Thanks, Michal [1] http://php-virt-control.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php][PATCH 7/7] libvirt_stream_close: Pass the actual connect object
Nice work catch. Thanks, Michal Dne 19.6.2015 18:49 Eric Blake ebl...@redhat.com napsal(a): On 06/19/2015 03:17 AM, Michal Privoznik wrote: There's a bug in the function. When closing a stream, the stream refcount should be decremented. We have a helper function for that which (among others) take a virConnectPtr as an argument. However, we are passing an internal representation of the virConnect. Even gcc warns about this: libvirt-php.c: In function ‘zif_libvirt_stream_close’: libvirt-php.c:3748:47: warning: passing argument 2 of ‘resource_change_counter’ from incompatible pointer type resource_change_counter(INT_RESOURCE_STREAM, stream-conn, stream-stream, 0 TSRMLS_CC); ^ libvirt-php.c:470:5: note: expected ‘virConnectPtr’ but argument is of type ‘struct php_libvirt_connection *’ int resource_change_counter(int type, virConnectPtr conn, void *memp, int inc TSRMLS_DC) ^ Signed-off-by: Michal Privoznik mpriv...@redhat.com Signed-off-by: Michal Privoznik mpriv...@redhat.com Double S-o-b looks odd. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org -- 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] Fwd: [php PATCH] Fix compiler warnings after int to long conversion
Hi Dawid, thanks. I've managed to apply it, I've been having some issues with my local git copy. It's already applied in libvirt-php master branch. Sorry for the noise and thanks again! Michal 2014-06-19 0:05 GMT+02:00 Dawid Zamirski dzamir...@dattobackup.com: On Wed, 2014-06-18 at 22:50 +0200, Michal Novotny wrote: Hi Dawid, thanks for the information. Well, please rebase to the latest commit of my master branch and resend, thanks a lot! Michal Ok, now I'm puzzled. I've rebased the patch from clean master and the diff ended up identical to the original one. To double check, I've also successfully re-applied original mbox file on a fresh git clone, like this: git clone git://libvirt.org/libvirt-php git am ~/\[php_PATCH\]_Fix_compiler_warnings_after_int_to_long_conversion.mbox Applying: Fix compiler warnings after int to long conversion It seems that my original patch was correctly generated against remote's master due to: git send-email --no-chain-reply-to --annotate origin/master which means it was made against remote master branch, not my local copy that was dirty. At this point, I'm not sure what else I can do on my end. Sorry for the noise with such a simple patch... Regards, Dawid 2014-06-18 22:05 GMT+02:00 Dawid Zamirski dzamir...@dattobackup.com: Ugh, now I know what happened - my local master branch has commits I have not sent pull requests for yet so it wasn't in 100% in sync with remote. Do you want me to resend the patch to the ML? On Wed, 2014-06-18 at 16:02 -0400, Dawid Zamirski wrote: Hi Michal, I'm pretty sure I did git pull right before sending the patch. Here's what I did exactly: On master branch: git pull git checkout -b parse-param-fix origin/master created original patch commit git format-patch -1 git send-email --no-chain-reply-to --annotate 0001-Use-long-variable-type-for-zend_parse_parameters.patch then I've noticed the warnings (still on parse-param-fix branch) create patch commit git fetch --all git pull --rebase git send-email --no-chain-reply-to --annotate origin/master I guess that before starting the waring fix patch I should have create a new local branch: git checkout master git pull git checkout -b warning-fix origin/master and then work from there. Regards, Dawid On Wed, 2014-06-18 at 21:28 +0200, Michal Novotny wrote: Hi Dawid, thanks for the patch, I'll apply it when I have time to do so. However, the patch is not critical as it's in the DPRINTF debug macro (for production environment you should disable the DEBUG macro). Also, please make sure you are you the latest git tree (by running git pull before writing the patch) as I'm having issues applying some of the patches cleanly. Thanks, Michal 2014-06-18 21:09 GMT+02:00 Dawid Zamirski dzamir...@dattobackup.com: The previous patch [1] caused compiler warnings after variable types were changed from int to long and this patch fixes this. [1] https://www.redhat.com/archives/libvir-list/2014-June/msg00835.html --- src/libvirt-php.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libvirt-php.c b/src/libvirt-php.c index 224943d..6d6fa81 100644 --- a/src/libvirt-php.c +++ b/src/libvirt-php.c @@ -3928,7 +3928,7 @@ PHP_FUNCTION(libvirt_domain_send_pointer_event) RETURN_FALSE; } - DPRINTF(%s: x = %d, y = %d, clicked = %d, release = % d, hostname = %s...\n, PHPFUNC, pos_x, pos_y, clicked, release, hostname); + DPRINTF(%s: x = %d, y = %d, clicked = %d, release = % d, hostname = %s...\n, PHPFUNC, (int) pos_x, (int) pos_y, (int) clicked, release, hostname); ret = vnc_send_pointer_event(hostname, tmp, pos_x, pos_y, clicked
Re: [libvirt] [php PATCH] Use long variable type for zend_parse_parameters.
Hi Dawid, I've applied it to the libvirt-php git repository. See: http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=d3b3afa7d37541984d1e80e4ab46cd3e582ea60d Thanks, Michal 2014-06-18 19:11 GMT+02:00 Dawid Zamirski dzamir...@dattobackup.com: 2014-06-18 19:11 GMT+02:00 Dawid Zamirski dzamir...@dattobackup.com: This patch fixes a bug where zend_parse_parameters would segfault on certain PHP version (spotted on PHP 5.3.2 64bit) where type specifier is long l and variable reference is int or unsigned int. Changing the variable type from int or unsigned int to long fixes the problem for me and is a known issue [1]. This did not happen in newer PHP version (5.3.10). [1] https://bugs.php.net/bug.php?id=59289 --- src/libvirt-php.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/libvirt-php.c b/src/libvirt-php.c index 07ae137..224943d 100644 --- a/src/libvirt-php.c +++ b/src/libvirt-php.c @@ -3283,8 +3283,8 @@ PHP_FUNCTION(libvirt_domain_get_metadata) { php_libvirt_domain *domain = NULL; zval *zdomain; - int type = 0; - unsigned int flags = 0; + long type = 0; + long flags = 0; char *uri = NULL; int uri_len; char *ret = NULL; @@ -3328,8 +3328,8 @@ PHP_FUNCTION(libvirt_domain_set_metadata) char *metadata = NULL; char *key = NULL; char *uri = NULL; - int type = 0; - unsigned int flags = 0; + long type = 0; + long flags = 0; int rc; GET_DOMAIN_FROM_ARGS (rlsssl, zdomain, type, metadata, metadata_len, key, key_len, uri, uri_len, flags); @@ -3566,7 +3566,7 @@ PHP_FUNCTION(libvirt_domain_get_screenshot_api) { php_libvirt_domain *domain=NULL; zval *zdomain; - unsigned int screen = 0; + long screen = 0; int fd = -1; char file[] = /tmp/libvirt-php-tmp-XX; virStreamPtr st = NULL; @@ -3668,7 +3668,7 @@ PHP_FUNCTION(libvirt_domain_get_screenshot) int port = -1; char *hostname = NULL; int hostname_len; - int scancode = 10; + long scancode = 10; char *path; char name[1024] = { 0 }; int use_builtin = 0; @@ -3908,9 +3908,9 @@ PHP_FUNCTION(libvirt_domain_send_pointer_event) char *xml = NULL; char *hostname = NULL; int hostname_len; - int pos_x = 0; - int pos_y = 0; - int clicked = 0; + long pos_x = 0; + long pos_y = 0; + long clicked = 0; int release = 1; int ret; @@ -4352,12 +4352,12 @@ PHP_FUNCTION(libvirt_domain_new) // char *emulator; char *iso_image = NULL; int iso_image_len; - int vcpus = -1; - int memMB = -1; + long vcpus = -1; + long memMB = -1; zval *disks, *networks; tVMDisk *vmDisks = NULL; tVMNetwork *vmNetworks = NULL; - int maxmemMB = -1; + long maxmemMB = -1; HashTable *arr_hash; int numDisks, numNets, i; zval **data; // removed **zvalue @@ -4642,7 +4642,7 @@ PHP_FUNCTION(libvirt_domain_get_interface_devices) */ PHP_FUNCTION(libvirt_domain_change_vcpus) { - int numCpus, flags = 0; + long numCpus, flags = 0; php_libvirt_domain *domain=NULL; zval *zdomain; @@ -6266,7 +6266,7 @@ PHP_FUNCTION(libvirt_domain_snapshot_delete) { zval *zsnapshot; php_libvirt_snapshot *snapshot; - int flags = 0; + long flags = 0; int retval; GET_SNAPSHOT_FROM_ARGS(r|l,zsnapshot, flags); @@ -6766,7 +6766,7 @@ PHP_FUNCTION(libvirt_storagevolume_delete) { php_libvirt_volume *volume=NULL; zval *zvolume; - int flags = 0; + long flags = 0; int retval = 0; GET_VOLUME_FROM_ARGS(r|l,zvolume,flags); @@ -7057,7 +7057,7 @@ PHP_FUNCTION(libvirt_storagepool_refresh) { php_libvirt_storagepool *pool = NULL; zval *zpool; - unsigned long flags = 0; + long flags = 0; int retval; GET_STORAGEPOOL_FROM_ARGS (r|l, zpool, flags); -- 1.9.3 -- 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
Re: [libvirt] [php PATCH] Fix compiler warnings after int to long conversion
Hi Dawid, thanks for the information. Well, please rebase to the latest commit of my master branch and resend, thanks a lot! Michal 2014-06-18 22:05 GMT+02:00 Dawid Zamirski dzamir...@dattobackup.com: Ugh, now I know what happened - my local master branch has commits I have not sent pull requests for yet so it wasn't in 100% in sync with remote. Do you want me to resend the patch to the ML? On Wed, 2014-06-18 at 16:02 -0400, Dawid Zamirski wrote: Hi Michal, I'm pretty sure I did git pull right before sending the patch. Here's what I did exactly: On master branch: git pull git checkout -b parse-param-fix origin/master created original patch commit git format-patch -1 git send-email --no-chain-reply-to --annotate 0001-Use-long-variable-type-for-zend_parse_parameters.patch then I've noticed the warnings (still on parse-param-fix branch) create patch commit git fetch --all git pull --rebase git send-email --no-chain-reply-to --annotate origin/master I guess that before starting the waring fix patch I should have create a new local branch: git checkout master git pull git checkout -b warning-fix origin/master and then work from there. Regards, Dawid On Wed, 2014-06-18 at 21:28 +0200, Michal Novotny wrote: Hi Dawid, thanks for the patch, I'll apply it when I have time to do so. However, the patch is not critical as it's in the DPRINTF debug macro (for production environment you should disable the DEBUG macro). Also, please make sure you are you the latest git tree (by running git pull before writing the patch) as I'm having issues applying some of the patches cleanly. Thanks, Michal 2014-06-18 21:09 GMT+02:00 Dawid Zamirski dzamir...@dattobackup.com: The previous patch [1] caused compiler warnings after variable types were changed from int to long and this patch fixes this. [1] https://www.redhat.com/archives/libvir-list/2014-June/msg00835.html --- src/libvirt-php.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libvirt-php.c b/src/libvirt-php.c index 224943d..6d6fa81 100644 --- a/src/libvirt-php.c +++ b/src/libvirt-php.c @@ -3928,7 +3928,7 @@ PHP_FUNCTION(libvirt_domain_send_pointer_event) RETURN_FALSE; } - DPRINTF(%s: x = %d, y = %d, clicked = %d, release = % d, hostname = %s...\n, PHPFUNC, pos_x, pos_y, clicked, release, hostname); + DPRINTF(%s: x = %d, y = %d, clicked = %d, release = % d, hostname = %s...\n, PHPFUNC, (int) pos_x, (int) pos_y, (int) clicked, release, hostname); ret = vnc_send_pointer_event(hostname, tmp, pos_x, pos_y, clicked, release); if (ret == 0) { DPRINTF(%s: Pointer event result is %d\n, PHPFUNC, ret); @@ -4428,7 +4428,7 @@ PHP_FUNCTION(libvirt_domain_new) numNets = i; snprintf(tmpname, sizeof(tmpname), %s-install, name); - DPRINTF(%s: Name is '%s', memMB is %d, maxmemMB is %d \n, PHPFUNC, tmpname, memMB, maxmemMB); + DPRINTF(%s: Name is '%s', memMB is %d, maxmemMB is %d \n, PHPFUNC, tmpname, (int) memMB, (int) maxmemMB); tmp = installation_get_xml(1, conn-conn, tmpname, memMB, maxmemMB, NULL /* arch */, NULL, vcpus, iso_image, vmDisks, numDisks, vmNetworks, numNets, @@ -6272,7 +6272,7 @@ PHP_FUNCTION(libvirt_domain_snapshot_delete) GET_SNAPSHOT_FROM_ARGS(r|l,zsnapshot, flags); retval = virDomainSnapshotDelete(snapshot-snapshot, flags); - DPRINTF(%s: virDomainSnapshotDelete(%p, %d) returned %d\n, PHPFUNC, snapshot-snapshot, flags, retval); + DPRINTF(%s: virDomainSnapshotDelete(%p, %d) returned %d\n, PHPFUNC, snapshot-snapshot, (int) flags, retval); if (retval == -1) RETURN_FALSE; RETURN_TRUE; } @@ -6772,7 +6772,7 @@ PHP_FUNCTION(libvirt_storagevolume_delete) GET_VOLUME_FROM_ARGS(r|l,zvolume,flags); retval = virStorageVolDelete(volume-volume, flags); - DPRINTF(%s: virStorageVolDelete(%p, %d) returned %d \n, PHPFUNC, volume-volume, flags, retval); + DPRINTF(%s: virStorageVolDelete(%p, %d) returned %d \n, PHPFUNC, volume-volume, (int) flags, retval); if (retval != 0) { set_error_if_unset(Cannot delete
Re: [libvirt] [php-libvirt] minimal libvirt requirement
Hi Remi, thanks for catching it, feel free to write a patch for this (and also take ownership of of php-libvirt in Fedora if interested - this has been sent to your corporate e-mail: rcol...@redhat.com ). Thanks, Michal On 01/06/2014 03:58 PM, Remi Collet wrote: Hi, From configure: LIBVIRT_REQUIRED=0.6.2 But build fails with 0.9 Tested with 0.8.8 and 0.8.2 (RHEL-5) libvirt-php.c:1080: error: 'VIR_NODE_CPU_STATS_ALL_CPUS' undeclared (first use in this function) Thanks Remi. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [php-libvirt] minimal libvirt requirement
On 01/06/2014 05:56 PM, Remi Collet wrote: Le 06/01/2014 16:48, Michal Novotny a écrit : Hi Remi, thanks for catching it, feel free to write a patch for this (and also take ownership of of php-libvirt in Fedora if interested - this has been sent to your corporate e-mail: rcol...@redhat.com ). I have already taken ownership of the Fedora package (and update it to current version 0.4.8). Ok Remi. Thanks a lot! Michal Remi. Thanks, Michal On 01/06/2014 03:58 PM, Remi Collet wrote: Hi, From configure: LIBVIRT_REQUIRED=0.6.2 But build fails with 0.9 Tested with 0.8.8 and 0.8.2 (RHEL-5) libvirt-php.c:1080: error: 'VIR_NODE_CPU_STATS_ALL_CPUS' undeclared (first use in this function) Thanks Remi. -- 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 -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
Hi Umar, please contact libvirt guys for python bindings. Python bindings for libvirt are not handled by me, I handle just the PHP bindings and I'm not aware of the function support in the Python bindings. Happy New Year! Thanks, Michal - Original Message - From: Umar Draz unix...@gmail.com To: Michal Novotny minov...@redhat.com Sent: Monday, December 23, 2013 7:03:17 PM Subject: Re: [libvirt] libvirt live modify Hi Michal Thanks, its work, Ok one question http://libvirt.org/php/api-reference.html#libvirt_domain_set_metadata the above link is php api reference link is there same kind of thing is available for python? Br. Umar On Mon, Dec 23, 2013 at 3:27 PM, Michal Novotny minov...@redhat.com wrote: Hi Umar, I'm on PTO, fortunately I was checking my e-mail because of the goods to declare so I can reply to you. For updating this please use the libvirt_domain_set_metadata() API function, please see [1] for documentation. Hope it helps, Michal [1] http://libvirt.org/php/api-reference.html#libvirt_domain_set_metadata - Original Message - From: Umar Draz unix...@gmail.com To: Michal Novotny minov...@redhat.com Sent: Monday, December 23, 2013 11:05:11 AM Subject: Re: [libvirt] libvirt live modify Hi Michal, Sorry to disturb you again, this works great $info = @libvirt_domain_get_metadata($res, VIR_DOMAIN_METADATA_DESCRIPTION, '', VIR_DOMAIN_AFFECT_CURRENT); Now what I need to do for setting/updating for the domain description or title Br. Umar On Wed, Dec 18, 2013 at 8:25 PM, Michal Novotny minov...@redhat.com wrote: Hi Umar, then you don't have working automake setup. Please google how to solve it, I apologize but I don't really have much time to solve it right now. Thanks for understanding, Michal On 12/18/2013 04:21 PM, Umar Draz wrote: Hi Michal I tried but on autogen.sh is failed automake: error: global options already processed automake: Please contact bug-autom...@gnu.org mailto:bug-autom...@gnu.org. at /usr/share/automake-1.14/Automake/Channels.pm line 662, GEN0 line 77. Automake::Channels::msg('automake', '', 'global options already processed') called at /usr/share/automake-1.14/Automake/ChannelDefs.pm line 212 Automake::ChannelDefs::prog_error('global options already processed') called at /usr/share/automake-1.14/Automake/Options.pm line 421 Automake::Options::process_global_option_list('HASH(0x246df60)') called at /usr/bin/automake line 5331 Automake::scan_autoconf_traces('configure.ac http://configure.ac') called at /usr/bin/automake line 5431 Automake::scan_autoconf_files() called at /usr/bin/automake line 8259 autoreconf: automake failed with exit status: 29 Br. Umar On Wed, Dec 18, 2013 at 7:50 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, you have to clone it from git repository and compile it and install. You can simply do it by: git clone git://libvirt.org/libvirt-php.git http://libvirt.org/libvirt-php.git ./autogen.sh make sudo make install And then you have to restart your Apache webserver. For example how to use it, see the test in test-domain-create-get-metadata.phpt file (it's normal PHP script, however I use phpt extension as PHP test but it's standard PHP code). Michal On 12/18/2013 03:45 PM, Umar Draz wrote: Hi Michal, Thanks, Now what I need here? I already have installed libvirt-php-0.4.8, do I need to copy libvirt-php.c http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 libvirt-php. http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 h in the src directory and reconfigure the php-libvirt? Br. Umar On Wed, Dec 18, 2013 at 7:31 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, please see commit http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0 . The functions mentioned below have been implemented. Michal On 12/18/2013 01:29 PM, Umar Draz wrote: Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar
Re: [libvirt] libvirt live modify
Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org -- Umar Draz Network Architect -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
Hi Umar, please see commit http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0 . The functions mentioned below have been implemented. Michal On 12/18/2013 01:29 PM, Umar Draz wrote: Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar On Wed, Dec 18, 2013 at 5:19 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org http://php-virt-control.org -- Umar Draz Network Architect -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org -- Umar Draz Network Architect -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt live modify
Hi Umar, you have to clone it from git repository and compile it and install. You can simply do it by: git clone git://libvirt.org/libvirt-php.git ./autogen.sh make sudo make install And then you have to restart your Apache webserver. For example how to use it, see the test in test-domain-create-get-metadata.phpt file (it's normal PHP script, however I use phpt extension as PHP test but it's standard PHP code). Michal On 12/18/2013 03:45 PM, Umar Draz wrote: Hi Michal, Thanks, Now what I need here? I already have installed libvirt-php-0.4.8, do I need to copy libvirt-php.c http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 libvirt-php. http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0h in the src directory and reconfigure the php-libvirt? Br. Umar On Wed, Dec 18, 2013 at 7:31 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, please see commit http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0 . The functions mentioned below have been implemented. Michal On 12/18/2013 01:29 PM, Umar Draz wrote: Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar On Wed, Dec 18, 2013 at 5:19 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Michal and Umar, it's correct I can't invoke this APIs via PHP yet. Please note that libvirt-php is not automatically generated when doing libvirt build and it's a separate project. It's rather easy to implement it to the libvirt-php so if you want to implement it, feel free to implement or if you can wait a day or two until I have some time I can implement it (the project is not officially supported and it's done in the spare time mainly). I'd just like to ask you whether there are some more APIs you'd like me to implement when I'll be implementing it. Are there any other APIs you'd like? Thanks, Michal On 12/18/2013 12:59 PM, Michal Privoznik wrote: On 18.12.2013 12:27, Umar Draz wrote: Hi Peter, Thanks for the response, Would you please help how I can use *virDomainSetMetadata* with PHP or any url for help? Br. Umar [CC'ing Michal Novotny - the libvirt-php maintainer] I don't think you can invoke those APIs via PHP. But I expect them to be able to add easily. Michal? Michal -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org http://php-virt-control.org http://php-virt-control.org
Re: [libvirt] libvirt live modify
Hi Umar, then you don't have working automake setup. Please google how to solve it, I apologize but I don't really have much time to solve it right now. Thanks for understanding, Michal On 12/18/2013 04:21 PM, Umar Draz wrote: Hi Michal I tried but on autogen.sh is failed automake: error: global options already processed automake: Please contact bug-autom...@gnu.org mailto:bug-autom...@gnu.org. at /usr/share/automake-1.14/Automake/Channels.pm line 662, GEN0 line 77. Automake::Channels::msg('automake', '', 'global options already processed') called at /usr/share/automake-1.14/Automake/ChannelDefs.pm line 212 Automake::ChannelDefs::prog_error('global options already processed') called at /usr/share/automake-1.14/Automake/Options.pm line 421 Automake::Options::process_global_option_list('HASH(0x246df60)') called at /usr/bin/automake line 5331 Automake::scan_autoconf_traces('configure.ac http://configure.ac') called at /usr/bin/automake line 5431 Automake::scan_autoconf_files() called at /usr/bin/automake line 8259 autoreconf: automake failed with exit status: 29 Br. Umar On Wed, Dec 18, 2013 at 7:50 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, you have to clone it from git repository and compile it and install. You can simply do it by: git clone git://libvirt.org/libvirt-php.git http://libvirt.org/libvirt-php.git ./autogen.sh make sudo make install And then you have to restart your Apache webserver. For example how to use it, see the test in test-domain-create-get-metadata.phpt file (it's normal PHP script, however I use phpt extension as PHP test but it's standard PHP code). Michal On 12/18/2013 03:45 PM, Umar Draz wrote: Hi Michal, Thanks, Now what I need here? I already have installed libvirt-php-0.4.8, do I need to copy libvirt-php.c http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0 libvirt-php. http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7a2a3c0651e882abf538473ff013cb68e499be43;hb=e3e783413d8f001ee0a266edbac949c78616fde0h in the src directory and reconfigure the php-libvirt? Br. Umar On Wed, Dec 18, 2013 at 7:31 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, please see commit http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=e3e783413d8f001ee0a266edbac949c78616fde0 . The functions mentioned below have been implemented. Michal On 12/18/2013 01:29 PM, Umar Draz wrote: Hi Michal, Thanks for your efforts and help. If I need any other API I will definitely ask you. Br. Umar On Wed, Dec 18, 2013 at 5:19 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Umar, that's fine. Give one or two days for this please. Maybe I'll implement earlier but I'm a bit overloaded after my PTO so I can't promise it will be earlier. Also, what APIs would you like to implement? I'm thinking of implementing these two: http://libvirt.org/html/libvirt-libvirt.html#virDomainGetMetadata http://libvirt.org/html/libvirt-libvirt.html#virDomainSetMetadata Would you like any other APIs? Thanks, Michal On 12/18/2013 01:15 PM, Umar Draz wrote: HI Michal, Ok , I will wait. I hope you will get sometime to do this. Br. Umar On Wed, Dec 18, 2013 at 5:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov
Re: [libvirt] GlusterFS with libvirt
Hi Umar, I see you're using the libvirt-php bindings. That way you might be interested in one project I wrote and I'm spending some of my spare time rewriting it to better design (some of the rewritten components are part of rewrite-0.1 branch but not everything) and I'm also designing an Android application (called virtDroid using the XML-RPC of the rewritten version - it's not on git yet though as it's not finished even in it's basic version yet). The project is called php-virt-control and it's PHP-based Virtual Controller using libvirt-php. It's open-source and available at: http://www.php-virt-control.org/ Michal On 11/29/2013 01:50 PM, Umar Draz wrote: HI Daniel, I am already using this ridiculous fuse, and Waiting the patch of native GlusterFS. BTW: here is my newly developed app for libvirt which support both LVM and dir. https://github.com/umardraz/virtspace/blog/master/README.md Br. Umar On Fri, Nov 29, 2013 at 2:03 PM, Daniel Berteaud dan...@firewall-services.com mailto:dan...@firewall-services.com wrote: Le 28/11/2013 13:55, Umar Draz a écrit : Hi All, Is any body help me how I can integrate libvirt with glusterfs on Ubuntu 13.10 Server. I tried the following, but its not working. qemu-img: Unknown protocol 'gluster://localhost/gv1/test.img' Looks like native GlusterFS storage pool will be available shortly (looks all the recent patches about this). Waiting for this, you can always use the fuse client. Just mount your GlusterFS anywhere on your host (with the fuse client), and define a simple dir pool on top of that. This is what I use on CentOS 6 Regards, Daniel -- Daniel Berteaud FIREWALL-SERVICES SARL. Société de Services en Logiciels Libres Technopôle Montesquieu 33650 MARTILLAC Tel : 05 56 64 15 32 Fax : 05 56 64 15 32 Web : http://www.firewall-services.com -- libvir-list mailing list libvir-list@redhat.com mailto:libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Umar Draz Network Architect -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Migration issue php-libvirt
Hi, the interesting thing is that you use constructor as $conn = new Libvirt('connection-uri'); You should be using libvirt_connect() API instead. See [1] for example. Not all of the defines are defined in the libvirt-php scope, that is correct and patches are welcome :-) Thanks, Michal [1] http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=tests/test-domain-create.phpt;h=1bcccb8871fd908a0cb90cba9a390fb9e87a97f4;hb=HEAD On 10/17/2013 11:45 AM, Claudio Bley wrote: [Repeat: please, don't top post on technical lists.] At Thu, 17 Oct 2013 14:26:33 +0500, Umar Draz wrote: Here is the php_error_logs -- *[17-Oct-2013 05:17:42 America/New_York] PHP Notice: Use of undefined constant VIR_MIGRATE_UNSAFE - assumed 'VIR_MIGRATE_UNSAFE' in /home/www/virtspace/inc/mig.php on line 21* *[17-Oct-2013 05:17:42 America/New_York] PHP Notice: Use of undefined constant VIR_MIGRATE_OFFLINE - assumed 'VIR_MIGRATE_OFFLINE' in /home/www/virtspace/inc/mig.php on line 21* According to above php_notices, both VIR_OFFLINE AND VIR_UNSAFE options are not available. Indeed, looking at the libvirt-php code (http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=a149662272016e946d53f4589722d090ceccdbcf;hb=HEAD), these constants are not defined yet. The wrapper is lacking the following constants, which you can easily define yourself in your PHP script: VIR_MIGRATE_CHANGE_PROTECTION = 256 VIR_MIGRATE_UNSAFE = 512 VIR_MIGRATE_OFFLINE= 1024 VIR_MIGRATE_COMPRESSED = 2048 Claudio -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] api-docs: Fix description of virConnectGetType() API function
This fixes the description of virConnectGetType() API function in API documentation to match the real functionality that it can be used to get driver name. Signed-off-by: Michal Novotny minov...@redhat.com --- src/libvirt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libvirt.c b/src/libvirt.c index 665b30b..a1d33b6 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -1581,7 +1581,8 @@ virConnectSupportsFeature(virConnectPtr conn, int feature) * virConnectGetType: * @conn: pointer to the hypervisor connection * - * Get the name of the Hypervisor software used. + * Get the name of the Hypervisor driver used. This is merely the driver name so for KVM + * it is still returning QEMU as QEMU driver is being used for KVM virtualization as well. * * Returns NULL in case of error, a static zero terminated string otherwise. * -- 1.7.11.7 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] qemu: Fix connectGetType() API
This patch fixes qemuConnectGetType() API function to return KVM if appropriate, i.e. when /dev/kvm exists as the KVM module is loaded. No further check is being done so it's merely showing the possibility that KVM virtualization is available on the host however we don't have any guest information (as it's connection-only related) so we cannot sure we can use KVM. This can be useful to identify we have KVM (Virt Support) available on the host if host and guest archs are the same. Testing: Done using a simple application with C source code below. [before patch applied]$ ./test Hypervisor type: QEMU [after patch applied]$ ./test Hypervisor type: KVM $ Testing C code: int main() { virConnectPtr conn = NULL; conn = virConnectOpen(qemu:///system); if (!conn) return 1; printf(Hypervisor type: %s\n, virConnectGetType(conn)); virConnectClose(conn); return 0; } Compiled on F-17 x86_64 host using: gcc -o test test.c -lvirt Signed-off-by: Michal Novotny minov...@redhat.com --- src/qemu/qemu_driver.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9b5d126..b770967 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1132,6 +1132,16 @@ static const char *qemuConnectGetType(virConnectPtr conn ATTRIBUTE_UNUSED) { if (virConnectGetTypeEnsureACL(conn) 0) return NULL; +/* + * If KVM is available for the host architecture then report KVM support. + * This approach merely shows it is possible to have KVM support as module is + * loaded however if you select different architecture, e.g. ARM on x86_64 host, + * the KVM option will not be available as there is no KVM virtualization + * support for ARM architecture that could be running on top of x86_64 host. + */ +if (access(/dev/kvm, F_OK) == 0) +return KVM; + return QEMU; } -- 1.7.11.7 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php] bug in libvirt_domain_change_vcpus()
On 09/10/2013 10:09 AM, Daniel P. Berrange wrote: On Mon, Sep 09, 2013 at 06:51:54PM +0200, Michal Novotny wrote: Hi Olivier, this is not really a bug as it's intended. The libvirt_domain_change_vcpus() is not the same as (yet unimplemented) virDomainSetVcpus() API so it's not bug. I realize that naming could be a little confusing so if you like, feel free to rename libvirt_domain_change_vcpus() to libvirt_domain_xml_change_vcpus() as this API should be used to change number of vCPUS in the domain XML itself and implement libvirt_domain_set_vcpus() calling real virDomainSetVcpus() API function. That function is also buggy in that it will silently turn a transient guest into a persistent guest, which is almost certainly not what a caller would expect Daniel Ok, I guess dropping libvirt_domain_xml_change_vcpus() and implementing libvirt_domain_xml_set_vcpus() using the virDomainSetVcpus() API function is much better. Thanks, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Fix connectGetType() API
On 09/10/2013 03:19 PM, Daniel P. Berrange wrote: On Tue, Sep 10, 2013 at 03:06:29PM +0200, Michal Novotny wrote: This patch fixes qemuConnectGetType() API function to return KVM if appropriate, i.e. when /dev/kvm exists as the KVM module is loaded. No further check is being done so it's merely showing the possibility that KVM virtualization is available on the host however we don't have any guest information (as it's connection-only related) so we cannot sure we can use KVM. This can be useful to identify we have KVM (Virt Support) available on the host if host and guest archs are the same. NACK, you are confusing two different things. virConnectGetType is intended to return the libvirt driver name. This is *always* 'QEMU'. If you want to know whether kvm virt is possible or not, then query the capabilities XML. Daniel Ok, if this is merely returning the driver name wouldn't it be better to rename it to virConnectGetDriverName() ? According to documentation at [1] it's the name of the hypervisor so the hypervisor may be both QEMU or KVM so why to put QEMU if it's the driver name? At least fixing the documentation with information the function is returning the driver name used (and you cannot rely on it to know whether you're on KVM or QEMU) would be nice... Michal [1] http://libvirt.org/html/libvirt-libvirt.html#virConnectGetType -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php] bug in libvirt_domain_change_vcpus()
On 09/10/2013 10:09 AM, Daniel P. Berrange wrote: On Mon, Sep 09, 2013 at 06:51:54PM +0200, Michal Novotny wrote: Hi Olivier, this is not really a bug as it's intended. The libvirt_domain_change_vcpus() is not the same as (yet unimplemented) virDomainSetVcpus() API so it's not bug. I realize that naming could be a little confusing so if you like, feel free to rename libvirt_domain_change_vcpus() to libvirt_domain_xml_change_vcpus() as this API should be used to change number of vCPUS in the domain XML itself and implement libvirt_domain_set_vcpus() calling real virDomainSetVcpus() API function. That function is also buggy in that it will silently turn a transient guest into a persistent guest, which is almost certainly not what a caller would expect Daniel Thanks for information Daniel. You are correct. I did change the implementation to use virDomainSetVcpusFlags() API function instead. It's already committed to git [1]. Michal [1] http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=cff010a36e382ee26c10a8e467d61de75a73639b -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php] bug in libvirt_domain_change_vcpus()
Hi Olivier, this is not really a bug as it's intended. The libvirt_domain_change_vcpus() is not the same as (yet unimplemented) virDomainSetVcpus() API so it's not bug. I realize that naming could be a little confusing so if you like, feel free to rename libvirt_domain_change_vcpus() to libvirt_domain_xml_change_vcpus() as this API should be used to change number of vCPUS in the domain XML itself and implement libvirt_domain_set_vcpus() calling real virDomainSetVcpus() API function. Thanks, Michal On 09/09/2013 06:03 PM, Olivier Doucet wrote: Hello everyone, I think there is a bug in the current implementation of function libvirt_domain_change_vcpu(). When using this function (with second parameter = 2), I have the following error : Error setting maxvcpus=2: (domain_definition):8: Specification mandate value for attribute curre vcpu2/vcpu --^ If I'm right, the equivalent with 'virsh' binary is 'setvcpus', and this is working. If I look into source code (http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7ce2d01e464f4bd4921b464022ca105bcb4bde88;hb=HEAD#l4199) it seems this operation is done by rewriting the whole XML. I think we should use instead C function virDomainSetVcpus http://libvirt.org/html/libvirt-libvirt.html#virDomainSetVcpus What do you think ? Olivier -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php] bug in libvirt_domain_change_vcpus()
On 09/09/2013 06:51 PM, Michal Novotny wrote: Hi Olivier, this is not really a bug as it's intended. The libvirt_domain_change_vcpus() is not the same as (yet unimplemented) virDomainSetVcpus() API so it's not bug. I realize that naming could be a little confusing so if you like, feel free to rename libvirt_domain_change_vcpus() to libvirt_domain_xml_change_vcpus() as this API should be used to change number of vCPUS in the domain XML itself and implement libvirt_domain_set_vcpus() calling real virDomainSetVcpus() API function. Alternatively, for more control, we should implement virDomainSetVcpusFlags() API [1] instead that can affect live domain and also defined persistent domain according to the flags passed. Michal [1] http://libvirt.org/html/libvirt-libvirt.html#virDomainSetVcpusFlags Thanks, Michal On 09/09/2013 06:03 PM, Olivier Doucet wrote: Hello everyone, I think there is a bug in the current implementation of function libvirt_domain_change_vcpu(). When using this function (with second parameter = 2), I have the following error : Error setting maxvcpus=2: (domain_definition):8: Specification mandate value for attribute curre vcpu2/vcpu --^ If I'm right, the equivalent with 'virsh' binary is 'setvcpus', and this is working. If I look into source code (http://libvirt.org/git/?p=libvirt-php.git;a=blob;f=src/libvirt-php.c;h=7ce2d01e464f4bd4921b464022ca105bcb4bde88;hb=HEAD#l4199) it seems this operation is done by rewriting the whole XML. I think we should use instead C function virDomainSetVcpus http://libvirt.org/html/libvirt-libvirt.html#virDomainSetVcpus What do you think ? Olivier -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] How to get the host network stats
Hi, libvirt_domain_interface stats PHP API is calling virDomainInterfaceStats. For libvirt API please see http://www.libvirt.org/html/libvirt-libvirt.html#virDomainInterfaceStats Thanks, Michal On 07/02/2013 10:10 AM, Zhang, Yijing wrote: Hello there, I want to find how to get the host’s network stats by using libvirt. I found one from PHP API reference which is called libvirt_domain_interface_stats, I’m guessing it’s for guest since it’s ‘domain’. However, I’m not really sure. Looking forward to hear the answers from you guys. Thank you, Tracey -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v5] qemu: Implement CPUs check against machine type's cpu-max
On 07/01/2013 02:38 PM, Martin Kletzander wrote: On 06/26/2013 05:46 PM, Michal Novotny wrote: Implement check whether (maximum) vCPUs doesn't exceed machine type's cpu-max settings. Differences between v4 and v5 (this one): - Changed type to unsigned int - Renamed variable to maxCpus to match previous naming - When machines types are parsed from command line set maxCpus = 0 to don't show Differences between v3 and v4: - Rebased to latest libvirt version - Capability XML output extended by maxCpus field - Extended caps-qemu-kvm.xml test by maxCpus for one of test emulators On older versions of QEMU the check is disabled. Signed-off-by: Michal Novotny minov...@redhat.com --- I polished the commit message (removed the differences) and pushed the patch. Martin Thanks a lot! :-) Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] add support for libssh2 password from auth file
easily call something like: tTokenizer authMethodTokens = tokenize(authMethods, ,) and then check it using approach like: hasPasswordMethod = false; for (i = 0; i t.numTokens; i++) if (strcmp(t.tokens[i], password) == 0) hasPasswordMethod = true; I think libvirt already have some similar functions to do it, doesn't it? Thanks, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] add support for libssh2 password from auth file
On 06/28/2013 01:41 PM, David Maciejak wrote: On Fri, Jun 28, 2013 at 1:03 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: On 06/28/2013 12:28 PM, Peter Krempa wrote: On 06/27/13 14:31, David Maciejak wrote: Hi, I was discussing with Daniel about the best way to pass the ssh password when using such kind of uri: 'xen+libssh2://root@192.168.0.10?sshauth=password http://root@192.168.0.10?sshauth=password http://root@192.168.0.10?sshauth=password' As it seems passing the password in the uri is not a good option, maybe we can grab it from auth conf ? it seems it's not the case as now (tell me if i am wrong). I was planing on doing this stuff, but never managed to finish this. So enclosed a patch to add this feature. As you can see in virnetclient.c there is no virAuthGetPassword call, so the authfile is never used. The patch enclosed is modifying the function prototype to add virConnectPtr parameter (so remote_driver.c virNetClientNewLibSSH2 call has to be updated too and the corresponding .h too). Once we have access to virConnectPtr, as you will see in the patch we can check if authMethods is set to 'password' and grab the password from auth file by calling virAuthGetPassword. please use git format-patch and send-email in the future, it makes reviewing easier. See the attached patch for the review. Peter -- libvir-list mailing list libvir-list@redhat.com mailto:libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Hi all, Peter, you could have reformatted it for better replies on separate code hunks ;-) Like I did now ;-) Thanks for the review guys. ... I suggest tokenizing it after commas, like I'm doing for my personal projects I agree with Michal, using strstr instead of strcmp has also some drawbacks. Hi David, if libvirt doesn't have the tokenizer support yet, it may be a good RFE as I believe it could be really useful ;-) Peter, do you know about anything libvirt supports to tokenize string? Thanks, Michal regards, david -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] add support for libssh2 password from auth file
On 06/28/2013 01:48 PM, Daniel P. Berrange wrote: On Fri, Jun 28, 2013 at 01:43:44PM +0200, Michal Novotny wrote: if libvirt doesn't have the tokenizer support yet, it may be a good RFE as I believe it could be really useful ;-) Peter, do you know about anything libvirt supports to tokenize string? We have virStringSplit for tokenizing strings which have a fixed separator. Daniel That sounds good, however what about splitting the function to 2 separate functions, one accepting the second parameter as the separator, called e.g. virStringSplitBy() and second just calling the first one with the fixed separator? Wouldn't it be better? Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] add support for libssh2 password from auth file
On 06/28/2013 01:54 PM, Peter Krempa wrote: On 06/28/13 13:50, Michal Novotny wrote: On 06/28/2013 01:48 PM, Daniel P. Berrange wrote: On Fri, Jun 28, 2013 at 01:43:44PM +0200, Michal Novotny wrote: if libvirt doesn't have the tokenizer support yet, it may be a good RFE as I believe it could be really useful ;-) Peter, do you know about anything libvirt supports to tokenize string? We have virStringSplit for tokenizing strings which have a fixed separator. Daniel That sounds good, however what about splitting the function to 2 separate functions, one accepting the second parameter as the separator, called e.g. virStringSplitBy() and second just calling the first one with the fixed separator? Wouldn't it be better? I think the current state is more than sufficient: /** * virStringSplit: * @string: a string to split * @delim: a string which specifies the places at which to split * the string. The delimiter is not included in any of the resulting * strings, unless @max_tokens is reached. * @max_tokens: the maximum number of pieces to split @string into. * If this is 0, the string is split completely. * * Splits a string into a maximum of @max_tokens pieces, using the given * @delim. If @max_tokens is reached, the remainder of @string is * appended to the last token. * * As a special case, the result of splitting the empty string is an empty * vector, not a vector containing a single string. The reason for this * special case is that being able to represent a empty vector is typically * more useful than consistent handling of empty elements. If you do need * to represent empty elements, you'll need to check for the empty string * before calling virStringSplit(). * * Return value: a newly-allocated NULL-terminated array of strings. Use *virStringFreeList() to free it. */ char **virStringSplit(const char *string, const char *delim, size_t max_tokens) Ah, then I misunderstood the fixed separator thing ;-) I was thinking the delimiter it fixed. This one looks good ;-) David, you could use virStringSplit() instead ;-) Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4] qemu: Implement CPUs check against machine type's cpu-max
On 06/26/2013 04:17 PM, Martin Kletzander wrote: On 06/25/2013 05:44 PM, Michal Novotny wrote: Implement check whether (maximum) vCPUs doesn't exceed machine type's cpu-max settings. Differences between v3 and v4 (this one): - Rebased to latest libvirt version - Capability XML output extended by maxCpus field - Extended caps-qemu-kvm.xml test by maxCpus for one of test emulators On older versions of QEMU the check is disabled. Signed-off-by: Michal Novotny minov...@redhat.com --- docs/schemas/capability.rng | 5 src/conf/capabilities.c | 4 +++ src/conf/capabilities.h | 1 + src/qemu/qemu_capabilities.c | 41 +++- src/qemu/qemu_capabilities.h | 3 +- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 6 src/qemu/qemu_process.c | 27 ++ tests/capabilityschemadata/caps-qemu-kvm.xml | 16 +-- 9 files changed, 94 insertions(+), 10 deletions(-) [...] diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c [...] @@ -1789,9 +1801,11 @@ void virQEMUCapsDispose(void *obj) for (i = 0; i qemuCaps-nmachineTypes; i++) { VIR_FREE(qemuCaps-machineTypes[i]); VIR_FREE(qemuCaps-machineAliases[i]); +qemuCaps-machineMaxCpus[i] = -1; Pointless line. } VIR_FREE(qemuCaps-machineTypes); VIR_FREE(qemuCaps-machineAliases); +VIR_FREE(qemuCaps-machineMaxCpus); for (i = 0; i qemuCaps-ncpuDefinitions; i++) { VIR_FREE(qemuCaps-cpuDefinitions[i]); [...] diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 64a4b1d..7088747 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -234,7 +234,8 @@ size_t virQEMUCapsGetMachineTypes(virQEMUCapsPtr qemuCaps, char ***names); const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, const char *name); - +int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps, + const char *name); int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps, size_t *nmachines, virCapsGuestMachinePtr **machines); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 3d9afa3..06ae4c5 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -654,6 +654,7 @@ struct _qemuMonitorMachineInfo { char *name; bool isDefault; char *alias; +int cpu_max; This parameter should be unified to match the previous naming (maxCpus) as cpu_max might be misunderstood as a maximum cpu number, not the maximum number of cpus. }; int qemuMonitorGetMachines(qemuMonitorPtr mon, [...] diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5a0f18b..3146ce2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3330,6 +3330,30 @@ error: } +static bool +qemuValidateCpuMax(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) +{ +int cpu_max; + +cpu_max = virQEMUCapsGetMachineMaxCpus(qemuCaps, def-os.machine); +if (!cpu_max) +return true; + +if (def-vcpus cpu_max) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + %s, _(CPUs greater than specified machine type limit)); +return false; +} + This check is pointless since it's guaranteed that vcpus = maxvcpus. +if (def-maxvcpus cpu_max) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + %s, _(Maximum CPUs greater than specified machine type limit)); +return false; +} + +return true; +} + int qemuProcessStart(virConnectPtr conn, virQEMUDriverPtr driver, virDomainObjPtr vm, Other that that the patch looks fine, but I'd wait with the push after release. If nobody is against that (and against the changes I proposed), I'll push this after the release. Martin Ok Martin, would you like me to do the changes you proposed or will you refresh the patch yourself and no need to submit v5 ? Thanks, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v4] qemu: Implement CPUs check against machine type's cpu-max
On 06/26/2013 04:29 PM, Martin Kletzander wrote: On 06/26/2013 04:20 PM, Michal Novotny wrote: On 06/26/2013 04:17 PM, Martin Kletzander wrote: On 06/25/2013 05:44 PM, Michal Novotny wrote: Implement check whether (maximum) vCPUs doesn't exceed machine type's cpu-max settings. Differences between v3 and v4 (this one): - Rebased to latest libvirt version - Capability XML output extended by maxCpus field - Extended caps-qemu-kvm.xml test by maxCpus for one of test emulators On older versions of QEMU the check is disabled. Signed-off-by: Michal Novotny minov...@redhat.com --- docs/schemas/capability.rng | 5 src/conf/capabilities.c | 4 +++ src/conf/capabilities.h | 1 + src/qemu/qemu_capabilities.c | 41 +++- src/qemu/qemu_capabilities.h | 3 +- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 6 src/qemu/qemu_process.c | 27 ++ tests/capabilityschemadata/caps-qemu-kvm.xml | 16 +-- 9 files changed, 94 insertions(+), 10 deletions(-) [...] diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c [...] @@ -1789,9 +1801,11 @@ void virQEMUCapsDispose(void *obj) for (i = 0; i qemuCaps-nmachineTypes; i++) { VIR_FREE(qemuCaps-machineTypes[i]); VIR_FREE(qemuCaps-machineAliases[i]); +qemuCaps-machineMaxCpus[i] = -1; Pointless line. } VIR_FREE(qemuCaps-machineTypes); VIR_FREE(qemuCaps-machineAliases); +VIR_FREE(qemuCaps-machineMaxCpus); for (i = 0; i qemuCaps-ncpuDefinitions; i++) { VIR_FREE(qemuCaps-cpuDefinitions[i]); [...] diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 64a4b1d..7088747 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -234,7 +234,8 @@ size_t virQEMUCapsGetMachineTypes(virQEMUCapsPtr qemuCaps, char ***names); const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, const char *name); - +int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps, + const char *name); int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps, size_t *nmachines, virCapsGuestMachinePtr **machines); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 3d9afa3..06ae4c5 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -654,6 +654,7 @@ struct _qemuMonitorMachineInfo { char *name; bool isDefault; char *alias; +int cpu_max; This parameter should be unified to match the previous naming (maxCpus) as cpu_max might be misunderstood as a maximum cpu number, not the maximum number of cpus. }; int qemuMonitorGetMachines(qemuMonitorPtr mon, [...] diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 5a0f18b..3146ce2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3330,6 +3330,30 @@ error: } +static bool +qemuValidateCpuMax(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) +{ +int cpu_max; + +cpu_max = virQEMUCapsGetMachineMaxCpus(qemuCaps, def-os.machine); +if (!cpu_max) +return true; + +if (def-vcpus cpu_max) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + %s, _(CPUs greater than specified machine type limit)); +return false; +} + This check is pointless since it's guaranteed that vcpus = maxvcpus. +if (def-maxvcpus cpu_max) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + %s, _(Maximum CPUs greater than specified machine type limit)); +return false; +} + +return true; +} + int qemuProcessStart(virConnectPtr conn, virQEMUDriverPtr driver, virDomainObjPtr vm, Other that that the patch looks fine, but I'd wait with the push after release. If nobody is against that (and against the changes I proposed), I'll push this after the release. Martin Ok Martin, would you like me to do the changes you proposed or will you refresh the patch yourself and no need to submit v5 ? If you'll make it with the v5 before the release, the added value will be that everyone will be offered the look to how the final patch looks like, but if you won't I'll push this one with the changes I proposed. Martin Feel free to push with changes you proposed, I need to take care of other stuff ;-) Thanks, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo
[libvirt] [PATCH v5] qemu: Implement CPUs check against machine type's cpu-max
Implement check whether (maximum) vCPUs doesn't exceed machine type's cpu-max settings. Differences between v4 and v5 (this one): - Changed type to unsigned int - Renamed variable to maxCpus to match previous naming - When machines types are parsed from command line set maxCpus = 0 to don't show Differences between v3 and v4: - Rebased to latest libvirt version - Capability XML output extended by maxCpus field - Extended caps-qemu-kvm.xml test by maxCpus for one of test emulators On older versions of QEMU the check is disabled. Signed-off-by: Michal Novotny minov...@redhat.com --- docs/schemas/capability.rng | 5 src/conf/capabilities.c | 4 +++ src/conf/capabilities.h | 1 + src/qemu/qemu_capabilities.c | 40 +++- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 6 + src/qemu/qemu_process.c | 21 +++ tests/capabilityschemadata/caps-qemu-kvm.xml | 16 +-- 9 files changed, 87 insertions(+), 10 deletions(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 106ca73..65c7c72 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -290,6 +290,11 @@ text/ /attribute /optional + optional +attribute name='maxCpus' + ref name='unsignedInt'/ +/attribute + /optional text/ /element /define diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index da92c78..5aeb2ab 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -853,6 +853,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(xml, machine); if (machine-canonical) virBufferAsprintf(xml, canonical='%s', machine-canonical); +if (machine-maxCpus 0) +virBufferAsprintf(xml, maxCpus='%d', machine-maxCpus); virBufferAsprintf(xml, %s/machine\n, machine-name); } @@ -871,6 +873,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(xml, machine); if (machine-canonical) virBufferAsprintf(xml, canonical='%s', machine-canonical); +if (machine-maxCpus 0) +virBufferAsprintf(xml, maxCpus='%d', machine-maxCpus); virBufferAsprintf(xml, %s/machine\n, machine-name); } virBufferAddLit(xml, /domain\n); diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index abcf6de..6c7efde 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -46,6 +46,7 @@ typedef virCapsGuestMachine *virCapsGuestMachinePtr; struct _virCapsGuestMachine { char *name; char *canonical; +unsigned int maxCpus; }; typedef struct _virCapsGuestDomainInfo virCapsGuestDomainInfo; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c4e076a..969b001 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -256,6 +256,7 @@ struct _virQEMUCaps { size_t nmachineTypes; char **machineTypes; char **machineAliases; +unsigned int *machineMaxCpus; }; struct _virQEMUCapsCache { @@ -335,6 +336,7 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, { char *name = qemuCaps-machineTypes[defIdx]; char *alias = qemuCaps-machineAliases[defIdx]; +unsigned int maxCpus = qemuCaps-machineMaxCpus[defIdx]; memmove(qemuCaps-machineTypes + 1, qemuCaps-machineTypes, @@ -342,8 +344,12 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, memmove(qemuCaps-machineAliases + 1, qemuCaps-machineAliases, sizeof(qemuCaps-machineAliases[0]) * defIdx); +memmove(qemuCaps-machineMaxCpus + 1, +qemuCaps-machineMaxCpus, +sizeof(qemuCaps-machineMaxCpus[0]) * defIdx); qemuCaps-machineTypes[0] = name; qemuCaps-machineAliases[0] = alias; +qemuCaps-machineMaxCpus[0] = maxCpus; } /* Format is: @@ -390,7 +396,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, } if (VIR_REALLOC_N(qemuCaps-machineTypes, qemuCaps-nmachineTypes + 1) 0 || -VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0) { +VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0 || +VIR_REALLOC_N(qemuCaps-machineMaxCpus, qemuCaps-nmachineTypes + 1) 0) { VIR_FREE(name); VIR_FREE(canonical); virReportOOMError(); @@ -404,6 +411,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, qemuCaps-machineTypes[qemuCaps-nmachineTypes-1] = name; qemuCaps-machineAliases[qemuCaps-nmachineTypes-1] = NULL; } +/* When parsing
[libvirt] [PATCH v4] qemu: Implement CPUs check against machine type's cpu-max
Implement check whether (maximum) vCPUs doesn't exceed machine type's cpu-max settings. Differences between v3 and v4 (this one): - Rebased to latest libvirt version - Capability XML output extended by maxCpus field - Extended caps-qemu-kvm.xml test by maxCpus for one of test emulators On older versions of QEMU the check is disabled. Signed-off-by: Michal Novotny minov...@redhat.com --- docs/schemas/capability.rng | 5 src/conf/capabilities.c | 4 +++ src/conf/capabilities.h | 1 + src/qemu/qemu_capabilities.c | 41 +++- src/qemu/qemu_capabilities.h | 3 +- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 6 src/qemu/qemu_process.c | 27 ++ tests/capabilityschemadata/caps-qemu-kvm.xml | 16 +-- 9 files changed, 94 insertions(+), 10 deletions(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 106ca73..65c7c72 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -290,6 +290,11 @@ text/ /attribute /optional + optional +attribute name='maxCpus' + ref name='unsignedInt'/ +/attribute + /optional text/ /element /define diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index da92c78..5aeb2ab 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -853,6 +853,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(xml, machine); if (machine-canonical) virBufferAsprintf(xml, canonical='%s', machine-canonical); +if (machine-maxCpus 0) +virBufferAsprintf(xml, maxCpus='%d', machine-maxCpus); virBufferAsprintf(xml, %s/machine\n, machine-name); } @@ -871,6 +873,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(xml, machine); if (machine-canonical) virBufferAsprintf(xml, canonical='%s', machine-canonical); +if (machine-maxCpus 0) +virBufferAsprintf(xml, maxCpus='%d', machine-maxCpus); virBufferAsprintf(xml, %s/machine\n, machine-name); } virBufferAddLit(xml, /domain\n); diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index abcf6de..22b6fb6 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -46,6 +46,7 @@ typedef virCapsGuestMachine *virCapsGuestMachinePtr; struct _virCapsGuestMachine { char *name; char *canonical; +int maxCpus; }; typedef struct _virCapsGuestDomainInfo virCapsGuestDomainInfo; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c4e076a..89f41b8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -256,6 +256,7 @@ struct _virQEMUCaps { size_t nmachineTypes; char **machineTypes; char **machineAliases; +int *machineMaxCpus; }; struct _virQEMUCapsCache { @@ -335,6 +336,7 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, { char *name = qemuCaps-machineTypes[defIdx]; char *alias = qemuCaps-machineAliases[defIdx]; +int cpu_max = qemuCaps-machineMaxCpus[defIdx]; memmove(qemuCaps-machineTypes + 1, qemuCaps-machineTypes, @@ -342,8 +344,12 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, memmove(qemuCaps-machineAliases + 1, qemuCaps-machineAliases, sizeof(qemuCaps-machineAliases[0]) * defIdx); +memmove(qemuCaps-machineMaxCpus + 1, +qemuCaps-machineMaxCpus, +sizeof(qemuCaps-machineMaxCpus[0]) * defIdx); qemuCaps-machineTypes[0] = name; qemuCaps-machineAliases[0] = alias; +qemuCaps-machineMaxCpus[0] = cpu_max; } /* Format is: @@ -390,7 +396,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, } if (VIR_REALLOC_N(qemuCaps-machineTypes, qemuCaps-nmachineTypes + 1) 0 || -VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0) { +VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0 || +VIR_REALLOC_N(qemuCaps-machineMaxCpus, qemuCaps-nmachineTypes + 1) 0) { VIR_FREE(name); VIR_FREE(canonical); virReportOOMError(); @@ -404,6 +411,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, qemuCaps-machineTypes[qemuCaps-nmachineTypes-1] = name; qemuCaps-machineAliases[qemuCaps-nmachineTypes-1] = NULL; } +/* Value 0 means unknown as it's not exposed by QEMU binary */ +qemuCaps-machineMaxCpus[qemuCaps-nmachineTypes-1] = 0; } while ((p = next)); @@ -1764,11 +1773,14 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps
Re: [libvirt] [PATCH v4] qemu: Implement CPUs check against machine type's cpu-max
It has been accidentally sent twice. Please ignore and review just one version as both v4 are the same ;-) Also, it has been `make check` and `make syntax-check` tested and passed :-) Thanks, Michal On 06/25/2013 05:44 PM, Michal Novotny wrote: Implement check whether (maximum) vCPUs doesn't exceed machine type's cpu-max settings. Differences between v3 and v4 (this one): - Rebased to latest libvirt version - Capability XML output extended by maxCpus field - Extended caps-qemu-kvm.xml test by maxCpus for one of test emulators On older versions of QEMU the check is disabled. Signed-off-by: Michal Novotny minov...@redhat.com --- docs/schemas/capability.rng | 5 src/conf/capabilities.c | 4 +++ src/conf/capabilities.h | 1 + src/qemu/qemu_capabilities.c | 41 +++- src/qemu/qemu_capabilities.h | 3 +- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 6 src/qemu/qemu_process.c | 27 ++ tests/capabilityschemadata/caps-qemu-kvm.xml | 16 +-- 9 files changed, 94 insertions(+), 10 deletions(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 106ca73..65c7c72 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -290,6 +290,11 @@ text/ /attribute /optional + optional +attribute name='maxCpus' + ref name='unsignedInt'/ +/attribute + /optional text/ /element /define diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index da92c78..5aeb2ab 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -853,6 +853,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(xml, machine); if (machine-canonical) virBufferAsprintf(xml, canonical='%s', machine-canonical); +if (machine-maxCpus 0) +virBufferAsprintf(xml, maxCpus='%d', machine-maxCpus); virBufferAsprintf(xml, %s/machine\n, machine-name); } @@ -871,6 +873,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAddLit(xml, machine); if (machine-canonical) virBufferAsprintf(xml, canonical='%s', machine-canonical); +if (machine-maxCpus 0) +virBufferAsprintf(xml, maxCpus='%d', machine-maxCpus); virBufferAsprintf(xml, %s/machine\n, machine-name); } virBufferAddLit(xml, /domain\n); diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index abcf6de..22b6fb6 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -46,6 +46,7 @@ typedef virCapsGuestMachine *virCapsGuestMachinePtr; struct _virCapsGuestMachine { char *name; char *canonical; +int maxCpus; }; typedef struct _virCapsGuestDomainInfo virCapsGuestDomainInfo; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c4e076a..89f41b8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -256,6 +256,7 @@ struct _virQEMUCaps { size_t nmachineTypes; char **machineTypes; char **machineAliases; +int *machineMaxCpus; }; struct _virQEMUCapsCache { @@ -335,6 +336,7 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, { char *name = qemuCaps-machineTypes[defIdx]; char *alias = qemuCaps-machineAliases[defIdx]; +int cpu_max = qemuCaps-machineMaxCpus[defIdx]; memmove(qemuCaps-machineTypes + 1, qemuCaps-machineTypes, @@ -342,8 +344,12 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, memmove(qemuCaps-machineAliases + 1, qemuCaps-machineAliases, sizeof(qemuCaps-machineAliases[0]) * defIdx); +memmove(qemuCaps-machineMaxCpus + 1, +qemuCaps-machineMaxCpus, +sizeof(qemuCaps-machineMaxCpus[0]) * defIdx); qemuCaps-machineTypes[0] = name; qemuCaps-machineAliases[0] = alias; +qemuCaps-machineMaxCpus[0] = cpu_max; } /* Format is: @@ -390,7 +396,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, } if (VIR_REALLOC_N(qemuCaps-machineTypes, qemuCaps-nmachineTypes + 1) 0 || -VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0) { +VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0 || +VIR_REALLOC_N(qemuCaps-machineMaxCpus, qemuCaps-nmachineTypes + 1) 0) { VIR_FREE(name); VIR_FREE(canonical); virReportOOMError(); @@ -404,6 +411,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, qemuCaps
Re: [libvirt] [PATCH v3] qemu: Implement CPUs check against machine type's cpu-max
ping? On 04/17/2013 04:15 PM, Michal Novotny wrote: Implement check whether (maximum) vCPUs doesn't exceed machine type's cpu-max settings. On older versions of QEMU the check is disabled. Signed-off-by: Michal Novotny minov...@redhat.com --- src/qemu/qemu_capabilities.c | 38 +- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 7 +++ src/qemu/qemu_process.c | 27 +++ 5 files changed, 74 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d10c8aa..bbfe85f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -243,6 +243,7 @@ struct _virQEMUCaps { size_t nmachineTypes; char **machineTypes; char **machineAliases; +int *machineMaxCpus; }; struct _virQEMUCapsCache { @@ -322,6 +323,7 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, { char *name = qemuCaps-machineTypes[defIdx]; char *alias = qemuCaps-machineAliases[defIdx]; +int cpu_max = qemuCaps-machineMaxCpus[defIdx]; memmove(qemuCaps-machineTypes + 1, qemuCaps-machineTypes, @@ -329,8 +331,12 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, memmove(qemuCaps-machineAliases + 1, qemuCaps-machineAliases, sizeof(qemuCaps-machineAliases[0]) * defIdx); +memmove(qemuCaps-machineMaxCpus + 1, +qemuCaps-machineMaxCpus, +sizeof(qemuCaps-machineMaxCpus[0]) * defIdx); qemuCaps-machineTypes[0] = name; qemuCaps-machineAliases[0] = alias; +qemuCaps-machineMaxCpus[0] = cpu_max; } /* Format is: @@ -377,7 +383,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, } if (VIR_REALLOC_N(qemuCaps-machineTypes, qemuCaps-nmachineTypes + 1) 0 || -VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0) { +VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0 || +VIR_REALLOC_N(qemuCaps-machineMaxCpus, qemuCaps-nmachineTypes + 1) 0) { VIR_FREE(name); VIR_FREE(canonical); goto no_memory; @@ -390,6 +397,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, qemuCaps-machineTypes[qemuCaps-nmachineTypes-1] = name; qemuCaps-machineAliases[qemuCaps-nmachineTypes-1] = NULL; } +/* Value 0 means unknown as it's not exposed by QEMU binary */ +qemuCaps-machineMaxCpus[qemuCaps-nmachineTypes-1] = 0; } while ((p = next)); @@ -1718,6 +1727,8 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) goto no_memory; if (VIR_ALLOC_N(ret-machineAliases, qemuCaps-nmachineTypes) 0) goto no_memory; +if (VIR_ALLOC_N(ret-machineMaxCpus, qemuCaps-nmachineTypes) 0) +goto no_memory; ret-nmachineTypes = qemuCaps-nmachineTypes; for (i = 0 ; i qemuCaps-nmachineTypes ; i++) { if (!(ret-machineTypes[i] = strdup(qemuCaps-machineTypes[i]))) @@ -1725,6 +1736,7 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) if (qemuCaps-machineAliases[i] !(ret-machineAliases[i] = strdup(qemuCaps-machineAliases[i]))) goto no_memory; +ret-machineMaxCpus[i] = qemuCaps-machineMaxCpus[i]; } return ret; @@ -1923,6 +1935,25 @@ const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, } +int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps, + const char *name) +{ +size_t i; + +if (!name) +return 0; + +for (i = 0 ; i qemuCaps-nmachineTypes ; i++) { +if (!qemuCaps-machineMaxCpus[i]) +continue; +if (STREQ(qemuCaps-machineTypes[i], name)) +return qemuCaps-machineMaxCpus[i]; +} + +return 0; +} + + static int virQEMUCapsProbeQMPCommands(virQEMUCapsPtr qemuCaps, qemuMonitorPtr mon) @@ -2073,6 +2104,10 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps, virReportOOMError(); goto cleanup; } +if (VIR_ALLOC_N(qemuCaps-machineMaxCpus, nmachines) 0) { +virReportOOMError(); +goto cleanup; +} for (i = 0 ; i nmachines ; i++) { if (machines[i]-alias) { @@ -2087,6 +2122,7 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps, } if (machines[i]-isDefault) defIdx = i; +qemuCaps-machineMaxCpus[i] = machines[i]-cpu_max; } qemuCaps-nmachineTypes = nmachines; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 4e76799..bd97e8d 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -223,7 +223,8 @@ size_t
Re: [libvirt] [PATCH 1/2] cpu-max: Implement cpu-max attribute into capabilities XML output
On 04/17/2013 11:25 AM, Daniel P. Berrange wrote: On Wed, Apr 17, 2013 at 03:21:04AM +0200, Michal Novotny wrote: Implement the cpu-max attribute into virConnectGetCapabilities() API output to allow caller to check maximum number of CPUs to be set for specified machine type. Signed-off-by: Michal Novotny minov...@redhat.com --- docs/schemas/capability.rng | 5 + src/conf/capabilities.c | 4 src/conf/capabilities.h | 1 + src/qemu/qemu_capabilities.c | 40 +++- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 7 +++ 7 files changed, 59 insertions(+), 2 deletions(-) We've previously said that we're not going to expand the information shown against individual machines in the capabilities, because this is not really scalable to cover all the capabilities you'd wish to show per machine. We'd end up with capabilties XML many MB in size. So I'm not really in favour of this patch. Daniel I don't know where you would like to put it however the check should remain there so if I guess just dropping XML/RNG related hunk would be enough, i.e. dropping: diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 106ca73..4f87397 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -290,6 +290,11 @@ text/ /attribute /optional + optional +attribute name='cpu-max' + ref name='unsignedInt'/ +/attribute + /optional text/ /element /define diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index c7ec92f..ab1bdd3 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -860,6 +860,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) for (j = 0 ; j caps-guests[i]-arch.defaultInfo.nmachines ; j++) { virCapsGuestMachinePtr machine = caps-guests[i]-arch.defaultInfo.machines[j]; virBufferAddLit(xml, machine); +if (machine-cpu_max 0) +virBufferAsprintf(xml, cpu-max='%d', machine-cpu_max); if (machine-canonical) virBufferAsprintf(xml, canonical='%s', machine-canonical); virBufferAsprintf(xml, %s/machine\n, machine-name); @@ -878,6 +880,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) for (k = 0 ; k caps-guests[i]-arch.domains[j]-info.nmachines ; k++) { virCapsGuestMachinePtr machine = caps-guests[i]-arch.domains[j]-info.machines[k]; virBufferAddLit(xml, machine); +if (machine-cpu_max 0) +virBufferAsprintf(xml, cpu-max='%d', machine-cpu_max); if (machine-canonical) virBufferAsprintf(xml, canonical='%s', machine-canonical); virBufferAsprintf(xml, %s/machine\n, machine-name); This won't add anything to the domain XML file but it will be checking the number of (maximum) virtual CPUs doesn't exceed the machine type limit. However, for libvirt-based tools (i.e. virt-manager and virt-install) it would be nice to have option to expose it. Possibly by writing a new API, like: int virConnectGetMaxCPUsForMachineType(virConnectPtr conn, char *name). This would simply return number of vCPUs for specified machine type (identifier by name variable). Or do you think just having the check but not exposing to any XML file will be fine? Thanks, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v2] qemu: Implement CPUs check against machine type's cpu-max
Implement check whether (maximum) vCPUs doesn't exceed machine type's cpu-max settings. Signed-off-by: Michal Novotny minov...@redhat.com --- src/conf/capabilities.h | 1 + src/qemu/qemu_capabilities.c | 40 +++- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 7 +++ src/qemu/qemu_process.c | 27 +++ 6 files changed, 77 insertions(+), 2 deletions(-) diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index abcf6de..16bf3de 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -46,6 +46,7 @@ typedef virCapsGuestMachine *virCapsGuestMachinePtr; struct _virCapsGuestMachine { char *name; char *canonical; +int cpu_max; }; typedef struct _virCapsGuestDomainInfo virCapsGuestDomainInfo; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d10c8aa..a03a643 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -243,6 +243,7 @@ struct _virQEMUCaps { size_t nmachineTypes; char **machineTypes; char **machineAliases; +int *machineMaxCpus; }; struct _virQEMUCapsCache { @@ -322,6 +323,7 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, { char *name = qemuCaps-machineTypes[defIdx]; char *alias = qemuCaps-machineAliases[defIdx]; +int cpu_max = qemuCaps-machineMaxCpus[defIdx]; memmove(qemuCaps-machineTypes + 1, qemuCaps-machineTypes, @@ -329,8 +331,12 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, memmove(qemuCaps-machineAliases + 1, qemuCaps-machineAliases, sizeof(qemuCaps-machineAliases[0]) * defIdx); +memmove(qemuCaps-machineMaxCpus + 1, +qemuCaps-machineMaxCpus, +sizeof(qemuCaps-machineMaxCpus[0]) * defIdx); qemuCaps-machineTypes[0] = name; qemuCaps-machineAliases[0] = alias; +qemuCaps-machineMaxCpus[0] = cpu_max; } /* Format is: @@ -377,7 +383,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, } if (VIR_REALLOC_N(qemuCaps-machineTypes, qemuCaps-nmachineTypes + 1) 0 || -VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0) { +VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0 || +VIR_REALLOC_N(qemuCaps-machineMaxCpus, qemuCaps-nmachineTypes + 1) 0) { VIR_FREE(name); VIR_FREE(canonical); goto no_memory; @@ -390,6 +397,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, qemuCaps-machineTypes[qemuCaps-nmachineTypes-1] = name; qemuCaps-machineAliases[qemuCaps-nmachineTypes-1] = NULL; } +/* Value 0 means unknown as it's not exposed by QEMU binary */ +qemuCaps-machineMaxCpus[qemuCaps-nmachineTypes-1] = 0; } while ((p = next)); @@ -1718,6 +1727,8 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) goto no_memory; if (VIR_ALLOC_N(ret-machineAliases, qemuCaps-nmachineTypes) 0) goto no_memory; +if (VIR_ALLOC_N(ret-machineMaxCpus, qemuCaps-nmachineTypes) 0) +goto no_memory; ret-nmachineTypes = qemuCaps-nmachineTypes; for (i = 0 ; i qemuCaps-nmachineTypes ; i++) { if (!(ret-machineTypes[i] = strdup(qemuCaps-machineTypes[i]))) @@ -1725,6 +1736,7 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) if (qemuCaps-machineAliases[i] !(ret-machineAliases[i] = strdup(qemuCaps-machineAliases[i]))) goto no_memory; +ret-machineMaxCpus[i] = qemuCaps-machineMaxCpus[i]; } return ret; @@ -1885,9 +1897,11 @@ int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps, goto no_memory; if (!(mach-canonical = strdup(qemuCaps-machineTypes[i]))) goto no_memory; +mach-cpu_max = qemuCaps-machineMaxCpus[i]; } else { if (!(mach-name = strdup(qemuCaps-machineTypes[i]))) goto no_memory; +mach-cpu_max = qemuCaps-machineMaxCpus[i]; } (*machines)[i] = mach; } @@ -1923,6 +1937,25 @@ const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, } +int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps, + const char *name) +{ +size_t i; + +if (!name) +return 0; + +for (i = 0 ; i qemuCaps-nmachineTypes ; i++) { +if (!qemuCaps-machineMaxCpus[i]) +continue; +if (STREQ(qemuCaps-machineTypes[i], name)) +return qemuCaps-machineMaxCpus[i]; +} + +return 0; +} + + static int virQEMUCapsProbeQMPCommands(virQEMUCapsPtr qemuCaps, qemuMonitorPtr mon) @@ -2073,6 +2106,10 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps, virReportOOMError(); goto cleanup
[libvirt] [PATCH v3] qemu: Implement CPUs check against machine type's cpu-max
Implement check whether (maximum) vCPUs doesn't exceed machine type's cpu-max settings. On older versions of QEMU the check is disabled. Signed-off-by: Michal Novotny minov...@redhat.com --- src/qemu/qemu_capabilities.c | 38 +- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 7 +++ src/qemu/qemu_process.c | 27 +++ 5 files changed, 74 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d10c8aa..bbfe85f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -243,6 +243,7 @@ struct _virQEMUCaps { size_t nmachineTypes; char **machineTypes; char **machineAliases; +int *machineMaxCpus; }; struct _virQEMUCapsCache { @@ -322,6 +323,7 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, { char *name = qemuCaps-machineTypes[defIdx]; char *alias = qemuCaps-machineAliases[defIdx]; +int cpu_max = qemuCaps-machineMaxCpus[defIdx]; memmove(qemuCaps-machineTypes + 1, qemuCaps-machineTypes, @@ -329,8 +331,12 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, memmove(qemuCaps-machineAliases + 1, qemuCaps-machineAliases, sizeof(qemuCaps-machineAliases[0]) * defIdx); +memmove(qemuCaps-machineMaxCpus + 1, +qemuCaps-machineMaxCpus, +sizeof(qemuCaps-machineMaxCpus[0]) * defIdx); qemuCaps-machineTypes[0] = name; qemuCaps-machineAliases[0] = alias; +qemuCaps-machineMaxCpus[0] = cpu_max; } /* Format is: @@ -377,7 +383,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, } if (VIR_REALLOC_N(qemuCaps-machineTypes, qemuCaps-nmachineTypes + 1) 0 || -VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0) { +VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0 || +VIR_REALLOC_N(qemuCaps-machineMaxCpus, qemuCaps-nmachineTypes + 1) 0) { VIR_FREE(name); VIR_FREE(canonical); goto no_memory; @@ -390,6 +397,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, qemuCaps-machineTypes[qemuCaps-nmachineTypes-1] = name; qemuCaps-machineAliases[qemuCaps-nmachineTypes-1] = NULL; } +/* Value 0 means unknown as it's not exposed by QEMU binary */ +qemuCaps-machineMaxCpus[qemuCaps-nmachineTypes-1] = 0; } while ((p = next)); @@ -1718,6 +1727,8 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) goto no_memory; if (VIR_ALLOC_N(ret-machineAliases, qemuCaps-nmachineTypes) 0) goto no_memory; +if (VIR_ALLOC_N(ret-machineMaxCpus, qemuCaps-nmachineTypes) 0) +goto no_memory; ret-nmachineTypes = qemuCaps-nmachineTypes; for (i = 0 ; i qemuCaps-nmachineTypes ; i++) { if (!(ret-machineTypes[i] = strdup(qemuCaps-machineTypes[i]))) @@ -1725,6 +1736,7 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) if (qemuCaps-machineAliases[i] !(ret-machineAliases[i] = strdup(qemuCaps-machineAliases[i]))) goto no_memory; +ret-machineMaxCpus[i] = qemuCaps-machineMaxCpus[i]; } return ret; @@ -1923,6 +1935,25 @@ const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps, } +int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps, + const char *name) +{ +size_t i; + +if (!name) +return 0; + +for (i = 0 ; i qemuCaps-nmachineTypes ; i++) { +if (!qemuCaps-machineMaxCpus[i]) +continue; +if (STREQ(qemuCaps-machineTypes[i], name)) +return qemuCaps-machineMaxCpus[i]; +} + +return 0; +} + + static int virQEMUCapsProbeQMPCommands(virQEMUCapsPtr qemuCaps, qemuMonitorPtr mon) @@ -2073,6 +2104,10 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps, virReportOOMError(); goto cleanup; } +if (VIR_ALLOC_N(qemuCaps-machineMaxCpus, nmachines) 0) { +virReportOOMError(); +goto cleanup; +} for (i = 0 ; i nmachines ; i++) { if (machines[i]-alias) { @@ -2087,6 +2122,7 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCaps, } if (machines[i]-isDefault) defIdx = i; +qemuCaps-machineMaxCpus[i] = machines[i]-cpu_max; } qemuCaps-nmachineTypes = nmachines; diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 4e76799..bd97e8d 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -223,7 +223,8 @@ size_t virQEMUCapsGetMachineTypes(virQEMUCapsPtr qemuCaps, char ***names); const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps
[libvirt] [PATCH 2/2] qemu: Implement validation for max-cpu in XML
Check whether vcpu setting or maxvcpu settings exceeds number of maximum cpus for selected machine type on virDomainDefineXML() and virDomainCreateXML() API calls or not. Signed-off-by: Michal Novotny minov...@redhat.com --- src/qemu/qemu_driver.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7c167b7..abe4f8b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1454,6 +1454,30 @@ qemuCanonicalizeMachine(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) } +static bool +qemuValidateCpuMax(virDomainDefPtr def, virQEMUCapsPtr qemuCaps) +{ +int cpu_max; + +cpu_max = virQEMUCapsGetMachineMaxCpus(qemuCaps, def-os.machine); +if (!cpu_max) +return true; + +if (def-vcpus cpu_max) { +virReportError(VIR_ERR_XML_DETAIL, + %s, _(CPUs greater than machine limit)); +return false; +} + +if (def-maxvcpus cpu_max) { +virReportError(VIR_ERR_XML_DETAIL, + %s, _(Maximum CPUs greater than machine limit)); +return false; +} + +return true; +} + static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char *xml, unsigned int flags) { virQEMUDriverPtr driver = conn-privateData; @@ -1491,6 +1515,9 @@ static virDomainPtr qemuDomainCreate(virConnectPtr conn, const char *xml, if (qemuCanonicalizeMachine(def, qemuCaps) 0) goto cleanup; +if (!qemuValidateCpuMax(def, qemuCaps)) +goto cleanup; + if (qemuDomainAssignAddresses(def, qemuCaps, NULL) 0) goto cleanup; @@ -5461,6 +5488,9 @@ static virDomainPtr qemuDomainDefine(virConnectPtr conn, const char *xml) { if (qemuCanonicalizeMachine(def, qemuCaps) 0) goto cleanup; +if (!qemuValidateCpuMax(def, qemuCaps)) +goto cleanup; + if (qemuDomainAssignAddresses(def, qemuCaps, NULL) 0) goto cleanup; -- 1.7.11.7 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/2] Add cpu-max to capabilities and implement checks
Add cpu-max to capabilities XML output for newer QEMU and implement checks whether the number of vCPUs/maximum vCPUS doesn't exceed machine limit. For older versions of QEMU cpu-max field is not present so the cpu-max is set to 0 to disable checking and act the same as without this patch. Signed-off-by: Michal Novotny minov...@redhat.com Michal Novotny (2): cpu-max: Implement cpu-max attribute into capabilities XML output qemu: Implement validation for max-cpu in XML docs/schemas/capability.rng | 5 + src/conf/capabilities.c | 4 src/conf/capabilities.h | 1 + src/qemu/qemu_capabilities.c | 40 +++- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_driver.c | 30 ++ src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 7 +++ 8 files changed, 89 insertions(+), 2 deletions(-) -- 1.7.11.7 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] cpu-max: Implement cpu-max attribute into capabilities XML output
Implement the cpu-max attribute into virConnectGetCapabilities() API output to allow caller to check maximum number of CPUs to be set for specified machine type. Signed-off-by: Michal Novotny minov...@redhat.com --- docs/schemas/capability.rng | 5 + src/conf/capabilities.c | 4 src/conf/capabilities.h | 1 + src/qemu/qemu_capabilities.c | 40 +++- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 7 +++ 7 files changed, 59 insertions(+), 2 deletions(-) diff --git a/docs/schemas/capability.rng b/docs/schemas/capability.rng index 106ca73..4f87397 100644 --- a/docs/schemas/capability.rng +++ b/docs/schemas/capability.rng @@ -290,6 +290,11 @@ text/ /attribute /optional + optional +attribute name='cpu-max' + ref name='unsignedInt'/ +/attribute + /optional text/ /element /define diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index c7ec92f..ab1bdd3 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -860,6 +860,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) for (j = 0 ; j caps-guests[i]-arch.defaultInfo.nmachines ; j++) { virCapsGuestMachinePtr machine = caps-guests[i]-arch.defaultInfo.machines[j]; virBufferAddLit(xml, machine); +if (machine-cpu_max 0) +virBufferAsprintf(xml, cpu-max='%d', machine-cpu_max); if (machine-canonical) virBufferAsprintf(xml, canonical='%s', machine-canonical); virBufferAsprintf(xml, %s/machine\n, machine-name); @@ -878,6 +880,8 @@ virCapabilitiesFormatXML(virCapsPtr caps) for (k = 0 ; k caps-guests[i]-arch.domains[j]-info.nmachines ; k++) { virCapsGuestMachinePtr machine = caps-guests[i]-arch.domains[j]-info.machines[k]; virBufferAddLit(xml, machine); +if (machine-cpu_max 0) +virBufferAsprintf(xml, cpu-max='%d', machine-cpu_max); if (machine-canonical) virBufferAsprintf(xml, canonical='%s', machine-canonical); virBufferAsprintf(xml, %s/machine\n, machine-name); diff --git a/src/conf/capabilities.h b/src/conf/capabilities.h index abcf6de..16bf3de 100644 --- a/src/conf/capabilities.h +++ b/src/conf/capabilities.h @@ -46,6 +46,7 @@ typedef virCapsGuestMachine *virCapsGuestMachinePtr; struct _virCapsGuestMachine { char *name; char *canonical; +int cpu_max; }; typedef struct _virCapsGuestDomainInfo virCapsGuestDomainInfo; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index d10c8aa..a03a643 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -243,6 +243,7 @@ struct _virQEMUCaps { size_t nmachineTypes; char **machineTypes; char **machineAliases; +int *machineMaxCpus; }; struct _virQEMUCapsCache { @@ -322,6 +323,7 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, { char *name = qemuCaps-machineTypes[defIdx]; char *alias = qemuCaps-machineAliases[defIdx]; +int cpu_max = qemuCaps-machineMaxCpus[defIdx]; memmove(qemuCaps-machineTypes + 1, qemuCaps-machineTypes, @@ -329,8 +331,12 @@ virQEMUCapsSetDefaultMachine(virQEMUCapsPtr qemuCaps, memmove(qemuCaps-machineAliases + 1, qemuCaps-machineAliases, sizeof(qemuCaps-machineAliases[0]) * defIdx); +memmove(qemuCaps-machineMaxCpus + 1, +qemuCaps-machineMaxCpus, +sizeof(qemuCaps-machineMaxCpus[0]) * defIdx); qemuCaps-machineTypes[0] = name; qemuCaps-machineAliases[0] = alias; +qemuCaps-machineMaxCpus[0] = cpu_max; } /* Format is: @@ -377,7 +383,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, } if (VIR_REALLOC_N(qemuCaps-machineTypes, qemuCaps-nmachineTypes + 1) 0 || -VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0) { +VIR_REALLOC_N(qemuCaps-machineAliases, qemuCaps-nmachineTypes + 1) 0 || +VIR_REALLOC_N(qemuCaps-machineMaxCpus, qemuCaps-nmachineTypes + 1) 0) { VIR_FREE(name); VIR_FREE(canonical); goto no_memory; @@ -390,6 +397,8 @@ virQEMUCapsParseMachineTypesStr(const char *output, qemuCaps-machineTypes[qemuCaps-nmachineTypes-1] = name; qemuCaps-machineAliases[qemuCaps-nmachineTypes-1] = NULL; } +/* Value 0 means unknown as it's not exposed by QEMU binary */ +qemuCaps-machineMaxCpus[qemuCaps-nmachineTypes-1] = 0; } while ((p = next)); @@ -1718,6 +1727,8 @@ virQEMUCapsPtr virQEMUCapsNewCopy(virQEMUCapsPtr qemuCaps) goto no_memory; if (VIR_ALLOC_N(ret-machineAliases, qemuCaps-nmachineTypes) 0) goto no_memory; +if (VIR_ALLOC_N(ret
Re: [libvirt] [libvirt-php PATCH 1/1] src/Makefile.am: use LDFLAGS for libvirt-php.so
On 01/31/2013 08:12 PM, stefan.k...@foss-group.ch wrote: --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 0d08448..18b868b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,7 +14,7 @@ build: $(CC) $(CFLAGS) -Wall -fpic -DCOMPILE_DL_LIBVIRT=1 $(PHPINC) -c -o libvirt-php.o libvirt-php.c $(LIBXML_CFLAGS) $(LIBVIRT_CFLAGS) $(DEFINES) $(CC) $(CFLAGS) -Wall -fpic -DCOMPILE_DL_LIBVIRT=1 -c -o vncfunc.o vncfunc.c $(PHPINC) $(LIBXML_CFLAGS) $(LIBVIRT_CFLAGS) $(DEFINES) $(CC) $(CFLAGS) -Wall -fpic -DCOMPILE_DL_LIBVIRT=1 -c -o sockets.o sockets.c $(PHPINC) $(LIBXML_CFLAGS) $(LIBVIRT_CFLAGS) $(DEFINES) - $(CC) $(CFLAGS) -Wall $(SHLIB_FLAGS) $(LIBS) -o $(PACKAGE).so vncfunc.o sockets.o libvirt-php.o -ldl -lvirt $(LIBXML_LIBS) $(LIBVIRT_LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -Wall $(SHLIB_FLAGS) $(LIBS) -o $(PACKAGE).so vncfunc.o sockets.o libvirt-php.o -ldl -lvirt $(LIBXML_LIBS) $(LIBVIRT_LIBS) $(ECHO) Extension compiled as $(PACKAGE).so install-exec-local: Thanks, pushed! Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php PATCH 1/1] Fix: mutlithreading compilation: set_error needs 2 params
On 02/01/2013 03:25 PM, stefan.k...@foss-group.ch wrote: --- src/libvirt-php.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libvirt-php.c b/src/libvirt-php.c index 7e7710c..0b8345a 100644 --- a/src/libvirt-php.c +++ b/src/libvirt-php.c @@ -1615,7 +1615,7 @@ PHP_FUNCTION(libvirt_node_get_cpu_stats) #else PHP_FUNCTION(libvirt_node_get_cpu_stats) { - set_error(Function is not supported by libvirt, support has been added in libvirt 0.9.3); + set_error(Function is not supported by libvirt, support has been added in libvirt 0.9.3 TSRMLS_CC); RETURN_FALSE; } #endif @@ -1718,7 +1718,7 @@ PHP_FUNCTION(libvirt_node_get_cpu_stats_for_each_cpu) #else PHP_FUNCTION(libvirt_node_get_cpu_stats_for_each_cpu) { - set_error(Function is not supported by libvirt, support has been added in libvirt 0.9.3); + set_error(Function is not supported by libvirt, support has been added in libvirt 0.9.3 TSRMLS_CC); RETURN_FALSE; } #endif @@ -1775,7 +1775,7 @@ PHP_FUNCTION(libvirt_node_get_mem_stats) #else PHP_FUNCTION(libvirt_node_get_mem_stats) { - set_error(Function is not supported by libvirt, support has been added in libvirt 0.9.3); + set_error(Function is not supported by libvirt, support has been added in libvirt 0.9.3 TSRMLS_CC); RETURN_FALSE; } #endif @@ -3168,7 +3168,7 @@ PHP_FUNCTION(libvirt_domain_get_screenshot_api) #else PHP_FUNCTION(libvirt_domain_get_screenshot_api) { - set_error(Function is not supported by libvirt, you need at least libvirt 0.9.2 to support this function); + set_error(Function is not supported by libvirt, you need at least libvirt 0.9.2 to support this function TSRMLS_CC); RETURN_FALSE; } #endif @@ -5453,13 +5453,13 @@ PHP_FUNCTION(libvirt_domain_migrate) GET_DOMAIN_FROM_ARGS(rrl|sl,zdomain,zdconn,flags,dname,dname_len,bandwidth); if ((domain-domain == NULL) || (domain-conn-conn == NULL)) { - set_error(Domain object is not valid); + set_error(Domain object is not valid TSRMLS_CC); RETURN_FALSE; } ZEND_FETCH_RESOURCE(dconn, php_libvirt_connection*, zdconn, -1, PHP_LIBVIRT_CONNECTION_RES_NAME, le_libvirt_connection); if ((dconn==NULL) || (dconn-conn==NULL)) { - set_error(Destination connection object is not valid); + set_error(Destination connection object is not valid TSRMLS_CC); RETURN_FALSE; } Thanks, pushed! Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php PATCH 1/1] $(LIBS) must be at the end in the linker line
On 02/04/2013 11:07 AM, stefan.k...@foss-group.ch wrote: --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 18b868b..3f2de38 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,7 +14,7 @@ build: $(CC) $(CFLAGS) -Wall -fpic -DCOMPILE_DL_LIBVIRT=1 $(PHPINC) -c -o libvirt-php.o libvirt-php.c $(LIBXML_CFLAGS) $(LIBVIRT_CFLAGS) $(DEFINES) $(CC) $(CFLAGS) -Wall -fpic -DCOMPILE_DL_LIBVIRT=1 -c -o vncfunc.o vncfunc.c $(PHPINC) $(LIBXML_CFLAGS) $(LIBVIRT_CFLAGS) $(DEFINES) $(CC) $(CFLAGS) -Wall -fpic -DCOMPILE_DL_LIBVIRT=1 -c -o sockets.o sockets.c $(PHPINC) $(LIBXML_CFLAGS) $(LIBVIRT_CFLAGS) $(DEFINES) - $(CC) $(CFLAGS) $(LDFLAGS) -Wall $(SHLIB_FLAGS) $(LIBS) -o $(PACKAGE).so vncfunc.o sockets.o libvirt-php.o -ldl -lvirt $(LIBXML_LIBS) $(LIBVIRT_LIBS) + $(CC) $(CFLAGS) $(LDFLAGS) -Wall $(SHLIB_FLAGS) -o $(PACKAGE).so vncfunc.o sockets.o libvirt-php.o -ldl -lvirt $(LIBXML_LIBS) $(LIBVIRT_LIBS) $(LIBS) $(ECHO) Extension compiled as $(PACKAGE).so install-exec-local: Thanks, pushed! Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php] Build failure with v0.4.7 due to malformatted html
Thanks for notification, it was missing in the repository so I've pushed my version of the file there. Thanks, Michal On 01/31/2013 02:31 PM, Stefan Kuhn wrote: I had a problem with the file docs/distros.html.in in libvirt-php-0.4.7 - The file is not in the repository! The error is: ### distros.html.tmp:96: element table: validity error : No declaration for attribute align of element table table align=center width=75% ^ make[2]: *** [distros.html] Error 1 ### This patch would fix it: ### --- ./docs/distros.html.in +++ ./docs/distros.html.in @@ -4,8 +4,8 @@ p There are several distributions that supports the libvirt-php in it's repositories. You can see the list in here:br / - table align=center width=75% -tr + table width=75% +tr align=center thDistribution/th thInstaller command/th thLink/th ### Thanks - Regards Stefan Kuhn On Tue, 2013-01-29 at 15:24 +0100, Michal Novotny wrote: Thanks for the patches! They's working fine and they're looking good so I've applied it, also, I've added your name e-mail to the AUTHORS file. Thanks again! Michal On 01/29/2013 12:47 PM, stefan.k...@foss-group.ch wrote: *** Please add new function libvirt_domain_migrate_to_uri2 for libirts virDomainMigrateToURI2(). *** Stefan Kuhn (2): Implement libvirt_domain_migrate_to_uri2 for virDomainMigrateToURI2 Document new funct. libvirt_domain_migrate_to_uri2 .../functions/libvirt-domain-get-job-info.xml | 1 + .../functions/libvirt-domain-migrate-to-uri.xml| 5 +- .../functions/libvirt-domain-migrate-to-uri2.xml | 134 + .../libvirt/functions/libvirt-domain-migrate.xml | 3 +- doc/source/libvirt/versions.xml| 1 + src/libvirt-php.c | 53 src/libvirt-php.h | 1 + 7 files changed, 195 insertions(+), 3 deletions(-) create mode 100644 doc/source/libvirt/functions/libvirt-domain-migrate-to-uri2.xml -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php PATCH 0/1] docs/distros.html.in: fix html validity
On 01/31/2013 02:54 PM, stefan.k...@foss-group.ch wrote: The error is: ### distros.html.tmp:96: element table: validity error : No declaration for attribute align of element table table align=center width=75% ^ make[2]: *** [distros.html] Error 1 ### Stefan Kuhn (1): docs/distros.html.in: fix html validity error docs/distros.html.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Thanks for the patch. Applied pushed :-) Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php PATCH 0/2] *** Add libvirt_domain_migrate_to_uri2() for virDomainMigrateToURI2() ***
Thanks for the patches! They's working fine and they're looking good so I've applied it, also, I've added your name e-mail to the AUTHORS file. Thanks again! Michal On 01/29/2013 12:47 PM, stefan.k...@foss-group.ch wrote: *** Please add new function libvirt_domain_migrate_to_uri2 for libirts virDomainMigrateToURI2(). *** Stefan Kuhn (2): Implement libvirt_domain_migrate_to_uri2 for virDomainMigrateToURI2 Document new funct. libvirt_domain_migrate_to_uri2 .../functions/libvirt-domain-get-job-info.xml | 1 + .../functions/libvirt-domain-migrate-to-uri.xml| 5 +- .../functions/libvirt-domain-migrate-to-uri2.xml | 134 + .../libvirt/functions/libvirt-domain-migrate.xml | 3 +- doc/source/libvirt/versions.xml| 1 + src/libvirt-php.c | 53 src/libvirt-php.h | 1 + 7 files changed, 195 insertions(+), 3 deletions(-) create mode 100644 doc/source/libvirt/functions/libvirt-domain-migrate-to-uri2.xml -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php][PATCH 00/20] compilation under OS X and various
Hi Tugdual! Thanks for the patch series. I've applied and tested it and it's working great! Thanks again for the series. I've noted your major contribution in the AUTHORS file with big thanks going to you :-) Michal On 01/03/2013 10:34 AM, Tugdual Saunier wrote: These patches are the result of my work to get libvirt-php compiled under OS X. As I suceeded to compiled it, I found some bugs/warnings that are also fixed in the following commits. The most important is probably the vnc_get_bitmap and vnc_refresh_screen now working. Tugdual Saunier (20): Fixed compilation under OS X fixed a malloc_error_break in doc generation fixed wrong xpath in domain type retrieving fixed PHP warnings in uuid generation fixed warnings fixed resource counter changes in libvirt_list_active_domains init array only if needed in libvirt_list_inactive_domains fixed wrong maxsize type in libvirt_logfile_set fixed wrong types in libvirt_check_version fixed wrong byte_order determination under other OS by improving it fixed wrong test on virConnectClose return value fixed vnc_get_bitmap Fixed infinite loop in vnc_refresh_screen fixed last warnings fixed doc generation under OSX Made tests more universal by using libvirt test driver reorder tests by dependency improved test-install.phpt, no more need of a random name fixed some segfault in test-domain-snapshot.phpt fixed wrong doc alignment for libvirt_domain_managedsave configure.ac | 10 + docs/Makefile.am | 14 +- src/Makefile.am | 5 +- src/libvirt-php.c| 330 +-- src/libvirt-php.h| 16 +- src/vncfunc.c| 25 +- tests/data/example-no-disk-and-media.xml | 3 +- tests/functions.phpt | 8 + tests/php.ini| 2 + tests/runtests.sh| 11 +- tests/test-conn-limit.phpt | 2 +- tests/test-connect.phpt | 40 +--- tests/test-domain-create-and-coredump.phpt | 2 +- tests/test-domain-create-and-get-xpath.phpt | 4 +- tests/test-domain-create.phpt| 2 +- tests/test-domain-define-create-destroy.phpt | 2 +- tests/test-domain-define-undefine.phpt | 2 +- tests/test-domain-snapshot.phpt | 14 +- tests/test-get-emulator.phpt | 10 +- tests/test-install.phpt | 14 +- tests/test-logging.phpt | 6 +- tools/generate-api-docs.c| 1 + 22 files changed, 260 insertions(+), 263 deletions(-) create mode 100644 tests/data/test-libvirt-php.img create mode 100644 tests/php.ini -- 1.8.0.1 -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php PATCH] Add ability to managed save libvirt domains
On 06/27/2012 08:31 AM, Daniel Veillard wrote: On Sat, Jun 23, 2012 at 07:01:51AM +0400, y...@billing.fastvps.ru wrote: From: Pavel Odintsov pavel.odint...@gmail.com --- src/libvirt-php.c | 22 ++ src/libvirt-php.h |1 + 2 files changed, 23 insertions(+), 0 deletions(-) I see Michal actually commited your patch, thanks ! I'm also pushing the following to keep track of contributors :-) Adding authors of recent patches diff --git a/AUTHORS b/AUTHORS index 0999762..bfdeaa5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -19,6 +19,10 @@ There are also other people that have contributed to the proj Daniel P. Berrange berra...@redhat.com Tiziano Mueller dev-z...@gentoo.org Yukihiro Kawada warp.kaw...@gmail.com +Remi Collet r...@famillecollet.com +Ivo van den Abeelen ivovandenabee...@gmail.com +Tiziano Müller dev-z...@gentoo.org +Pavel Odintsov pavel.odint...@gmail.com If you would like to be listed in the contributors list feel free to clone this repository to your computer and Thanks a lot for this patch and commit Daniel and I apologize to anybody missing in the AUTHORS file before :-) Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Improve docs about compiling libvirt from GIT
On 05/24/2012 05:08 PM, Daniel P. Berrange wrote: From: Daniel P. Berrange berra...@redhat.com Add a note about setting the LIBVIRT_DRIVER_DIR env variable, explain --system and fix example to use --disable-werror --- docs/compiling.html.in | 51 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/docs/compiling.html.in b/docs/compiling.html.in index 49bc7ee..5a9d9ee 100644 --- a/docs/compiling.html.in +++ b/docs/compiling.html.in @@ -62,14 +62,57 @@ 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: + templates using the codeautogen.sh/code command. By default when + the codeconfiure/code script is run from within a GIT checkout, it Didn't you mean codeconfigure/codethere ? ;-) Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [libvirt-php PATCH] Fix installation of libvirt-php.ini
On 05/11/2012 05:31 PM, Ivo van den Abeelen wrote: Building/installing libvirt-php seems to create an incomplete libvirt-php.ini file. This patch solves this issue, and replaces the '#' comments (deprecated in PHP 5.4). --- src/Makefile.am | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 4efd960..dd08d36 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,14 +18,14 @@ install-exec-local: $(INSTALL) -m 644 -D $(PACKAGE).so $(DESTDIR)$(PHPEDIR)/$(PACKAGE).so $(INSTALL) -m 755 -d $(DESTDIR)$(PHPCDIR) $(ECHO) extension=$(PACKAGE).so $(DESTDIR)$(PHPCDIR)/libvirt-php.ini - $(ECHO) $(DESTDIR)$(PHPCDIR)/libvirt-php.ini - $(ECHO) [libvirt] $(DESTDIR)$(PHPCDIR)/libvirt-php.ini - $(ECHO) # Path to ISO images for VM installations $(DESTDIR)$(PHPCDIR)/libvirt-php.ini - $(ECHO) libvirt.iso_path=/var/lib/libvirt/images $(DESTDIR)$(PHPCDIR)/libvirt-php.ini - $(ECHO) # Path where disk images for new VMs should be created $(DESTDIR)$(PHPCDIR)/libvirt-php.ini - $(ECHO) libvirt.image_path=/var/lib/libvirt/images $(DESTDIR)$(PHPCDIR)/libvirt-php.ini - $(ECHO) # Limit maximum number of libvirt connections $(DESTDIR)$(PHPCDIR)/libvirt-php.ini - $(ECHO) libvirt.max_connections=5 $(DESTDIR)$(PHPCDIR)/libvirt-php.ini + $(ECHO) $(DESTDIR)$(PHPCDIR)/libvirt-php.ini + $(ECHO) [libvirt] $(DESTDIR)$(PHPCDIR)/libvirt-php.ini + $(ECHO) ; Path to ISO images for VM installations $(DESTDIR)$(PHPCDIR)/libvirt-php.ini + $(ECHO) libvirt.iso_path=/var/lib/libvirt/images $(DESTDIR)$(PHPCDIR)/libvirt-php.ini + $(ECHO) ; Path where disk images for new VMs should be created $(DESTDIR)$(PHPCDIR)/libvirt-php.ini + $(ECHO) libvirt.image_path=/var/lib/libvirt/images $(DESTDIR)$(PHPCDIR)/libvirt-php.ini + $(ECHO) ; Limit maximum number of libvirt connections $(DESTDIR)$(PHPCDIR)/libvirt-php.ini + $(ECHO) libvirt.max_connections=5 $(DESTDIR)$(PHPCDIR)/libvirt-php.ini uninstall-local: $(RM) -f $(DESTDIR)$(PHPCDIR)/$(PACKAGE).ini Thanks Ivo! I've applied it now. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Create domain using libvirt-php
Hi Ali, thanks for your e-mail, here are answers to your questions: 1) $iso_image is the location of ISO image to start installation from. This is the only supported installation source for now. 2) $disks is the array of disk settings, if you don't understand the description (array of disk devices for domain, consist of keys as 'path' (storage location), 'driver' (image type, e.g. 'raw' or 'qcow2'), 'bus' (e.g. 'ide', 'scsi'), 'dev' (device to be presented to the guest - e.g. 'hda'), 'size' (with 'M' or 'G' suffixes, like '10G' for 10 gigabytes image etc.) and 'flags' (VIR_DOMAIN_DISK_FILE or VIR_DOMAIN_DISK_BLOCK, optionally VIR_DOMAIN_DISK_ACCESS_ALL to allow access to the disk for all users on the host system)) then it's simply this array: $disk1 = array( path = /var/libvirt/images/vm.img, driver = raw, bus = ide, dev = hda, size = 10G, flags = VIR_DOMAIN_DISK_FILE | VIR_DOMAIN_DISK_ACCESS_ALL ); $disks = array( $disk1 ); This means just one disk image will be created for the VM, the image will be created at /var/libvirt/images/vm.img with size of 10 Gigabytes and it will be the raw image (like a normal hard-drive is, i.e. no backing file or anything), on the IDE bus, presented to the guest as /dev/hda device, the path (/var/libvirt/images/vm.img)is referring to a file on disk (VIR_DOMAIN_DISK_FILE) and not a partition/block device and we will allow the access to this disk to all users (VIR_DOMAIN_DISK_ACCESS_ALL). 3) $networks = a rray of network devices for domain, consists of keys as 'mac' (for MAC address), 'network' (for network name) and optional 'model' for model of NIC device $network1 = array( 'mac' = '00:11:22:33:44:55', 'network' = 'default', 'model' = 'e1000' ); $networks = array( $network1 ); This specifies that there will be one network interface with MAC address of 00:11:22:33:44:55 added to the guest. This interface will be presented to the guest as the e1000 NIC and will be connected to the network 'default'. 4) $flags - this is the OR'ed int field of domain flags, those can be: /* Domain flags */ DOMAIN_FLAG_FEATURE_ACPI - support ACPI in the guest DOMAIN_FLAG_FEATURE_APIC- support APIC in the guest DOMAIN_FLAG_FEATURE_PAE- support PAE in the guest DOMAIN_FLAG_CLOCK_LOCALTIME- use localtime offset in the guest instead of UTC offset (MS Windows requires localtime offset AFAIK) DOMAIN_FLAG_SOUND_AC97 - support AC'97 sound card in the guest For reference please see: http://libvirt.org/php/api-reference.html#libvirt_domain_new If you would like to see the project using it and the usage, you can look to the php-virt-control project at http://www.php-virt-control.org site. The project is maintained and developed by me and few others and it's open-source as well. You can clone it's source codes from the project git (link available on the website). Hope this helps! Michal On 04/04/2012 03:44 PM, Ali Raza Memon wrote: Hello...! I want to create a new domain using libvirt-php, and after creating I want to start it. I have seen this to create new domain:* libvirt_domain_new($conn, $name, $arch, $memMB, $maxmemMB, $vcpus, $iso_image, $disks, $networks, $flags)* So in the above sysntax what should I pass in $iso_image? $disk? $networks and $flag?? Please give me a complete example that can solve my problem. Thanks.. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [test-API PATCH 1/6] Slight cross-distribution support
On 03/27/2012 10:32 AM, Christophe Fergeau wrote: On Mon, Mar 26, 2012 at 02:42:17PM +0200, Michal Novotny wrote: Fedora is using /etc/redhat-release file so you use the same handling for Fedora and RHEL then it's fine. I also have a /etc/fedora-release on my f17. systemd people are pushing for standardization around http://www.freedesktop.org/software/systemd/man/os-release.html Christophe Christophe, that's right. Fedora is using /etc/fedora-release file but please not that there is also the /etc/redhat-release file which is symlink to /etc/fedora-release. Since the handling for both Fedora and RHEL is the same then it's fine to check the /etc/redhat-release file. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [test-API PATCH 1/6] Slight cross-distribution support
On 03/26/2012 02:30 PM, Peter Krempa wrote: On 03/24/2012 06:42 PM, Martin Kletzander wrote: There is no support for distributions without 'rpm' as a package manager. This patch modifies (at this time) the only distribution-specific import in order to ease the broadening of distribution list supported by libvirt-test-API. --- env_inspect.py = dist/redhat/env_inspect.py |0 generator.py | 12 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 dist/__init__.py create mode 100644 dist/redhat/__init__.py rename env_inspect.py = dist/redhat/env_inspect.py (100%) diff --git a/dist/__init__.py b/dist/__init__.py new file mode 100644 index 000..e69de29 diff --git a/dist/redhat/__init__.py b/dist/redhat/__init__.py new file mode 100644 index 000..e69de29 diff --git a/env_inspect.py b/dist/redhat/env_inspect.py similarity index 100% rename from env_inspect.py rename to dist/redhat/env_inspect.py diff --git a/generator.py b/generator.py index 6108963..4f4478b 100644 --- a/generator.py +++ b/generator.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# libvirt-test-API is copyright 2010 Red Hat, Inc. +# libvirt-test-API is copyright 2010, 2012 Red Hat, Inc. # # libvirt-test-API is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -23,10 +23,18 @@ import sys import traceback import mapper -import env_inspect from utils.Python import log from utils.Python import format +# Import of distribution-specific code. If this is needed somewhere +# else in the future, please don't copy-paste this, but create some +# sensible distribution-specific package +import os +for dist in os.listdir('dist'): +if os.path.exists('/etc/%s-release' % dist): +exec('from dist.%s import env_inspect' % dist) +break + Works great on Gentoo, but I'm afraid a bit that it could break Fedora if it uses a different version file name. (but I don't have any at hand so I can't test this ) Peter Fedora is using /etc/redhat-release file so you use the same handling for Fedora and RHEL then it's fine. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fixed URI parsing
*noVerify) +xenapiUtil_ParseQuery(virConnectPtr conn, virURIPtr uri, int *noVerify) { int result = 0; int i; diff --git a/src/xenapi/xenapi_utils.h b/src/xenapi/xenapi_utils.h index 40506d5..aa1ff74 100644 --- a/src/xenapi/xenapi_utils.h +++ b/src/xenapi/xenapi_utils.h @@ -23,9 +23,9 @@ # define __VIR_XENAPI_UTILS__ # include stdint.h -# include libxml/uri.h # include xen/api/xen_all.h # include internal.h +# include viruri.h # include domain_conf.h # define NETWORK_DEVID_SIZE (12) @@ -40,7 +40,7 @@ xenapiUtil_RequestPassword(virConnectAuthPtr auth, const char *username, const char *hostname); int -xenapiUtil_ParseQuery(virConnectPtr conn, xmlURIPtr uri, int *noVerify); +xenapiUtil_ParseQuery(virConnectPtr conn, virURIPtr uri, int *noVerify); enum xen_on_normal_exit actionShutdownLibvirt2XenapiEnum(enum virDomainLifecycleAction action); -- 1.7.3.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list I don't know whether my ACK would count however I've learned a lot (together with Martin) when helping out with this patch and cfg.mk studies and similar ;-) I will be pretty useful for the future (if I have time for writing libvirt patches among the patchwork work). Also, it may be pretty nice to document those things like the cfg.mk file and others somewhere in the HACKING file and document the scenario when it's appropriate to put functions in here, i.e. when the syntax-check should prohibit usage of some function (like xml* functions should be substituted by virURI* functions in this case and so on). Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] errors: Improve error reporting to log multiple errors instead of just the last one
This patch introduces a new structure called virErrorsPtr which can get all the errors that occurred since the connection open. The error callback function is being used as many times as necessary. The new public function called virGetAllErrors() has been introduced to get all the errors that occurred. Also, a new test called errorreport has been written to test the functionality of error logging for multiple error occurrences. Signed-off-by: Michal Novotny minov...@redhat.com --- include/libvirt/virterror.h | 14 ++ python/generator.py |1 + src/util/virterror.c | 99 src/util/virterror_internal.h |1 + tests/Makefile.am |9 +++- tests/errorreport.c | 74 ++ 6 files changed, 186 insertions(+), 12 deletions(-) create mode 100644 tests/errorreport.c diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h index e896d67..c7a8018 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -118,6 +118,19 @@ struct _virError { see note above */ }; +/* + * virErrors: + * + * A libvirt Errors array instance + */ +typedef struct _virErrors virErrors; +typedef virErrors *virErrorsPtr; +struct _virErrors { +virErrorPtr lastError; +unsigned int nerrors; +virErrorPtr errors; +}; + /** * virErrorNumber: * @@ -261,6 +274,7 @@ typedef void (*virErrorFunc) (void *userData, virErrorPtr error); */ virErrorPtrvirGetLastError (void); +virErrorsPtr virGetAllErrors (void); virErrorPtrvirSaveLastError(void); void virResetLastError (void); void virResetError (virErrorPtr err); diff --git a/python/generator.py b/python/generator.py index 6fee3a4..315eb51 100755 --- a/python/generator.py +++ b/python/generator.py @@ -356,6 +356,7 @@ skip_impl = ( 'virDomainSnapshotListChildrenNames', 'virConnGetLastError', 'virGetLastError', +'virGetAllErrors', 'virDomainGetInfo', 'virDomainGetState', 'virDomainGetControlInfo', diff --git a/src/util/virterror.c b/src/util/virterror.c index 380dc56..b03ae7c 100644 --- a/src/util/virterror.c +++ b/src/util/virterror.c @@ -190,11 +190,17 @@ static const char *virErrorDomainName(virErrorDomain domain) { static void virLastErrFreeData(void *data) { -virErrorPtr err = data; -if (!err) +virErrorsPtr errs = data; +if (!errs) return; -virResetError(err); -VIR_FREE(err); + +if (errs-lastError) { +virResetError(errs-lastError); +VIR_FREE(errs-lastError); +} +if (errs-errors) +VIR_FREE(errs-errors); +VIR_FREE(errs); } @@ -262,14 +268,18 @@ virCopyError(virErrorPtr from, static virErrorPtr virLastErrorObject(void) { -virErrorPtr err; -err = virThreadLocalGet(virLastErr); -if (!err) { -if (VIR_ALLOC(err) 0) +virErrorsPtr errs = NULL; + +errs = virThreadLocalGet(virLastErr); +if (!errs) { +if (VIR_ALLOC(errs) 0) +return NULL; +if (VIR_ALLOC(errs-lastError) 0) return NULL; -virThreadLocalSet(virLastErr, err); +virThreadLocalSet(virLastErr, errs); } -return err; + +return errs-lastError; } @@ -292,6 +302,27 @@ virGetLastError(void) return err; } +/* + * virGetAllErrors: + * + * Provide a pointer to all errors caught at the library level + * + * The error object is kept in thread local storage, so separate + * threads can safely access this concurrently. + * + * Returns a pointer to all errors caught or NULL if none occurred. + */ +virErrorsPtr +virGetAllErrors(void) +{ +virErrorsPtr errs; + +errs = virThreadLocalGet(virLastErr); +if (!errs || errs-nerrors == 0) +return NULL; +return errs; +} + /** * virSetError: * @newerr: previously saved error object @@ -316,11 +347,56 @@ virSetError(virErrorPtr newerr) virResetError(err); ret = virCopyError(newerr, err); + +/* Add error into the error array */ +virAddError(newerr); cleanup: errno = saved_errno; return ret; } +/* + * virAddError: + * @err: error pointer + * + * Add the error to the array of error pointer + */ +void +virAddError(virErrorPtr err) +{ +virErrorsPtr errs; + +/* Discard all error codes that mean 'no error' */ +if (!err || err-code == VIR_ERR_OK) +return; + +errs = virThreadLocalGet(virLastErr); + +/* Shouldn't happen but doesn't hurt to check */ +if (!errs) +return; + +if (errs-errors == NULL) { +if (VIR_ALLOC(errs-errors) 0) +return; +errs-nerrors = 0; +} +else { +if (VIR_REALLOC_N(errs-errors, errs-nerrors + 1) 0) +return; +} + +/* Insert data into errors array element */ +errs-errors[errs-nerrors
Re: [libvirt] [PATCH] errors: Improve error reporting to log multiple errors instead of just the last one
Oops, I'm sorry as this didn't pass the syntax check. To pass the syntax check the new add-on patch is necessary: diff --git a/src/util/virterror.c b/src/util/virterror.c index b03ae7c..55269b9 100644 --- a/src/util/virterror.c +++ b/src/util/virterror.c @@ -198,8 +198,7 @@ virLastErrFreeData(void *data) virResetError(errs-lastError); VIR_FREE(errs-lastError); } -if (errs-errors) -VIR_FREE(errs-errors); +VIR_FREE(errs-errors); VIR_FREE(errs); } With this applied on top of my patch it's working fine to pass all of the tests (make check) and also the syntax check. Also, when trying to debug the tests the gnulib tests are really annoying. Would somebody consider creating some alias like `make vircheck` to just do the libvirt tests, i.e. with bypassing the gnulib tests. If you debug some test then it's pretty annoying to run through the gnulib tests everytime you invoke `make check`. Michal On 01/19/2012 02:13 PM, Michal Novotny wrote: This patch introduces a new structure called virErrorsPtr which can get all the errors that occurred since the connection open. The error callback function is being used as many times as necessary. The new public function called virGetAllErrors() has been introduced to get all the errors that occurred. Also, a new test called errorreport has been written to test the functionality of error logging for multiple error occurrences. Signed-off-by: Michal Novotny minov...@redhat.com --- include/libvirt/virterror.h | 14 ++ python/generator.py |1 + src/util/virterror.c | 99 src/util/virterror_internal.h |1 + tests/Makefile.am |9 +++- tests/errorreport.c | 74 ++ 6 files changed, 186 insertions(+), 12 deletions(-) create mode 100644 tests/errorreport.c diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h index e896d67..c7a8018 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -118,6 +118,19 @@ struct _virError { see note above */ }; +/* + * virErrors: + * + * A libvirt Errors array instance + */ +typedef struct _virErrors virErrors; +typedef virErrors *virErrorsPtr; +struct _virErrors { +virErrorPtr lastError; +unsigned int nerrors; +virErrorPtr errors; +}; + /** * virErrorNumber: * @@ -261,6 +274,7 @@ typedef void (*virErrorFunc) (void *userData, virErrorPtr error); */ virErrorPtr virGetLastError (void); +virErrorsPtr virGetAllErrors (void); virErrorPtr virSaveLastError(void); void virResetLastError (void); void virResetError (virErrorPtr err); diff --git a/python/generator.py b/python/generator.py index 6fee3a4..315eb51 100755 --- a/python/generator.py +++ b/python/generator.py @@ -356,6 +356,7 @@ skip_impl = ( 'virDomainSnapshotListChildrenNames', 'virConnGetLastError', 'virGetLastError', +'virGetAllErrors', 'virDomainGetInfo', 'virDomainGetState', 'virDomainGetControlInfo', diff --git a/src/util/virterror.c b/src/util/virterror.c index 380dc56..b03ae7c 100644 --- a/src/util/virterror.c +++ b/src/util/virterror.c @@ -190,11 +190,17 @@ static const char *virErrorDomainName(virErrorDomain domain) { static void virLastErrFreeData(void *data) { -virErrorPtr err = data; -if (!err) +virErrorsPtr errs = data; +if (!errs) return; -virResetError(err); -VIR_FREE(err); + +if (errs-lastError) { +virResetError(errs-lastError); +VIR_FREE(errs-lastError); +} +if (errs-errors) +VIR_FREE(errs-errors); +VIR_FREE(errs); } @@ -262,14 +268,18 @@ virCopyError(virErrorPtr from, static virErrorPtr virLastErrorObject(void) { -virErrorPtr err; -err = virThreadLocalGet(virLastErr); -if (!err) { -if (VIR_ALLOC(err) 0) +virErrorsPtr errs = NULL; + +errs = virThreadLocalGet(virLastErr); +if (!errs) { +if (VIR_ALLOC(errs) 0) +return NULL; +if (VIR_ALLOC(errs-lastError) 0) return NULL; -virThreadLocalSet(virLastErr, err); +virThreadLocalSet(virLastErr, errs); } -return err; + +return errs-lastError; } @@ -292,6 +302,27 @@ virGetLastError(void) return err; } +/* + * virGetAllErrors: + * + * Provide a pointer to all errors caught at the library level + * + * The error object is kept in thread local storage, so separate + * threads can safely access this concurrently. + * + * Returns a pointer to all errors caught or NULL if none occurred. + */ +virErrorsPtr +virGetAllErrors(void) +{ +virErrorsPtr errs; + +errs = virThreadLocalGet(virLastErr
Re: [libvirt] [PATCH] errors: Improve error reporting to log multiple errors instead of just the last one
On 01/19/2012 02:20 PM, Daniel P. Berrange wrote: On Thu, Jan 19, 2012 at 02:13:59PM +0100, Michal Novotny wrote: This patch introduces a new structure called virErrorsPtr which can get all the errors that occurred since the connection open. The error callback function is being used as many times as necessary. The new public function called virGetAllErrors() has been introduced to get all the errors that occurred. This impl is effectively an unbounded memory leak, if you consider that applications will keep the same virConnectPtr open more or less forever. In addition any libvirt API that raises multiple errors should be considered broken, so I don't think we should have any such API for querying multiple errors. What is the situation that motivated this new API ? This is simple. When you have situation with e.g. disk or domain creation. It fails but you don't know why. Sometimes the disk creation may fail on insufficient permissions and sometimes there may be not enough space etc... The same for domain creation. Also, we've been discussing this with Peter and we've both agreed that it would be a nice feature of libvirt to have some API like this. I'm CCing Peter for his feedback on this (not the patch rather than the reason of implementation) as I have to admit that this patch would like some tweaking most likely but the issue here is not different as you're asking whether we really need this. Peter, could you please provide Daniel any other example why you would like this implemented? Thanks, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] errors: Improve error reporting to log multiple errors instead of just the last one
On 01/19/2012 02:28 PM, Daniel P. Berrange wrote: On Thu, Jan 19, 2012 at 02:25:55PM +0100, Michal Novotny wrote: On 01/19/2012 02:20 PM, Daniel P. Berrange wrote: On Thu, Jan 19, 2012 at 02:13:59PM +0100, Michal Novotny wrote: This patch introduces a new structure called virErrorsPtr which can get all the errors that occurred since the connection open. The error callback function is being used as many times as necessary. The new public function called virGetAllErrors() has been introduced to get all the errors that occurred. This impl is effectively an unbounded memory leak, if you consider that applications will keep the same virConnectPtr open more or less forever. In addition any libvirt API that raises multiple errors should be considered broken, so I don't think we should have any such API for querying multiple errors. What is the situation that motivated this new API ? This is simple. When you have situation with e.g. disk or domain creation. It fails but you don't know why. Sometimes the disk creation may fail on insufficient permissions and sometimes there may be not enough space etc... The same for domain creation. But for any single API call into libvirt, there is only one error that is relevant upon failure. If you are making a sequence of multiple API calls, you should check each one for an error, before trying the next call. Not doing so is simply an application bug Daniel I can see your point Daniel and not I don't recall what we were talking about with Peter exactly. Maybe he can recall so I'll leave it to him but the truth is that I've been struggling with the reason of failure and finally just the logging using the LIBVIRT_DEBUG=1 when running the daemon helped me and I've been stuck before using it since the error was masked by something AFAIK. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] can not get screen shot using libvirt-php
Hi, you have to install gvnc-tools package on your Fedora box (as you mentioned you're using Fedora). This is having the gvnccapture binary. Michal On 01/19/2012 04:43 PM, punit gupta wrote: sir i am able to connect to local system an gett all the parameters but i am not able to get screen shots it gives error Cannot find gvnccapture binary -- Punit Gupta M-Tect (jiit noida) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] pibvirt php help
Oh, that's interesting. So you can connect fine with the virsh but not libvirt-php? Now I may see your point, the issue is in the apache user. You need to use the apache-key-copy utility (bundled with the php-virt-control) to generate a key to your apache user account (provided the fact your apache is running under user apache). This will generate the key (if it doesn't exist) and transfer it to the destination machine using ssh-copy-id. The syntax for apache-key-copy is: apache-key-copy hostname_or_ip that should be: apache-key-copy 192.168.102.133 for your case. However it can copy only to root account and not any user account yet, i.e. you have to connect using qemu+ssh://root@192.168.102.133/system and for no other user than root is working yet. You can patch the apache-key-copy to include the optional user account name and send a patch to php-virt-control list if you want to. Michal On 01/19/2012 04:41 PM, punit gupta wrote: sir i am trying to create ssh connention and i am able to connect with out password from terminal using virsh -c qemu+ssh://punit@192.168.102.133/system http://punit@192.168.102.133/system but this is not working with libvirt-php binding error :for libvirt-php ssh connection Libvirt last error: cannot recv data: Resource temporarily unavailable my php code is ?php $res1=libvirt_connect(qemu+ssh://punit@192.168.102.133/system http://punit@192.168.102.133/system,false); print_r($res1); printf (\n); if ($res1==false) { echo (Libvirt last error: .libvirt_get_last_error()); } ? -- Punit Gupta M-Tect (jiit noida) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] kvm-qemu emulator problem
Hi, the libvirt XML configuration file is having the emulator set and if you start the guest using libvirt (e.g. using virsh start guest) then it's being used. You can find the path to the emulator used for the VM in //domain/devices/emulator xPath query applied on the XML file, i.e.: domain type='kvm' ... os type arch='i686' machine='pc-0.14'hvm/type boot dev='hd'/ /os devices emulator/usr/bin/qemu-kvm/emulator ... /devices /domain Here, the /usr/bin/qemu-kvm is the emulator string to be spawned. If you change into any other existing location it will work fine. Also, for x86_64 guest you should change the architecture type of OS from i686 to x86_64 (which is the //domain/os/type/@arch node). But beware, you should define the XML first and start it using the virsh start command since if you create it using virsh create then it's being created with default emulator and I don't know whether it's possible to change the default emulator. Hope this helps! Michal On 01/05/2012 10:14 AM, Pankaj Rawat wrote: Hi all , I am trying to use fvd for my guest machine for that I refer the link http://sites.google.com/site/tangchq/qemu-fvd now all works fine except the last step which said that if libvirt is used then the xml configuration file need to be changed to include the modified emulator *qemu-system-x86_64* The default path is /usr/libexec/qemu-kvm But the change in xml configuration file is of no use which is in */etc/libvirt/qemu* directory. Since it is created when the guest is created using virt-install. Well I don’t know how I can change the default path for emulator, so that qemu-system-x86_64 act as a default emulator can anyone help ? DISCLAIMER: --- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or NECHCL or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of NECHCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately. . --- -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] kvm-qemu emulator problem
On 01/05/2012 11:43 AM, Pankaj Rawat wrote: I created a xml file guestfvd.xml Then I made changes as u specified And when run command [root@localhost qemu]# virsh start guestfvd error: failed to get domain 'guestfvd' error: Domain not found: no domain with matching name 'guestfvd' Now this error make sence since we have'nt created a guest yet how can we start such one. Please correct me if I'm wrong Can you help me on this You forgot to define it first ;-) You have to define it using virsh define guestfvd.xml first and then start :-) The name of what guest to start have to be the same as the one in //domain/name node of xPath query applied to the XML file. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] kvm-qemu emulator problem
I don't have any experience with fvd however this is not libvirt-related issue rather than qemu-related. Please try to ask qemu guys how to fix this. Michal On 01/05/2012 12:04 PM, Pankaj Rawat wrote: Sorry for that I defined it now When I run the command [root@localhost qemu]# virsh start guestfvd error: Failed to start domain guestfvd error: internal error unknown disk format 'fvd' for /var/lib/libvirt/images/guestfvd I know this error sounds like the fvd is not installed but I havecompiled it and maked it myself Qemu-img command list the format fvd along with qed ,qcow2 The binary qemu-system-x86-64 isalso maked as a result of make install What to do now ??? -Original Message- From: Michal Novotny [mailto:minov...@redhat.com] Sent: Thursday, January 05, 2012 4:14 PM To: Pankaj Rawat Cc: libvir-list@redhat.com Subject: Re: [libvirt] kvm-qemu emulator problem On 01/05/2012 11:43 AM, Pankaj Rawat wrote: I created a xml file guestfvd.xml Then I made changes as u specified And when run command [root@localhost qemu]# virsh start guestfvd error: failed to get domain 'guestfvd' error: Domain not found: no domain with matching name 'guestfvd' Now this error make sence since we have'nt created a guest yet how can we start such one. Please correct me if I'm wrong Can you help me on this You forgot to define it first ;-) You have to define it using virsh define guestfvd.xml first and then start :-) The name of what guest to start have to be the same as the one in //domain/name node of xPath query applied to the XML file. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] kvm-qemu emulator problem
On 01/05/2012 12:34 PM, Daniel P. Berrange wrote: On Thu, Jan 05, 2012 at 12:07:40PM +0100, Michal Novotny wrote: I don't have any experience with fvd however this is not libvirt-related issue rather than qemu-related. Please try to ask qemu guys how to fix this. Actually it is a libvirt error message. if ((format = virStorageFileFormatTypeFromString(formatStr)) 0) { virDomainReportError(VIR_ERR_INTERNAL_ERROR, _(unknown disk format '%s' for %s), disk-driverType, disk-src); goto cleanup; } } else { We don't have any support for FVD in src/util/storage_file.[ch] We could add this in, but first we have to ask wether the FVD disk format actually has any future ? My understanding is that FVD is not going to be merged into QEMU, and that the good ideas from it, will used to create a QCow3 format. Regards, Daniel Oh, I didn't know that. I thought this is the message coming directly from qemu. Sorry for the confusion. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v5] Implement DNS SRV record into the bridge driver
On 01/02/2012 12:39 PM, Peter Krempa wrote: On 12/07/2011 11:58 AM, Michal Novotny wrote: Hi, this is the fifth version of my SRV record for DNSMasq patch rebased for the current codebase to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. There are some things written a better way in comparison with version 4, mainly there's no hack in tests/networkxml2argvtest.c and also the xPath context is changed to use a simpler query using the virXPathInt() function relative to the current node. Also, the patch is also fixing the networkxml2argv test to pass both checks, i.e. both unit tests and also syntax check. Please review, Michal Signed-off-by: Michal Novotnyminov...@redhat.com diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index 1be20f8..5ef4878 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -24,6 +24,8 @@ #ifndef __NETWORK_CONF_H__ # define __NETWORK_CONF_H__ +#define DNS_RECORD_LENGTH_SRV (512 - 30) /* Limit minus overhead as mentioned in RFC-2782 */ This line needs to be indented by one space to pass syntax check. Interesting. Even after installing cppi package on my F-16 x86_64 box it didn't fail because of preprocessor indentation test. Thanks for the catch Peter, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v5] Implement DNS SRV record into the bridge driver
Hi, this is the fifth version of my SRV record for DNSMasq patch rebased for the current codebase to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. There are some things written a better way in comparison with version 4, mainly there's no hack in tests/networkxml2argvtest.c and also the xPath context is changed to use a simpler query using the virXPathInt() function relative to the current node. Also, the patch is also fixing the networkxml2argv test to pass both checks, i.e. both unit tests and also syntax check. Please review, Michal Signed-off-by: Michal Novotny minov...@redhat.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 20 ++- docs/schemas/networkcommon.rng | 17 +++ src/conf/network_conf.c| 134 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ .../nat-network-dns-srv-record-minimal.argv| 16 +++ .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv| 16 +++ .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|2 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 15 files changed, 423 insertions(+), 9 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 02302fa..755d510 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -345,6 +345,7 @@ lt;domain name=example.com/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/gt; lt;host ip='192.168.122.2'gt; lt;hostnamegt;myhostlt;/hostnamegt; lt;hostnamegt;myhostaliaslt;/hostnamegt; @@ -396,6 +397,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.9/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 937e180..5d58fe4 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -216,11 +229,4 @@ /interleave /element /define - - define name='addr-family' -data type='string' - param name=pattern(ipv4)|(ipv6)/param -/data - /define - /grammar diff --git
Re: [libvirt] [PATCH v5] Implement DNS SRV record into the bridge driver
On 01/02/2012 04:21 PM, Daniel Veillard wrote: On Mon, Jan 02, 2012 at 03:23:54PM +0100, Michal Novotny wrote: Hi, this is the fifth version of my SRV record for DNSMasq patch rebased for the current codebase to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. There are some things written a better way in comparison with version 4, mainly there's no hack in tests/networkxml2argvtest.c and also the xPath context is changed to use a simpler query using the virXPathInt() function relative to the current node. Also, the patch is also fixing the networkxml2argv test to pass both checks, i.e. both unit tests and also syntax check. Please review, Yeah, it looks good to me, actually we should have pushed it before in december but I forgot it. Since it's relatively contained, I'm pushing it in spite of the freeze, we already delayed it over one release. Blame me if it breaks something it was my fault I forgot the patch ! ACK and pushed, thanks ! Daniel Thanks for pushing it and it's been tested also today and it compiled and all tests passed both check and syntax-check phases so don't worry, it shouldn't break anything :-) Thanks again for pushing it, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v5] Implement DNS SRV record into the bridge driver
Hi, this is the fifth version of my SRV record for DNSMasq patch rebased for the current codebase to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. There are some things written a better way in comparison with version 4, mainly there's no hack in tests/networkxml2argvtest.c and also the xPath context is changed to use a simpler query using the virXPathInt() function relative to the current node. Also, the patch is also fixing the networkxml2argv test to pass both checks, i.e. both unit tests and also syntax check. Please review, Michal Signed-off-by: Michal Novotny minov...@redhat.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 20 ++- docs/schemas/networkcommon.rng | 17 +++ src/conf/network_conf.c| 134 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ .../nat-network-dns-srv-record-minimal.argv| 16 +++ .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv| 16 +++ .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|2 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 15 files changed, 423 insertions(+), 9 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 02302fa..755d510 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -345,6 +345,7 @@ lt;domain name=example.com/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service='name' protocol='tcp' domain='test-domain-name' target='.' port='1024' priority='10' weight='10'/gt; lt;host ip='192.168.122.2'gt; lt;hostnamegt;myhostlt;/hostnamegt; lt;hostnamegt;myhostaliaslt;/hostnamegt; @@ -396,6 +397,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.9/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 937e180..5d58fe4 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -216,11 +229,4 @@ /interleave /element /define - - define name='addr-family' -data type='string' - param name=pattern(ipv4)|(ipv6)/param -/data - /define - /grammar diff --git
Re: [libvirt] In freeze for libvirt-0.9.8 and availability of rc2
On 12/07/2011 01:12 PM, Daniel P. Berrange wrote: On Sun, Dec 04, 2011 at 04:10:34PM +0800, Daniel Veillard wrote: On Fri, Dec 02, 2011 at 02:30:35PM +0100, Peter Krempa wrote: On 12/02/2011 01:42 AM, Daniel Veillard wrote: On Thu, Dec 01, 2011 at 02:11:24PM -0700, Eric Blake wrote: But that means we really are committing to an rc2. Definitely. For example there is apparently a problem with commit fa9595003d043df9f2efe95521c00898cef27106 that we ough to fix quickly too to allow further testing :-) Daniel The problem was caused by two threads that both were thinking they are having the buck and entering poll() which caused some clients to hang. It was possible due to a race condition and therefore was not 100% reproducible. It should be fixed now with: http://www.redhat.com/archives/libvir-list/2011-December/msg00116.html Indeed, the current git head works fine again for me, thanks a lot for chasing this :-) So I made an second release candidate available at: ftp://libvirt.org/libvirt/libvirt-0.9.8-rc2.tar.gz along with rpms, I also tagged git with it. Hopefully the builds on BSD and Windows should be fixed, it would be good if it could be tested on OsX and since there was a build done last month on Android, I wonder if this could be done again [1]. Thre is something very broken in the RPC code when an event loop is activated, which is resulting in frequent crashes. Fixing this is a release blocker IMHO. Attaching a demo program which crashes 50% of the time or more with GIT head. Daniel Daniel, I've been trying it myself using the syntax like: gcc -Wall -o libvirt-test `pkg-config --libs --cflags libvirt` -lpthread libvirt-test.c to run it both as root and non-root and also with a guest running and not-running and it never failed for me on my Intel(R) Core(TM)2 Duo CPU T9600 @ 2.80GHz i686 system with 4 GB of RAM (just 2.9 GB really available because of 32-bit system). I was thinking of adding this into the tests directory and putting it directly to the tests run by `make check`. What do you think about this? Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v4] Implement DNS SRV record into the bridge driver
Hi, this is the fourth version of my SRV record for DNSMasq patch rebased for the current codebase to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. This is basically un-reviewed version 3 of this patch rebased to the current codebase with changed version information to 0.9.9 as it's supposed to go in 0.9.9 or later because of current 0.9.8 features freeze. Also, the second part of this patch is fixing the networkxml2argv test to pass both checks, i.e. both unit tests and also syntax check. Please review, Michal Signed-off-by: Michal Novotny minov...@redhat.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 26 src/conf/network_conf.c| 130 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ tests/networkxml2argvdata/isolated-network.argv| 14 ++- .../networkxml2argvdata/nat-network-dns-hosts.argv | 12 ++- .../nat-network-dns-srv-record-minimal.argv| 16 +++ .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv| 16 +++ .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-txt-record.argv| 19 ++- tests/networkxml2argvdata/nat-network.argv | 19 ++- tests/networkxml2argvdata/netboot-network.argv | 17 ++- .../networkxml2argvdata/netboot-proxy-network.argv | 15 ++- tests/networkxml2argvdata/routed-network.argv |8 +- tests/networkxml2argvtest.c| 14 ++- .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 21 files changed, 501 insertions(+), 32 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 02302fa..79cb4ce 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -345,6 +345,7 @@ lt;domain name=example.com/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;host ip='192.168.122.2'gt; lt;hostnamegt;myhostlt;/hostnamegt; lt;hostnamegt;myhostaliaslt;/hostnamegt; @@ -396,6 +397,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.9/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 937e180..fac0eda 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore
Re: [libvirt] libvirt-php 0.4.5 and php 5.4
On 11/27/2011 05:31 PM, Remi Collet wrote: Hi, I'm working on updating PHP to 5.4.0 (probably a fedora 17 feature). libvirt 0.4.5 doesn't build because function_entry have been removed See http://news.php.net/php.pecl.dev/7123 Fix is trivial : s/function_entry/zend_function_entry/ Attcached patch solves this issue and also fixes a lot of compiler warning (unused variable, unset, ...) There is still a lot of warning... (most are trivial to fix) I Hope this helps. Remi. Hi Remi, thanks a lot for your patch. I've applied your patch as commit 0890040d [1]. I tried it on PHP-5.3.8 and it's working fine even on PHP-5.3.8 so this is fine. Thanks a lot for your patch! Michal [1] http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=089040dce425ce1af5d2ba63de4840abbe1640f9 -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Implement DNS SRV record into the bridge driver
On 08/11/2011 08:56 PM, Eric Blake wrote: On 08/11/2011 07:38 AM, Michal Novotny wrote: Please ignore previous mails (done by my sendmail was not working fine and please review this one instead). It may have also been an issue of sendmail sending from a different address, and your patches being stuck in the moderator queue waiting for approval of first-time posting from the new address. At any rate, it turned into quite the email storm :) Yeah, sorry about that. It was local issue IMHO since it was not even coming to my mailbox on neither gmail and on corporate mailbox so I guess the issue was caused by my sendmail. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] Implement DNS SRV record into the bridge driver
On 08/11/2011 08:56 PM, Eric Blake wrote: On 08/11/2011 07:38 AM, Michal Novotny wrote: Please ignore previous mails (done by my sendmail was not working fine and please review this one instead). It may have also been an issue of sendmail sending from a different address, and your patches being stuck in the moderator queue waiting for approval of first-time posting from the new address. At any rate, it turned into quite the email storm :) A rebase for latest libvirt codebase is necessary so I posted patch v3 right now. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3] Implement DNS SRV record into the bridge driver
Hi, this is the third version of my patch to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. Differences between v2 and v3: - Rebased for the latest version of libvirt (incl. commit 4a6ffae3b64287e63cab6f1ab40d162dcd898333 by Laine Stump) - Moved the VIR_FREE() call in virNetworkDNSDefFree() to the right location, i.e. after the condition there Differences between v1 and v2: - A minor rewrite of integer parsing functionality - Extend tests to test with both minimal and full set of attributes - Check for service name length implemented Signed-off-by: Michal Novotny minov...@redhat.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 26 src/conf/network_conf.c| 130 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ .../nat-network-dns-srv-record-minimal.argv|1 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv|1 + .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|2 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 tests/networkxml2xmltest.c |2 + 15 files changed, 387 insertions(+), 2 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 99031d0..51b1581 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -342,6 +342,7 @@ lt;mac address='00:16:3E:5D:C7:9E'/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;/dnsgt; lt;ip address=192.168.122.1 netmask=255.255.255.0gt; lt;dhcpgt; @@ -390,6 +391,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.5/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1c44471..dae2799 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -206,6 +219,19 @@ /element /define + define name='unsignedShort' +data type='integer' + param name=minInclusive0/param + param name=maxInclusive65535/param +/data + /define + + define name='protocol' +data type='string
Re: [libvirt] [PATCH] Implement DNS SRV record into the bridge driver
Thanks for your review, Daniel. I already sent v2 of the patch now ;-) Michal On 08/11/2011 04:42 AM, Daniel Veillard wrote: On Thu, Aug 11, 2011 at 10:13:34AM +0800, Daniel Veillard wrote: On Tue, Aug 09, 2011 at 05:50:55PM +0200, Michal Novotny wrote: Hi, this is the patch to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. Signed-off-by: Michal Novotny minov...@redhat.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 30 + src/conf/network_conf.c| 125 src/conf/network_conf.h| 14 ++ src/network/bridge_driver.c| 18 +++ .../nat-network-dns-srv-record.argv|1 + .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|1 + .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record.xml | 26 tests/networkxml2xmltest.c |1 + 12 files changed, 281 insertions(+), 1 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index ddfa77c..4f748c4 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -148,6 +148,7 @@ lt;mac address='00:16:3E:5D:C7:9E'/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;/dnsgt; lt;ip address=192.168.122.1 netmask=255.255.255.0gt; lt;dhcpgt; @@ -196,6 +197,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each srv record element defines a DNS SRV record +and has 2 mandatory and 4 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and you can define optional +target, port, priority and weight arguments. The body of the element +have to be set to some data and therefore it's a pair tag. +span class=sinceSince 0.9.5/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1c44471..413698a 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,22 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocol +choice + valuetcp/value + valueudp/value +/choice + /attribute + attribute name=domaintext//attribute + attribute name=targettext//attribute + attribute name=portref name=port-for-user//attribute Actually I just looked at http://tools.ietf.org/html/rfc2782 + attribute name=priorityref name=short-int//attribute + attribute name=weightref name=short-int//attribute +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -206,6 +222,20 @@ /element /define + define name=port-for-user +data type=integer + param name=minInclusive1024/param + param name=maxInclusive65535/param +/data + /define and the full set of allowed port values is correct for an SRV record page 3: Port The port on this target host of this service. The range is 0- 65535. This is a 16 bit unsigned integer in network byte order. This is often as specified in Assigned Numbers but need not be. is that a limitation of dnsmasq ? + define name=short-int +data type=integer + param name=minInclusive0/param + param name=maxInclusive127/param +/data + /define + define name='addr-family' data type='string' param name=pattern(ipv4)|(ipv6)/param diff --git
[libvirt] [PATCH v2] Implement DNS SRV record into the bridge driver
From: Michal Novotny mig...@gmail.com Hi, this is the second version of my patch to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. Differences between v1 and v2: - A minor rewrite of integer parsing functionality - Extend tests to test with both minimal and full set of attributes - Check for service name length implemented Signed-off-by: Michal Novotny minov...@redhat.com Signed-off-by: Michal Novotny mig...@gmail.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 26 src/conf/network_conf.c| 130 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ .../nat-network-dns-srv-record-minimal.argv|1 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv|1 + .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|2 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 tests/networkxml2xmltest.c |2 + tests/schematestutils.sh |4 + 16 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 99031d0..51b1581 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -342,6 +342,7 @@ lt;mac address='00:16:3E:5D:C7:9E'/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;/dnsgt; lt;ip address=192.168.122.1 netmask=255.255.255.0gt; lt;dhcpgt; @@ -390,6 +391,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.5/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1c44471..dae2799 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -206,6 +219,19 @@ /element /define + define name='unsignedShort' +data type='integer' + param name=minInclusive0/param + param name=maxInclusive65535/param +/data + /define + + define name='protocol' +data type='string' + param name='pattern'(tcp)|(udp)/param +/data + /define + define name='addr-family' data type
[libvirt] [PATCH v2] Implement DNS SRV record into the bridge driver
Hi, this is the second version of my patch to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. Differences between v1 and v2: - A minor rewrite of integer parsing functionality - Extend tests to test with both minimal and full set of attributes - Check for service name length implemented Signed-off-by: Michal Novotny minov...@redhat.com Signed-off-by: Michal Novotny mig...@gmail.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 26 src/conf/network_conf.c| 130 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ .../nat-network-dns-srv-record-minimal.argv|1 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv|1 + .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|2 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 tests/networkxml2xmltest.c |2 + tests/schematestutils.sh |4 + 16 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 99031d0..51b1581 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -342,6 +342,7 @@ lt;mac address='00:16:3E:5D:C7:9E'/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;/dnsgt; lt;ip address=192.168.122.1 netmask=255.255.255.0gt; lt;dhcpgt; @@ -390,6 +391,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.5/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1c44471..dae2799 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -206,6 +219,19 @@ /element /define + define name='unsignedShort' +data type='integer' + param name=minInclusive0/param + param name=maxInclusive65535/param +/data + /define + + define name='protocol' +data type='string' + param name='pattern'(tcp)|(udp)/param +/data + /define + define name='addr-family' data type='string' param name=pattern
[libvirt] [PATCH v2] Implement DNS SRV record into the bridge driver
Hi, this is the second version of my patch to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. Differences between v1 and v2: - A minor rewrite of integer parsing functionality - Extend tests to test with both minimal and full set of attributes - Check for service name length implemented Signed-off-by: Michal Novotny minov...@redhat.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 26 src/conf/network_conf.c| 130 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ .../nat-network-dns-srv-record-minimal.argv|1 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv|1 + .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|2 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 tests/networkxml2xmltest.c |2 + 16 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 99031d0..51b1581 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -342,6 +342,7 @@ lt;mac address='00:16:3E:5D:C7:9E'/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;/dnsgt; lt;ip address=192.168.122.1 netmask=255.255.255.0gt; lt;dhcpgt; @@ -390,6 +391,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.5/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1c44471..dae2799 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -206,6 +219,19 @@ /element /define + define name='unsignedShort' +data type='integer' + param name=minInclusive0/param + param name=maxInclusive65535/param +/data + /define + + define name='protocol' +data type='string' + param name='pattern'(tcp)|(udp)/param +/data + /define + define name='addr-family' data type='string' param name=pattern(ipv4)|(ipv6)/param diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index b11c482..517c4d6 100644
[libvirt] [PATCH v2] Implement DNS SRV record into the bridge driver
Hi, this is the second version of my patch to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. Differences between v1 and v2: - A minor rewrite of integer parsing functionality - Extend tests to test with both minimal and full set of attributes - Check for service name length implemented Signed-off-by: Michal Novotny minov...@redhat.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 26 src/conf/network_conf.c| 130 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ .../nat-network-dns-srv-record-minimal.argv|1 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv|1 + .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|2 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 tests/networkxml2xmltest.c |2 + tests/schematestutils.sh |4 + 16 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 99031d0..51b1581 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -342,6 +342,7 @@ lt;mac address='00:16:3E:5D:C7:9E'/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;/dnsgt; lt;ip address=192.168.122.1 netmask=255.255.255.0gt; lt;dhcpgt; @@ -390,6 +391,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.5/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1c44471..dae2799 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -206,6 +219,19 @@ /element /define + define name='unsignedShort' +data type='integer' + param name=minInclusive0/param + param name=maxInclusive65535/param +/data + /define + + define name='protocol' +data type='string' + param name='pattern'(tcp)|(udp)/param +/data + /define + define name='addr-family' data type='string' param name=pattern(ipv4)|(ipv6)/param diff --git a/src/conf
Re: [libvirt] [PATCH v2] Implement DNS SRV record into the bridge driver
Oops, sorry. This e-mail is not valid since I did try using git send-email but I was unable to see it in the archives nor my inbox so I guess the issue was caused by my sendmail daemon that was not working properly. Please ignore this e-mail. Thanks, Michal On 08/11/2011 03:21 PM, Michal Novotny wrote: From: Michal Novotny mig...@gmail.com Hi, this is the second version of my patch to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. Differences between v1 and v2: - A minor rewrite of integer parsing functionality - Extend tests to test with both minimal and full set of attributes - Check for service name length implemented Signed-off-by: Michal Novotny minov...@redhat.com Signed-off-by: Michal Novotny mig...@gmail.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 26 src/conf/network_conf.c| 130 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ .../nat-network-dns-srv-record-minimal.argv|1 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv|1 + .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|2 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 tests/networkxml2xmltest.c |2 + tests/schematestutils.sh |4 + 16 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 99031d0..51b1581 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -342,6 +342,7 @@ lt;mac address='00:16:3E:5D:C7:9E'/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;/dnsgt; lt;ip address=192.168.122.1 netmask=255.255.255.0gt; lt;dhcpgt; @@ -390,6 +391,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.5/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1c44471..dae2799 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name
Re: [libvirt] [PATCH v2] Implement DNS SRV record into the bridge driver
Please ignore previous mails (done by my sendmail was not working fine and please review this one instead). Thanks, Michal On 08/11/2011 03:22 PM, Michal Novotny wrote: Hi, this is the second version of my patch to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. Differences between v1 and v2: - A minor rewrite of integer parsing functionality - Extend tests to test with both minimal and full set of attributes - Check for service name length implemented Signed-off-by: Michal Novotny minov...@redhat.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 26 src/conf/network_conf.c| 130 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ .../nat-network-dns-srv-record-minimal.argv|1 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv|1 + .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|2 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 tests/networkxml2xmltest.c |2 + 16 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 99031d0..51b1581 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -342,6 +342,7 @@ lt;mac address='00:16:3E:5D:C7:9E'/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;/dnsgt; lt;ip address=192.168.122.1 netmask=255.255.255.0gt; lt;dhcpgt; @@ -390,6 +391,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.5/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1c44471..dae2799 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -206,6 +219,19 @@ /element /define + define name='unsignedShort' +data type='integer' + param name=minInclusive0/param + param name=maxInclusive65535/param +/data + /define + + define name
[libvirt] [PATCH v2] Implement DNS SRV record into the bridge driver
Hi, this is the second version of my patch to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. Differences between v1 and v2: - A minor rewrite of integer parsing functionality - Extend tests to test with both minimal and full set of attributes - Check for service name length implemented Signed-off-by: Michal Novotny minov...@redhat.com Signed-off-by: Michal Novotny mig...@gmail.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 26 src/conf/network_conf.c| 130 +++- src/conf/network_conf.h| 16 +++ src/network/bridge_driver.c| 43 +++ .../nat-network-dns-srv-record-minimal.argv|1 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.argv|1 + .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|2 + .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record-minimal.xml | 26 .../nat-network-dns-srv-record.xml | 26 tests/networkxml2xmltest.c |2 + tests/schematestutils.sh |4 + 16 files changed, 391 insertions(+), 2 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record-minimal.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 99031d0..51b1581 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -342,6 +342,7 @@ lt;mac address='00:16:3E:5D:C7:9E'/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;/dnsgt; lt;ip address=192.168.122.1 netmask=255.255.255.0gt; lt;dhcpgt; @@ -390,6 +391,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each codesrv/code record element defines a DNS SRV record +and has 2 mandatory and 5 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and the optional attributes are +target, port, priority, weight and domain as defined in DNS server SRV +RFC (RFC 2782). +span class=sinceSince 0.9.5/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1c44471..dae2799 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,19 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocolref name=protocol//attribute + optional +attribute name=domainref name=dnsName//attribute +attribute name=targettext//attribute +attribute name=portref name=unsignedShort//attribute +attribute name=priorityref name=unsignedShort//attribute +attribute name=weightref name=unsignedShort//attribute + /optional +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -206,6 +219,19 @@ /element /define + define name='unsignedShort' +data type='integer' + param name=minInclusive0/param + param name=maxInclusive65535/param +/data + /define + + define name='protocol' +data type='string' + param name='pattern'(tcp)|(udp)/param +/data + /define + define name='addr-family' data type='string' param name=pattern
[libvirt] [PATCH] Implement DNS SRV record into the bridge driver
Hi, this is the patch to the bridge driver and libvirt XML file to include support for the SRV records in the DNS. The syntax is based on DNSMasq man page and tests for both xml2xml and xml2argv were added as well. Signed-off-by: Michal Novotny minov...@redhat.com --- docs/formatnetwork.html.in | 12 ++ docs/schemas/network.rng | 30 + src/conf/network_conf.c| 125 src/conf/network_conf.h| 14 ++ src/network/bridge_driver.c| 18 +++ .../nat-network-dns-srv-record.argv|1 + .../nat-network-dns-srv-record.xml | 26 tests/networkxml2argvtest.c|1 + .../nat-network-dns-srv-record.xml | 26 .../nat-network-dns-srv-record.xml | 26 tests/networkxml2xmltest.c |1 + 12 files changed, 281 insertions(+), 1 deletions(-) create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlin/nat-network-dns-srv-record.xml create mode 100644 tests/networkxml2xmlout/nat-network-dns-srv-record.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index ddfa77c..4f748c4 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -148,6 +148,7 @@ lt;mac address='00:16:3E:5D:C7:9E'/gt; lt;dnsgt; lt;txt name=example value=example value /gt; + lt;srv service=name protocol=tcp domain=test-domain-name target=. port=1024 priority=10 weight=10/gt; lt;/dnsgt; lt;ip address=192.168.122.1 netmask=255.255.255.0gt; lt;dhcpgt; @@ -196,6 +197,17 @@ span class=sinceSince 0.9.3/span /dd /dl +dl + dtcodesrv/code/dt + ddThe codedns/code element can have also 0 or more codesrv/code +record elements. Each srv record element defines a DNS SRV record +and has 2 mandatory and 4 optional attributes. The mandatory attributes +are service name and protocol (tcp, udp) and you can define optional +target, port, priority and weight arguments. The body of the element +have to be set to some data and therefore it's a pair tag. +span class=sinceSince 0.9.5/span + /dd +/dl /dd dtcodeip/code/dt ddThe codeaddress/code attribute defines an IPv4 address in diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 1c44471..413698a 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -138,6 +138,22 @@ /element /zeroOrMore zeroOrMore +element name=srv + attribute name=servicetext//attribute + attribute name=protocol +choice + valuetcp/value + valueudp/value +/choice + /attribute + attribute name=domaintext//attribute + attribute name=targettext//attribute + attribute name=portref name=port-for-user//attribute + attribute name=priorityref name=short-int//attribute + attribute name=weightref name=short-int//attribute +/element + /zeroOrMore + zeroOrMore element name=host attribute name=ipref name=ipv4Addr//attribute oneOrMore @@ -206,6 +222,20 @@ /element /define + define name=port-for-user +data type=integer + param name=minInclusive1024/param + param name=maxInclusive65535/param +/data + /define + + define name=short-int +data type=integer + param name=minInclusive0/param + param name=maxInclusive127/param +/data + /define + define name='addr-family' data type='string' param name=pattern(ipv4)|(ipv6)/param diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index b11c482..120b149 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -137,6 +137,14 @@ static void virNetworkDNSDefFree(virNetworkDNSDefPtr def) } VIR_FREE(def-hosts); } + if (def-nsrvrecords) { +while (def-nsrvrecords--) { + VIR_FREE(def-srvrecords[def-nsrvrecords].domain); + VIR_FREE(def-srvrecords[def-nsrvrecords].service); + VIR_FREE(def-srvrecords[def-nsrvrecords].protocol); + VIR_FREE(def-srvrecords[def-nsrvrecords].target); +} +} VIR_FREE(def); } } @@ -552,6 +560,107 @@ error: } static int +virNetworkDNSSrvDefParseXML(virNetworkDNSDefPtr def
Re: [libvirt] RFC: Implement virDomainGetIPAddress()
[snip] I'm not entirely convinced was want to have this in our APIs, since the arp probing is not really a reliable basis for reporting guest IP details. In the near future there will be guest agents for QEMU which can report this information reliably and I think they're a better bet for any app which would want this information. Regards, Daniel Hi Daniel, I've been thinking about this a little more and maybe it would be nice to implement some communication between libvirt and the agent as well. This way the libvirt-based tools would be having track of the guest's IP address and the API like virDomainGetIPAddress() could be still a useful name for this functionality. However the guest will be optional AFAIK so that maybe some option to get the IP address using one of the other methods (like arp, leases file or capturing packets) could still be useful for the case the QEMU Guest Agent won't be running in the guest. Like mentioned, those methods are not 100% reliable but adding at least the option to support them would be a nice thing to have. This could be passed to the function using the flags argument with default to qemu guest agent. For instance, it could be using one or more of the following constants: #define VIR_DOMAIN_GUEST_AGENT0x10 #define VIR_DOMAIN_GET_IP_PCAP 0x20 #define VIR_DOMAIN_GET_IP_DHCP_LEASES_FILE0x40 #define VIR_DOMAIN_GET_IP_ARP0x80 #define VIR_DOMAIN_GET_IP_TRYALL VIR_DOMAIN_GUEST_AGENT | VIR_DOMAIN_GET_IP_PCAP | VIR_DOMAIN_GET_IP_DHCP_LEASES_FILE | VIR_DOMAIN_GET_IP_ARP This could be run in the same order like mentioned here if specified all of them (VIR_DOMAIN_GET_IP_TRYALL), i.e. to test first for agent communication channel to ask for IP (this would be really nice), then try to get the packets captured on domain boot (this is being remembered somewhere IMHO), look to the DHCP leases file if DHCP is enabled and we still don't have the IP address and try to look for the ARP record once if all of above failed. If this last one fails too then we can return some error value. I find the option to expose the guest's IP address to libvirt very useful since we would be this having information accessible from any application/module that's using libvirt. The idea came to my mind when I was thinking of guest management using php-virt-control. I don't want to implement the whole VNC stack (although it would be a great experience for me - no doubt about it ;-) ) to the libvirt-php however the user won't be able to manage the guest at all if he/she doesn't know the IP address for SSH connection. Of course, there's a workaround to connect to VNC on a specified port and use VNC for this however what if remote access to guest's VNC windows will be disabled ? This is the reason why I think the option to get guest's IP address directly from libvirt would be a very nice thing to have ;-) Thanks, Michal -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] RFC: Implement virDomainGetIPAddress()
On 07/14/2011 05:42 PM, Matthias Bolte wrote: 2011/7/14 Michal Novotny minov...@redhat.com: Hi guys, some time ago I've been investigating the options to get the guest's IP address information without having to connect to guest's VNC window or console. It was for one project I've been working on and I found that the solution lies in the procfs, precisely in the /proc/{PID}/net/arp... The format is as follows: $ cat /proc/{PID}/net/arp IP address HW type Flags HW addressMask Device 192.168.122.36 0x1 0x2 52:54:00:35:76:e6 * virbr0 where the HW address matches the MAC address associated to the guest's NIC. Implementing such an API shouldn't be a big problem however I know that there's some option to run libvirt on Windows machines. It should be just the client so it shouldn't really matter however I'd like to ask you whether it's really not an issue. Windows or not is irrelevant here as the IP address lookup cannot be implemented in a general way/place, but will have to be implemented by the hypervisor/network drivers. The function should return a string of the guest's IP address as read from the procfs or return a NULL value if there's no IP address associated with the guest. If the multiple NICs are being used by the guest then the function should return either the IP address matching the MAC address passed to the function or the first IP address if omitted. The prototype should be: char *virDomainGetIPAddress(virDomainPtr domain, char *devmac); First of all you're missing the unsigned int flags parameter. Also did you consider that the MAC to IP(v4|v6) mapping isn't necessarily a 1:1 mapping, but the signature of your function requires this? Well, for this I considered the IPv4 address only. I took a look at this and wonder what's the difference between /proc/{PID}/net/arp and /proc/net/arp. Also as it's ARP it'll only work for IPv4. Honestly I was unable to see it in /proc/net/arp. I saw just some ARP records but not related to the qemu-kvm process I tried on my Fedora-14 box but I was able to see those records in /proc/{PID}/net/arp and therefore I was looking to the /proc/{PID}/net/arp and why I mentioned this instead. Considering the fact this will be working just for IPv4 there should be some prototype like: char *virDomainGetIPAddress(virDomainPtr domain, char *devmac, unsigned int flags); where flags could be having either VIR_DOMAIN_ADDRESS_IPV4 or VIR_DOMAIN_ADDRESS_IPV6 with default to IPv4 address (if flags = 0). The option to get IPv4 address could be implemented the way like I mentioned and the IPv6 implementation could be deferred stating it's not supported yet if we don't know how to get such information. Personally I don't use IPv6 at all so I can't test it however having such option for IPv4 at least (which is widely used by most of the users AFAIK) could be a great thing. I think implementing it for IPv4 and then extending for IPv6 later should be the best thing we could do about this since many people would welcome the option to get the IP address using the libvirt API/virsh command with no need to connect to guest's VNC window/console and since most of them are using the IPv4 networking it would be good start with extending functionality to get IPv6 address later. Thanks, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] RFC: Implement virDomainGetIPAddress()
On 07/15/2011 10:04 AM, Michal Novotny wrote: On 07/14/2011 05:42 PM, Matthias Bolte wrote: 2011/7/14 Michal Novotny minov...@redhat.com: Hi guys, some time ago I've been investigating the options to get the guest's IP address information without having to connect to guest's VNC window or console. It was for one project I've been working on and I found that the solution lies in the procfs, precisely in the /proc/{PID}/net/arp... The format is as follows: $ cat /proc/{PID}/net/arp IP address HW type Flags HW addressMask Device 192.168.122.36 0x1 0x2 52:54:00:35:76:e6 * virbr0 where the HW address matches the MAC address associated to the guest's NIC. Implementing such an API shouldn't be a big problem however I know that there's some option to run libvirt on Windows machines. It should be just the client so it shouldn't really matter however I'd like to ask you whether it's really not an issue. Windows or not is irrelevant here as the IP address lookup cannot be implemented in a general way/place, but will have to be implemented by the hypervisor/network drivers. The function should return a string of the guest's IP address as read from the procfs or return a NULL value if there's no IP address associated with the guest. If the multiple NICs are being used by the guest then the function should return either the IP address matching the MAC address passed to the function or the first IP address if omitted. The prototype should be: char *virDomainGetIPAddress(virDomainPtr domain, char *devmac); First of all you're missing the unsigned int flags parameter. Also did you consider that the MAC to IP(v4|v6) mapping isn't necessarily a 1:1 mapping, but the signature of your function requires this? Well, for this I considered the IPv4 address only. I took a look at this and wonder what's the difference between /proc/{PID}/net/arp and /proc/net/arp. Also as it's ARP it'll only work for IPv4. Honestly I was unable to see it in /proc/net/arp. I saw just some ARP records but not related to the qemu-kvm process I tried on my Fedora-14 box but I was able to see those records in /proc/{PID}/net/arp and therefore I was looking to the /proc/{PID}/net/arp and why I mentioned this instead. An update on this: When I tried it yesterday I was unable to see it in /proc/net/arp however when I tried it now (on a rebooted host) it was able to see it in the /proc/net/arp so based on this it should be present there but it's most likely now in some circumstances so we can implement double-lookup to look to /proc/net/arp first and then to look for /proc/{PID}/net/arp if not found in the /proc/net/arp. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] RFC: Implement virDomainGetIPAddress()
On 07/15/2011 10:28 AM, Matthias Bolte wrote: 2011/7/15 Michal Novotny minov...@redhat.com: On 07/14/2011 05:42 PM, Matthias Bolte wrote: 2011/7/14 Michal Novotny minov...@redhat.com: Hi guys, some time ago I've been investigating the options to get the guest's IP address information without having to connect to guest's VNC window or console. It was for one project I've been working on and I found that the solution lies in the procfs, precisely in the /proc/{PID}/net/arp... The format is as follows: $ cat /proc/{PID}/net/arp IP address HW type Flags HW addressMask Device 192.168.122.36 0x1 0x2 52:54:00:35:76:e6 * virbr0 where the HW address matches the MAC address associated to the guest's NIC. Implementing such an API shouldn't be a big problem however I know that there's some option to run libvirt on Windows machines. It should be just the client so it shouldn't really matter however I'd like to ask you whether it's really not an issue. Windows or not is irrelevant here as the IP address lookup cannot be implemented in a general way/place, but will have to be implemented by the hypervisor/network drivers. The function should return a string of the guest's IP address as read from the procfs or return a NULL value if there's no IP address associated with the guest. If the multiple NICs are being used by the guest then the function should return either the IP address matching the MAC address passed to the function or the first IP address if omitted. The prototype should be: char *virDomainGetIPAddress(virDomainPtr domain, char *devmac); First of all you're missing the unsigned int flags parameter. Also did you consider that the MAC to IP(v4|v6) mapping isn't necessarily a 1:1 mapping, but the signature of your function requires this? Well, for this I considered the IPv4 address only. I took a look at this and wonder what's the difference between /proc/{PID}/net/arp and /proc/net/arp. Also as it's ARP it'll only work for IPv4. Honestly I was unable to see it in /proc/net/arp. I saw just some ARP records but not related to the qemu-kvm process I tried on my Fedora-14 box but I was able to see those records in /proc/{PID}/net/arp and therefore I was looking to the /proc/{PID}/net/arp and why I mentioned this instead. Considering the fact this will be working just for IPv4 there should be some prototype like: char *virDomainGetIPAddress(virDomainPtr domain, char *devmac, unsigned int flags); Even if you're going to restrict it to IPv4 for now this signature won't do, as you can have multiple IPv4 addresses assigned to the same MAC address. How do you want to return multiple IP addresses? As a comma separated list as string and the caller has to parse it? Wait a minute there please. The MAC address should be unique in the system so user should be using just one IP address per one MAC address. Since MAC address should be unique in the system then the IP address assigned to this MAC address should be just one, shouldn't it ? Nevertheless I think you know more about networking options than I do so when I consider the scenario you wrote me about I don't like the idea of leaving the parsing to the caller and for the scenario of multiple IP addresses in the return value I recommend a new prototype: char **virDomainGetIPAddress(virDomainPtr domain, char *devmac, unsigned int *count, unsigned int flags); where count will be the output parameter with the number of elements in the return value. It should be used like: virDomainPtr domain = ...; char *macaddr = 11:22:33:44:55:66; char **ips = NULL; int count = -1; ips = virDomainGetIPAddress(domain, macaddr, count, 0); for (i = 0; i count; i++) { ... ips[i] ... ... free(ips[i]) ... } The return value allocation should be done by the function itself and the called should free the result (ips in this case). Why did you mention the comma-separated list of IP addresses? I think the solution with comma-separated list is not clean at all and the solution I recommend now is much cleaner, don't you think? Thanks, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] RFC: Implement virDomainGetIPAddress()
[snip] Wait a minute there please. The MAC address should be unique in the system so user should be using just one IP address per one MAC address. Since MAC address should be unique in the system then the IP address assigned to this MAC address should be just one, shouldn't it ? You can easily add multiple IP address to an interface (and therefore to the same MAC address) ip addr add 192.168.0.17 dev eth0 ip addr add 192.168.0.42 dev eth0 In this case, yes. Like I said, I didn't consider that option nor it didn't come to my mind at all since I'm not familiar with networking too much for the cases I never used. Nevertheless I think you know more about networking options than I do so Well, I know that there is no strict 1:1 mapping between MAC and IP addresses and I want that this fact is consider in the discussion here and we don't add a new API that turns out to be too simple/restricted in the end. Whether we really want/need to cover this case is a different question. I can see the point and I think it's always good to discuss the possibilities that arise in the process. when I consider the scenario you wrote me about I don't like the idea of leaving the parsing to the caller and for the scenario of multiple IP addresses in the return value I recommend a new prototype: char **virDomainGetIPAddress(virDomainPtr domain, char *devmac, unsigned int *count, unsigned int flags); where count will be the output parameter with the number of elements in the return value. It should be used like: virDomainPtr domain = ...; char *macaddr = 11:22:33:44:55:66; char **ips = NULL; int count = -1; ips = virDomainGetIPAddress(domain, macaddr, count, 0); for (i = 0; i count; i++) { ... ips[i] ... ... free(ips[i]) ... } The return value allocation should be done by the function itself and the called should free the result (ips in this case). That's a possible way to deal with this, yes. And now lets spin this a bit further and consider IPv6 addresses. ipv4s = virDomainGetIPAddress(domain, macaddr, count, VIR_DOMAIN_ADDRESS_IPV4); ipv6s = virDomainGetIPAddress(domain, macaddr, count, VIR_DOMAIN_ADDRESS_IPV6); This are the simple cases where the caller explicitly requests only one version and knows the version of the returned IP addresses. But what about this ips = virDomainGetIPAddress(domain, macaddr, count, VIR_DOMAIN_ADDRESS_IPV4 | VIR_DOMAIN_ADDRESS_IPV6); For this the virSocketAddr representation would be better, right. However my scenario didn't count with the option of definiting VIR_DOMAIN_ADDRESS_IPV4 | VIR_DOMAIN_ADDRESS_IPV6 together. Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] RFC: Implement virDomainGetIPAddress()
[snip] ipv4s = virDomainGetIPAddress(domain, macaddr, count, VIR_DOMAIN_ADDRESS_IPV4); ipv6s = virDomainGetIPAddress(domain, macaddr, count, VIR_DOMAIN_ADDRESS_IPV6); This are the simple cases where the caller explicitly requests only one version and knows the version of the returned IP addresses. But what about this ips = virDomainGetIPAddress(domain, macaddr, count, VIR_DOMAIN_ADDRESS_IPV4 | VIR_DOMAIN_ADDRESS_IPV6); Now the caller needs to detect the version from the IPs string representation. Maybe string representation isn't the best approach here. Anyway, I'm probably already overengineering this here :) I've been talking to jdenemar about this and Jirka was a great resource. We've discussed options to be used for getting both IPv4 and IPv6 addresses. Since it's possible that the guest is not used and therefore the entry would be dropped from the ARP table then we have to consider other implementations. We've been talking about nwfilters and that they are most likely using libpcap to get the information of the guest's IP address so we may be able to use them as well. Also, the leases file of DHCP (if client uses DHCP) could be a good thing although the best way to get it would be the ARP table however this should be implemented several ways if the ARP entry lookup fails. If we have a look to [1] we may be able to find the IP address in the packet sniffer using the libpcap facility. Michal [1] http://tldp.org/HOWTO/Linux+IPv6-HOWTO/examples-tcpdump.html -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] RFC: Implement virDomainGetIPAddress()
On 07/15/2011 12:09 PM, Daniel P. Berrange wrote: On Thu, Jul 14, 2011 at 05:14:57PM +0200, Michal Novotny wrote: Hi guys, some time ago I've been investigating the options to get the guest's IP address information without having to connect to guest's VNC window or console. It was for one project I've been working on and I found that the solution lies in the procfs, precisely in the /proc/{PID}/net/arp... The format is as follows: $ cat /proc/{PID}/net/arp IP address HW type Flags HW addressMask Device 192.168.122.36 0x1 0x2 52:54:00:35:76:e6 * virbr0 where the HW address matches the MAC address associated to the guest's NIC. Implementing such an API shouldn't be a big problem however I know that there's some option to run libvirt on Windows machines. It should be just the client so it shouldn't really matter however I'd like to ask you whether it's really not an issue. The function should return a string of the guest's IP address as read from the procfs or return a NULL value if there's no IP address associated with the guest. If the multiple NICs are being used by the guest then the function should return either the IP address matching the MAC address passed to the function or the first IP address if omitted. The prototype should be: char *virDomainGetIPAddress(virDomainPtr domain, char *devmac); For this the internal information about PID of the process spawned should be used (this is already being tracked and stored by libvirt IMHO) to access the /proc/{PID}/net/arp file. This API function would be very useful since it would give libvirt users option to get the information of the guest's IP address without having to connect to guest's VNC window or console. For virsh this could be implemented directly into the dominfo subcommand. What do you think about implementing this ? I'm not entirely convinced was want to have this in our APIs, since the arp probing is not really a reliable basis for reporting guest IP details. In the near future there will be guest agents for QEMU which can report this information reliably and I think they're a better bet for any app which would want this information. Regards, Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| Daniel, you're right about this. That's the reason I wrote an e-mail about options to use nwfilter implementation of pcap or leases-file of DHCP if available. In fact I'd recommend this priority: 1) ARP table lookup 2) leases file of DHCP server if 1 is not available 3) libpcap if even 2 is not available Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] RFC: Implement virDomainGetIPAddress()
Hi guys, some time ago I've been investigating the options to get the guest's IP address information without having to connect to guest's VNC window or console. It was for one project I've been working on and I found that the solution lies in the procfs, precisely in the /proc/{PID}/net/arp... The format is as follows: $ cat /proc/{PID}/net/arp IP address HW type Flags HW addressMask Device 192.168.122.36 0x1 0x2 52:54:00:35:76:e6 * virbr0 where the HW address matches the MAC address associated to the guest's NIC. Implementing such an API shouldn't be a big problem however I know that there's some option to run libvirt on Windows machines. It should be just the client so it shouldn't really matter however I'd like to ask you whether it's really not an issue. The function should return a string of the guest's IP address as read from the procfs or return a NULL value if there's no IP address associated with the guest. If the multiple NICs are being used by the guest then the function should return either the IP address matching the MAC address passed to the function or the first IP address if omitted. The prototype should be: char *virDomainGetIPAddress(virDomainPtr domain, char *devmac); For this the internal information about PID of the process spawned should be used (this is already being tracked and stored by libvirt IMHO) to access the /proc/{PID}/net/arp file. This API function would be very useful since it would give libvirt users option to get the information of the guest's IP address without having to connect to guest's VNC window or console. For virsh this could be implemented directly into the dominfo subcommand. What do you think about implementing this ? Thanks, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] php-virt-control
On 07/03/2011 05:28 PM, Andreas Cymbal wrote: Hello i have some problem with php-virt-control */Message:/**/ /*/Cannot connect to hypervisor. Please change connection information. /(Local)// Virt-manager run without Problems Virsh run only with sudo virsh My System is Ubuntu 10.04 LTS 64 With Xen 4.1.1 and 2.6.32.40 Libvirt 0.9.2 How does xen+ssh work without any password or ssh keys? Yours AndrewCat Hi Andrew, it can't. The xen+ssh or anything+ssh is requiring the keys since libvirt is using ssh command directly and not libssh2 so it doesn't work even with the password specified. The only thing you have to do it to provide the SSH keys to the apache. You can run the 'tools/apache-key-copy' tool from the repository which will automatically generate the keys for user apache if it doesn't exist and copy it to the remote host which is required. If you see the message about libvirt-php cannot connect to the hypervisor then you should try setting up the connection information in the form at the bottom of the page. Is the system having the PolicyKit or something similar to this? You need to enable the authentication for virsh not to require password for the connection to 'xen:///' (which should be the local Xen connection URI). For more information about authentication please see the libvirt authentication page at http://libvirt.org/auth.html . Thanks, Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] libvirt-php login issue to ESXi
Hi Koen, that's bad. I don't have logging of username and password length here. I'll try to work on this. You can try attached patch to extend logging by username and password in the mean time and provide me the full resulting log file? Please review whether there is no password and if there is then please change it to fakepass. Thanks, Michal On 06/29/2011 03:19 PM, Koen Calliauw wrote: Hi Michal, Here's what appears in the logfile when using libvirt_logfile_set: [Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP Warning: libvirt_connect(): internal error HTTP response code 500 for call to 'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect user name or password. in /var/www/virt.php on line 9, referer: http://10.9.0.3/ [2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect: Cannot establish connection to esx://10.9.0.2?transport=http http://10.9.0.2?transport=http Best regards, Koen Calliauw On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Koen, thanks for you e-mail. I don't know what exactly is going on here but could you please try to enable debug logging using libvirt_logfile_set($filename, $maxsize) API function? The maxsize parameter is optional and it defaults to 1024 KiB (1M). The file have to have write permissions so you can touch the file, e.g. debug.log and change it's permissions to 777 to allow logging. Once you try to login using the script you mentioned with debug set you will get the debug output into the debug.log file which could be send to us for further analysis. Thanks, Michal On 06/29/2011 03:03 PM, Koen Calliauw wrote: Hi all, I've started playing with libvirt-php yesterday and with the help of Michal Novotny got it running quite painlessly. However, the login from PHP to my testing ESXi server seems to be failing. I've wiresharked the HTTP traffic with a virsh -c (which works) and compared that to the traffic I see when using the libvirt-php extension, here's the difference I see (mind the username) Not working (libvirt-php) Login xmlns=urn:vim25_this xmlns=urn:vim25 xsi:type=ManagedObjectReference type=SessionManagerha-sessionmgr/_thisuserName xmlns=urn:vim25 xsi:type=xsd:stringroot8./userNamepassword xmlns=urn:vim25 xsi:type=xsd:stringfakepass/password/Login Working (virsh -c) Login xmlns=urn:vim25_this xmlns=urn:vim25 xsi:type=ManagedObjectReference type=SessionManagerha-sessionmgr/_thisuserName xmlns=urn:vim25 xsi:type=xsd:stringroot/userNamepassword xmlns=urn:vim25 xsi:type=xsd:stringfakepass/password/Login So for some reason something gets appended (8.) or encoded wrong or something when I use the PHP extension. This is the testing code I run: ?php $credentials = array(VIR_CRED_AUTHNAME='root',VIR_CRED_PASSPHRASE='fakepass'); $conn = libvirt_connect(esx://10.9.0.2?transport=http http://10.9.0.2?transport=http http://10.9.0.2?transport=http, FALSE, $credentials); if($conn) { print_r(libvirt_connect_get_hypervisor($conn)); } else { echo Connection failed: .libvirt_get_last_error(); } Any help with this issue would be greatly appreciated. Thanks! Best regards, Koen Calliauw -- Michal Novotny minov...@redhat.com mailto:minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org http://php-virt-control.org -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org diff --git a/src/libvirt-php.c b/src/libvirt-php.c index c3253c0..0be65e3 100644 --- a/src/libvirt-php.c +++ b/src/libvirt-php.c @@ -1196,7 +1196,7 @@ static int libvirt_virConnectAuthCallback(virConnectCredentialPtr cred, unsigne php_libvirt_cred_value *creds=(php_libvirt_cred_value*) cbdata; for(i=0;incred;i++) { - //printf (Cred %i: type %i, prompt %s challenge %s\n,i,cred[i].type,cred[i].prompt,cred[i].challenge); + DPRINTF(%s: cred %d, type %d, prompt %s challenge %s\n , __FUNCTION__, i, cred[i].type, cred[i].prompt, cred[i].challenge); if (creds != NULL) for (j=0;jcreds[0].count;j++) { @@ -1207,7 +1207,7 @@ static int libvirt_virConnectAuthCallback(virConnectCredentialPtr cred, unsigne strncpy(cred[i].result,creds[j].result,creds[j].resultlen); } } - //printf (Result: %s (%i)\n,cred[i].result,cred[i].resultlen); + DPRINTF(%s: result %s (%d)\n, __FUNCTION__, cred[i].result, cred[i].resultlen); } return 0; @@ -1316,16 +1316,20 @@ PHP_FUNCTION(libvirt_connect) zend_hash_move_forward_ex(arr_hash, pointer)) { if (Z_TYPE_PP(data) == IS_STRING
Re: [libvirt] libvirt-php login issue to ESXi
Hi Koen, please try this patch. I can't test it myself since it's logging automatically in my setup but I *think* I may have found the problem. Could you please apply attached patch (revert the patch I sent to you before) and provide me the test results? Thanks, Michal On 06/29/2011 03:47 PM, Koen Calliauw wrote: Hi Michal, Here's the output. Please note that special characters were visible when opening the file with vi, though not with a cat on the console, so this is a copy/paste out of vi. [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials index 2 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials index 5 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: Found 2 elements for credentials [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: cred 0, type 2, prompt Enter username for 10.9.0.2 [root] challenge 10.9.0.2 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: result rootV^? (4) [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: cred 0, type 5, prompt Enter rootV^?'s password for 10.9.0.2 challenge 10.9.0.2 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: result fakepass (12) [Wed Jun 29 15:44:00 2011] [error] [client 10.9.1.10] PHP Warning: libvirt_connect(): internal error HTTP response code 500 for call to 'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect user name or password. in /var/www/virt.php on line 9, referer: http://10.9.0.3/ [2011-06-29 15:44:00 libvirt-php/core]: libvirt_connect: Cannot establish connection to esx://10.9.0.2?transport=http http://10.9.0.2?transport=http Best regards, Koen Calliauw On Wed, Jun 29, 2011 at 3:35 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Koen, that's bad. I don't have logging of username and password length here. I'll try to work on this. You can try attached patch to extend logging by username and password in the mean time and provide me the full resulting log file? Please review whether there is no password and if there is then please change it to fakepass. Thanks, Michal On 06/29/2011 03:19 PM, Koen Calliauw wrote: Hi Michal, Here's what appears in the logfile when using libvirt_logfile_set: [Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP Warning: libvirt_connect(): internal error HTTP response code 500 for call to 'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect user name or password. in /var/www/virt.php on line 9, referer: http://10.9.0.3/ [2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect: Cannot establish connection to esx://10.9.0.2?transport=http http://10.9.0.2?transport=http http://10.9.0.2?transport=http Best regards, Koen Calliauw On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Koen, thanks for you e-mail. I don't know what exactly is going on here but could you please try to enable debug logging using libvirt_logfile_set($filename, $maxsize) API function? The maxsize parameter is optional and it defaults to 1024 KiB (1M). The file have to have write permissions so you can touch the file, e.g. debug.log and change it's permissions to 777 to allow logging. Once you try to login using the script you mentioned with debug set you will get the debug output into the debug.log file which could be send to us for further analysis. Thanks, Michal On 06/29/2011 03:03 PM, Koen Calliauw wrote: Hi all, I've started playing with libvirt-php yesterday and with the help of Michal Novotny got it running quite painlessly. However, the login from PHP to my testing ESXi server seems to be failing. I've wiresharked the HTTP traffic with a virsh -c (which works) and compared that to the traffic I see when using the libvirt-php extension, here's the difference I see (mind the username) Not working (libvirt-php) Login xmlns=urn:vim25_this xmlns=urn:vim25 xsi:type=ManagedObjectReference type=SessionManagerha-sessionmgr/_thisuserName xmlns=urn:vim25 xsi:type=xsd:stringroot8./userNamepassword xmlns=urn:vim25 xsi:type=xsd:stringfakepass/password/Login Working (virsh -c) Login xmlns=urn:vim25_this xmlns=urn:vim25 xsi:type=ManagedObjectReference type
Re: [libvirt] libvirt-php login issue to ESXi
Hi Koen, so is it working fine already ? I'm glad to hear that ;-) Best regards, Michal On 06/29/2011 04:04 PM, Koen Calliauw wrote: Hi Michal, That resolved the issue! Thank you very much for the quick resolution, I appreciate it. Best regards, Koen On Wed, Jun 29, 2011 at 4:00 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Koen, please try this patch. I can't test it myself since it's logging automatically in my setup but I *think* I may have found the problem. Could you please apply attached patch (revert the patch I sent to you before) and provide me the test results? Thanks, Michal On 06/29/2011 03:47 PM, Koen Calliauw wrote: Hi Michal, Here's the output. Please note that special characters were visible when opening the file with vi, though not with a cat on the console, so this is a copy/paste out of vi. [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials index 2 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials index 5 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: Found 2 elements for credentials [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: cred 0, type 2, prompt Enter username for 10.9.0.2 [root] challenge 10.9.0.2 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: result rootV^? (4) [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: cred 0, type 5, prompt Enter rootV^?'s password for 10.9.0.2 challenge 10.9.0.2 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: result fakepass (12) [Wed Jun 29 15:44:00 2011] [error] [client 10.9.1.10] PHP Warning: libvirt_connect(): internal error HTTP response code 500 for call to 'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect user name or password. in /var/www/virt.php on line 9, referer: http://10.9.0.3/ [2011-06-29 15:44:00 libvirt-php/core]: libvirt_connect: Cannot establish connection to esx://10.9.0.2?transport=http http://10.9.0.2?transport=http http://10.9.0.2?transport=http Best regards, Koen Calliauw On Wed, Jun 29, 2011 at 3:35 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Koen, that's bad. I don't have logging of username and password length here. I'll try to work on this. You can try attached patch to extend logging by username and password in the mean time and provide me the full resulting log file? Please review whether there is no password and if there is then please change it to fakepass. Thanks, Michal On 06/29/2011 03:19 PM, Koen Calliauw wrote: Hi Michal, Here's what appears in the logfile when using libvirt_logfile_set: [Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP Warning: libvirt_connect(): internal error HTTP response code 500 for call to 'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect user name or password. in /var/www/virt.php on line 9, referer: http://10.9.0.3/ [2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect: Cannot establish connection to esx://10.9.0.2?transport=http http://10.9.0.2?transport=http http://10.9.0.2?transport=http http://10.9.0.2?transport=http Best regards, Koen Calliauw On Wed, Jun 29, 2011 at 3:10 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Koen, thanks for you e-mail. I don't know what exactly is going on here but could you please try to enable debug logging using libvirt_logfile_set($filename, $maxsize) API function? The maxsize parameter is optional and it defaults to 1024 KiB (1M). The file have to have write permissions so you can touch the file, e.g. debug.log and change it's permissions to 777 to allow logging. Once you try to login using the script you mentioned with debug set you will get the debug output into the debug.log file which could
Re: [libvirt] libvirt-php login issue to ESXi
Hi, that's great. I'm really glad to hear that ;-) If you have any further issues don't hesitate to write an e-mail again ;-) Thanks, Michal On 06/29/2011 04:08 PM, Koen Calliauw wrote: Hi, Yes, it's connecting perfectly now and I get the expected result from print_r(libvirt_connect_get_hypervisor($conn)); Array ( [hypervisor] = ESX [major] = 4 [minor] = 1 [release] = 0 [hypervisor_string] = ESX 4.1.0 ) Thanks again, Best regards, Koen On Wed, Jun 29, 2011 at 4:06 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Koen, so is it working fine already ? I'm glad to hear that ;-) Best regards, Michal On 06/29/2011 04:04 PM, Koen Calliauw wrote: Hi Michal, That resolved the issue! Thank you very much for the quick resolution, I appreciate it. Best regards, Koen On Wed, Jun 29, 2011 at 4:00 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Koen, please try this patch. I can't test it myself since it's logging automatically in my setup but I *think* I may have found the problem. Could you please apply attached patch (revert the patch I sent to you before) and provide me the test results? Thanks, Michal On 06/29/2011 03:47 PM, Koen Calliauw wrote: Hi Michal, Here's the output. Please note that special characters were visible when opening the file with vi, though not with a cat on the console, so this is a copy/paste out of vi. [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials index 2 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: credentials index 5 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_connect: Found 2 elements for credentials [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: cred 0, type 2, prompt Enter username for 10.9.0.2 [root] challenge 10.9.0.2 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: result rootV^? (4) [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: cred 0, type 5, prompt Enter rootV^?'s password for 10.9.0.2 challenge 10.9.0.2 [2011-06-29 15:43:58 libvirt-php/core]: libvirt_virConnectAuthCallback: result fakepass (12) [Wed Jun 29 15:44:00 2011] [error] [client 10.9.1.10] PHP Warning: libvirt_connect(): internal error HTTP response code 500 for call to 'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect user name or password. in /var/www/virt.php on line 9, referer: http://10.9.0.3/ [2011-06-29 15:44:00 libvirt-php/core]: libvirt_connect: Cannot establish connection to esx://10.9.0.2?transport=http http://10.9.0.2?transport=http http://10.9.0.2?transport=http http://10.9.0.2?transport=http Best regards, Koen Calliauw On Wed, Jun 29, 2011 at 3:35 PM, Michal Novotny minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com mailto:minov...@redhat.com wrote: Hi Koen, that's bad. I don't have logging of username and password length here. I'll try to work on this. You can try attached patch to extend logging by username and password in the mean time and provide me the full resulting log file? Please review whether there is no password and if there is then please change it to fakepass. Thanks, Michal On 06/29/2011 03:19 PM, Koen Calliauw wrote: Hi Michal, Here's what appears in the logfile when using libvirt_logfile_set: [Wed Jun 29 15:18:00 2011] [error] [client 10.9.1.10] PHP Warning: libvirt_connect(): internal error HTTP response code 500 for call to 'Login'. Fault: ServerFaultCode - Cannot complete login due to an incorrect user name or password. in /var/www/virt.php on line 9, referer: http://10.9.0.3/ [2011-06-29 15:18:00 libvirt-php/core]: libvirt_connect
Re: [libvirt] [PATCH] network: Fix dnsmasq hostsfile creation logic and related tests
; if (!(actual = virCommandToString(cmd))) @@ -59,6 +64,7 @@ static int testCompareXMLToArgvFiles(const char *inxml, const char *outargv) { VIR_FREE(pidfile); virCommandFree(cmd); virNetworkObjFree(obj); +dnsmasqContextFree(dctx); return ret; } ACK Michal -- Michal Novotny minov...@redhat.com, RHCE, Red Hat Virtualization | libvirt-php bindings | php-virt-control.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v6 2/5] Network: Add regression tests for the command-line arguments
The regression testing done by comparison of command-line generated from the network XML file and the expected command-line arguments (read from file). Differences between v5 and v6 (this one: - For the tests the pidfile is set to NULL string so there's no --pidfile argument passed to the dnsmasq. Signed-off-by: Michal Novotny minov...@redhat.com --- src/Makefile.am|7 +- src/libvirt_network.syms |6 + src/network/bridge_driver.c| 43 ++-- src/network/bridge_driver.h|3 + tests/Makefile.am | 10 ++ tests/networkxml2argvdata/isolated-network.argv|1 + tests/networkxml2argvdata/isolated-network.xml | 11 ++ .../nat-network-dns-txt-record.argv|1 + .../nat-network-dns-txt-record.xml | 24 + tests/networkxml2argvdata/nat-network.argv |1 + tests/networkxml2argvdata/nat-network.xml | 21 tests/networkxml2argvdata/netboot-network.argv |1 + tests/networkxml2argvdata/netboot-network.xml | 14 +++ .../networkxml2argvdata/netboot-proxy-network.argv |1 + .../networkxml2argvdata/netboot-proxy-network.xml | 13 +++ tests/networkxml2argvdata/routed-network.argv |1 + tests/networkxml2argvdata/routed-network.xml |9 ++ tests/networkxml2argvtest.c| 108 18 files changed, 264 insertions(+), 11 deletions(-) create mode 100644 src/libvirt_network.syms create mode 100644 tests/networkxml2argvdata/isolated-network.argv create mode 100644 tests/networkxml2argvdata/isolated-network.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-txt-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-txt-record.xml create mode 100644 tests/networkxml2argvdata/nat-network.argv create mode 100644 tests/networkxml2argvdata/nat-network.xml create mode 100644 tests/networkxml2argvdata/netboot-network.argv create mode 100644 tests/networkxml2argvdata/netboot-network.xml create mode 100644 tests/networkxml2argvdata/netboot-proxy-network.argv create mode 100644 tests/networkxml2argvdata/netboot-proxy-network.xml create mode 100644 tests/networkxml2argvdata/routed-network.argv create mode 100644 tests/networkxml2argvdata/routed-network.xml create mode 100644 tests/networkxml2argvtest.c diff --git a/src/Makefile.am b/src/Makefile.am index b292f9f..46a9e47 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1090,6 +1090,10 @@ if WITH_XENXS USED_SYM_FILES += libvirt_xenxs.syms endif +if WITH_NETWORK +USED_SYM_FILES += libvirt_network.syms +endif + EXTRA_DIST += \ libvirt_public.syms \ libvirt_private.syms \ @@ -1100,7 +1104,8 @@ EXTRA_DIST += \ libvirt_daemon.syms \ libvirt_nwfilter.syms\ libvirt_vmx.syms \ - libvirt_xenxs.syms + libvirt_xenxs.syms \ + libvirt_network.syms BUILT_SOURCES += libvirt.syms libvirt.def libvirt_qemu.def diff --git a/src/libvirt_network.syms b/src/libvirt_network.syms new file mode 100644 index 000..6be5e45 --- /dev/null +++ b/src/libvirt_network.syms @@ -0,0 +1,6 @@ +# +# Network-specific symbols +# + +# bridge_driver.h +networkBuildDhcpDaemonCommandLine; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index dc143db..9c0423a 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -494,7 +494,8 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network, if (network-def-domain) virCommandAddArgList(cmd, --domain, network-def-domain, NULL); -virCommandAddArgPair(cmd, --pid-file, pidfile); +if (pidfile) +virCommandAddArgPair(cmd, --pid-file, pidfile); /* *no* conf file */ virCommandAddArg(cmd, --conf-file=); @@ -599,8 +600,9 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network, } if (networkSaveDnsmasqHostsfile(ipdef, dctx, false) == 0) { -virCommandAddArgPair(cmd, --dhcp-hostsfile, - dctx-hostsfile-path); +if (dctx-hostsfile-nhosts) +virCommandAddArgPair(cmd, --dhcp-hostsfile, + dctx-hostsfile-path); } dnsmasqContextFree(dctx); } @@ -631,12 +633,12 @@ cleanup: return ret; } -static int -networkStartDhcpDaemon(virNetworkObjPtr network) +int +networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, virCommandPtr *cmdout, + char *pidfile) { virCommandPtr cmd = NULL; -char *pidfile = NULL; -int ret = -1, err, ii; +int ret = -1, ii; virNetworkIpDefPtr ipdef; network-dnsmasqPid = -1; @@ -661,6 +663,28 @@ networkStartDhcpDaemon(virNetworkObjPtr network) if (!virNetworkDefGetIpByIndex(network-def, AF_UNSPEC, 0
[libvirt] [PATCH v6 0/5] Add TXT record and hosts support for DNS service and dnsmasq command-line regression testing
Hi, this is the 6th (and hopefully the last) version of my patch to introduce the TXT record and DNS hosts support for the DNS service on the virtual network. This can be defined using the txt subelement in the dns element of the network XML description. The definition of TXT record names containing spaces is rejected with the error message that TXT record names in DNS doesn't support spaces. Also, regression testing for the dnsmasq command line has been added to test whether the dnsmasq command-line is correct or not. The new XML definition syntax is: dns txt name=example value=example value / host ip='192.168.122.1' hostnamegateway/hostname hostnamehost/hostname /host /dns Where multiple host elements can be defined to put the aliases. The dns element have to be present on the ip level, i.e. one level upper than it was in version 2 of the patch since the definition affects all the IP addresses on the network. The patch series has been tested for the configuration and it was working fine and also RelaxNG schema with the tests have been both altered to add test cases to test those patches. This is the new version for latest libvirt codebase so please review the patchset. Some fixes and code optimizations were done by Laine Stump, so I'm adding him into the SOB clause as well ;-) Please review. Thanks, Michal Signed-off-by: Michal Novotny minov...@redhat.com Signed-off-by: Laine Stump lst...@redhat.com Michal Novotny (5): Add TXT record support for virtual DNS service Network: Add regression tests for the command-line arguments Network: Move dnsmasqContext creation to networkSaveDnsmasqHostsfile() Network: Add additional hosts internal infrastructure Network: Add support for DNS hosts definition to the network XML docs/formatnetwork.html.in | 29 ++- docs/schemas/network.rng | 28 ++ src/Makefile.am|7 +- src/conf/network_conf.c| 206 ++ src/conf/network_conf.h| 26 ++ src/libvirt_network.syms |6 + src/libvirt_private.syms |1 + src/network/bridge_driver.c| 123 ++--- src/network/bridge_driver.h|3 + src/util/dnsmasq.c | 285 ++-- src/util/dnsmasq.h | 22 ++- tests/Makefile.am | 10 + tests/networkxml2argvdata/isolated-network.argv|1 + tests/networkxml2argvdata/isolated-network.xml | 11 + .../networkxml2argvdata/nat-network-dns-hosts.argv |1 + .../networkxml2argvdata/nat-network-dns-hosts.xml | 14 + .../nat-network-dns-txt-record.argv|1 + .../nat-network-dns-txt-record.xml | 24 ++ tests/networkxml2argvdata/nat-network.argv |1 + tests/networkxml2argvdata/nat-network.xml | 21 ++ tests/networkxml2argvdata/netboot-network.argv |1 + tests/networkxml2argvdata/netboot-network.xml | 14 + .../networkxml2argvdata/netboot-proxy-network.argv |1 + .../networkxml2argvdata/netboot-proxy-network.xml | 13 + tests/networkxml2argvdata/routed-network.argv |1 + tests/networkxml2argvdata/routed-network.xml |9 + tests/networkxml2argvtest.c| 109 tests/networkxml2xmlin/nat-network-dns-hosts.xml | 14 + .../nat-network-dns-txt-record.xml | 24 ++ tests/networkxml2xmlout/nat-network-dns-hosts.xml | 14 + .../nat-network-dns-txt-record.xml | 24 ++ tests/networkxml2xmltest.c |2 + 32 files changed, 990 insertions(+), 56 deletions(-) create mode 100644 src/libvirt_network.syms create mode 100644 tests/networkxml2argvdata/isolated-network.argv create mode 100644 tests/networkxml2argvdata/isolated-network.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-hosts.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-hosts.xml create mode 100644 tests/networkxml2argvdata/nat-network-dns-txt-record.argv create mode 100644 tests/networkxml2argvdata/nat-network-dns-txt-record.xml create mode 100644 tests/networkxml2argvdata/nat-network.argv create mode 100644 tests/networkxml2argvdata/nat-network.xml create mode 100644 tests/networkxml2argvdata/netboot-network.argv create mode 100644 tests/networkxml2argvdata/netboot-network.xml create mode 100644 tests/networkxml2argvdata/netboot-proxy-network.argv create mode 100644 tests/networkxml2argvdata/netboot-proxy-network.xml create mode 100644 tests/networkxml2argvdata/routed-network.argv create mode 100644 tests/networkxml2argvdata/routed-network.xml create mode 100644 tests/networkxml2argvtest.c create mode 100644