[libvirt] Re: OpenVZ : The restriction of domain name should be addressed
Hi Daniel, I didn't realize that I even did not follow the manner of XML. I have worked with this problem and got a small patch to handle "ID" in OpenVZ functionality. I found it is working well with the XML script included "ID" in domain tag. I am concerned that I had to edit the common file domain_conf.c. I still believe I should keep it away from this problem for compatibility with the others. How do you think can I avoid this? diff --git a/src/domain_conf.c b/src/domain_conf.c index 5ae0775..f74961f 100644 --- a/src/domain_conf.c +++ b/src/domain_conf.c @@ -2492,7 +2492,7 @@ static virDomainDefPtr virDomainDefParseXML (virConnectPtr conn, return NULL; } -if (!(flags & VIR_DOMAIN_XML_INACTIVE)) +// if (!(flags & VIR_DOMAIN_XML_INACTIVE)) if((virXPathLong(conn, "string(./@id)", ctxt, &id)) < 0) id = -1; def->id = (int)id; diff --git a/src/openvz_conf.c b/src/openvz_conf.c index be94b9e..d23f173 100644 --- a/src/openvz_conf.c +++ b/src/openvz_conf.c @@ -425,17 +425,18 @@ int openvzLoadDomains(struct openvz_driver *driver) { char uuidstr[VIR_UUID_STRING_BUFLEN]; virDomainObjPtr dom = NULL; char temp[50]; +char name[64]; if (openvzAssignUUIDs() < 0) return -1; -if ((fp = popen(VZLIST " -a -ovpsid,status -H 2>/dev/null", "r")) == NULL) { +if ((fp = popen(VZLIST " -a -ovpsid,name,status -H 2>/dev/null", "r")) == NULL) { openvzError(NULL, VIR_ERR_INTERNAL_ERROR, "%s", _("popen failed")); return -1; } while(!feof(fp)) { -if (fscanf(fp, "%d %s\n", &veid, status) != 2) { +if (fscanf(fp, "%d %s\n", &veid, name, status) != 3) { if (feof(fp)) break; @@ -465,7 +466,7 @@ int openvzLoadDomains(struct openvz_driver *driver) { dom->pid = veid; dom->def->id = dom->state == VIR_DOMAIN_SHUTOFF ? -1 : veid; -if (virAsprintf(&dom->def->name, "%i", veid) < 0) +if (virAsprintf(&dom->def->name, "%s", name) < 0) goto no_memory; openvzGetVPSUUID(veid, uuidstr, sizeof(uuidstr)); diff --git a/src/openvz_driver.c b/src/openvz_driver.c index a8c24ba..c0c1e0f 100644 --- a/src/openvz_driver.c +++ b/src/openvz_driver.c @@ -101,6 +101,7 @@ static int openvzDomainDefineCmd(virConnectPtr conn, virDomainDefPtr vmdef) { int narg; +char str_id[10]; for (narg = 0; narg < maxarg; narg++) args[narg] = NULL; @@ -130,6 +131,11 @@ static int openvzDomainDefineCmd(virConnectPtr conn, ADD_ARG_LIT(VZCTL); ADD_ARG_LIT("--quiet"); ADD_ARG_LIT("create"); + +sprintf( str_id, "%d", vmdef->id ); +ADD_ARG_LIT(str_id); + +ADD_ARG_LIT("--name"); ADD_ARG_LIT(vmdef->name); if (vmdef->nfss == 1 && @@ -1229,7 +1235,11 @@ static int openvzListDefinedDomains (virConnectPtr conn, char vpsname[32]; char buf[32]; char *endptr; -const char *cmd[] = {VZLIST, "-ovpsid", "-H", "-S", NULL}; +const char *cmd[] = {VZLIST, "-oname", "-H", "-S", NULL}; +int cnt = 0; +char name_buf[32]; + + /* the -S options lists only stopped domains */ ret = virExec(conn, cmd, NULL, NULL, @@ -1241,14 +1251,14 @@ static int openvzListDefinedDomains (virConnectPtr conn, } while(got < nnames){ -ret = openvz_readline(outfd, buf, 32); +ret = openvz_readline(outfd, buf, 64); if(!ret) break; -if (virStrToLong_i(buf, &endptr, 10, &veid) < 0) { -openvzError(conn, VIR_ERR_INTERNAL_ERROR, -_("Could not parse VPS ID %s"), buf); -continue; +cnt = 0; +while( buf[cnt] != ' ' ){ + name_buf[cnt] = buf[cnt]; + cnt++; } -snprintf(vpsname, sizeof(vpsname), "%d", veid); +snprintf(vpsname, sizeof(vpsname), "%d", name_buf); if (!(names[got] = strdup(vpsname))) goto no_memory; got ++; -- 1.5.2.2 - Yuji Nishida nish...@nict.go.jp -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC, PATCH] network: add 'netboot' option to dhcp config
On 09/15/2009 01:01 AM, Jeremy Kerr wrote: Hi Paolo, Since there is only one TFTP server running in the network IIRC, it's possible to have more than one: the Server-Name (id 66) of the DHCP response specifies which. However, we probably only ever want to start one server, so the tag should work fine. Yes, what I meant is that in general the TFTP server started by libvirt will run on the address provided by /network/i...@address. So libvirt can only start one TFTP server even though in the future it might support multiple DHCP ranges. In this case, some ranges may not support BOOTP and some may, and they can give different boot files, but all must share a single dnsmasq-provided TFTP server (using a server attribute would be fine; but that TFTP server will not be started by libvirt). This can be seen from the fact that BOOTP is nothing more than a few options within a DHCP packet (i.e. ), but TFTP binds on a completely different port and could be a separate process (hence is a sibling of ). dnsmasq is special. , it is not possible to specify different roots for different dhcp ranges. I think the schema should be If you want it to be specific to the range, shouldn't it be within the tag? Currently the code will only parse one tag. No, I want it to be specific to the _network_, since it will bind to /network/i...@address. One thing that I've tried to keep in mind is that the tftp service may be provided by a separate machine in the network, so we may need some way in the future to represent that - maybe no tag That's already implemented by my patch, and can be used with an external TFTP server, for example started via (x)inetd. and use server="w.x.y.z" in the bootp tag. Also, would be cool to have separate files for different hosts, but that may be thinking too far ahead at this stage :) Yes. That's something you'd get for free if libvirt supported multiple DHCP ranges. Paolo -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC, PATCH] network: add 'netboot' option to dhcp config
Hi Paolo, > Since there is only one TFTP server running in the network IIRC, it's possible to have more than one: the Server-Name (id 66) of the DHCP response specifies which. However, we probably only ever want to start one server, so the tag should work fine. > , it is not > possible to specify different roots for different dhcp ranges. I think > the schema should be > > > > > > > > If you want it to be specific to the range, shouldn't it be within the tag? Currently the code will only parse one tag. Otherwise, looks fine - I'm happy with either method. One thing that I've tried to keep in mind is that the tftp service may be provided by a separate machine in the network, so we may need some way in the future to represent that - maybe no tag, and use server="w.x.y.z" in the bootp tag. Also, would be cool to have separate files for different hosts, but that may be thinking too far ahead at this stage :) Cheers, Jeremy -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] ANNOUNCE: perl bindings Sys-Virt release 0.2.2
FYI I have just uploaded a new release 0.2.2 of the libvirt perl bindings, Sys-Virt, to CPAN. http://search.cpan.org/dist/Sys-Virt/ Direct download link http://search.cpan.org/CPAN/authors/id/D/DA/DANBERR/Sys-Virt-0.2.2.tar.gz Changes since 0.2.1: - Add all new APIs upto libvirt 0.7.0 APIs (listing defined network interfaces) - Add missing APIs for looking up storage volumes based on path and key - Fix lookup of network interfaces based on MAC address - Add missing APIs for defining network interfaces and starting defined interfaces There will of course shortly be another release to cover the soon to be released APIs in libvirt 0.7.1 Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] network: add 'bootp' and 'tftp' config
Currently, libvirtd will start a dnsmasq process for the virtual network, but (aside from killing the dnsmasq process and replacing it), there's no way to define tftp boot options. This change introduces the appropriate tags to the dhcp configuration: default When the attributes are present, these are passed to the arguments to dnsmasq: dnsmasq [...] --enable-tftp --tftp-root /srv/tftp --dhcp-boot pxeboot.img ^^^ ^^^ from from At present, only local tftp servers are supported (ie, dnsmasq runs as the tftp server), but we could improve this in future by adding a server= attribute. Signed-off-by: Jeremy Kerr Signed-off-by: Paolo Bonzini 2009-09-14 Paolo Bonzini Jeremy Kerr * docs/formatnetwork.html.in: Document new tags. * docs/formatnetwork.html: Regenerate. * docs/schemas/network.rng: Update. * src/network_conf.c (virNetworkDefFree): Free new fields. (virNetworkDHCPRangeDefParseXML): Parse . (virNetworkIPParseXML): New, parsing and . (virNetworkDefParseXML): Use virNetworkIPParseXML instead of virNetworkDHCPRangeDefParseXML. (virNetworkDefFormat): Pretty print new fields. * src/network_conf.h (struct _virNetworkDef): Add netboot fields. * src/network_driver.c (networkBuildDnsmasqArgv): Add TFTP and BOOTP arguments. * tests/Makefile.am (EXTRA_DIST): Add networkschemadata. * tests/networkschematest: Look in networkschemadata. * tests/networkschemadata/netboot-network.xml: New. --- docs/formatnetwork.html | 12 +- docs/formatnetwork.html.in | 12 +- docs/schemas/network.rng| 10 src/network_conf.c | 60 +- src/network_conf.h |3 + src/network_driver.c| 14 ++ tests/Makefile.am |1 + tests/networkschemadata/netboot-network.xml | 12 + tests/networkschematest |2 +- 9 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 tests/networkschemadata/netboot-network.xml diff --git a/docs/formatnetwork.html b/docs/formatnetwork.html index 845e558..1f01f5d 100644 --- a/docs/formatnetwork.html +++ b/docs/formatnetwork.html @@ -235,7 +235,13 @@ address will be their default route. The netmask attribute defines the significant bits of the network address, again specified in dotted-decimal format. Since 0.3.0 - dhcpImmediately within the ip element there is an + tftpImmediately within + the ip element there is an optional tftp + element. The presence of this element and of its attribute + root enables TFTP services. The attribute specifies + the path to the root directory served via TFTP. + Since 0.7.1 + dhcpAlso within the ip element there is an optional dhcp element. The presence of this element enables DHCP services on the virtual network. It will further contain one or more range elements. @@ -253,6 +259,10 @@ assigned to that host (via the ip attribute), and the name to be given that host by the DHCP server (via the name attribute). Since 0.4.5 + bootpThe optional bootp + element specifies BOOTP options to be provided by the DHCP server. + Only one attribute is supported, file, giving the file + to be used for the boot image). Since 0.7.1. Example configuration diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index fd68430..fb93a12 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -114,7 +114,13 @@ attribute defines the significant bits of the network address, again specified in dotted-decimal format. Since 0.3.0 - dhcp + tftpImmediately within + the ip element there is an optional tftp + element. The presence of this element and of its attribute + root enables TFTP services. The attribute specifies + the path to the root directory served via TFTP. + Since 0.7.1 + dhcpAlso within the ip element there is an Immediately within the ip element there is an optional dhcp element. The presence of this element enables DHCP services on the virtual network. It will further @@ -138,6 +144,10 @@ name to be given that host by the DHCP server (via the name attribute). Since 0.4.5 + bootpThe optional bootp + element specifies BOOTP options to be provided by the DHCP server. + Only one attribute is supported, file, giving the file + to be used for the boot image). Since 0.7.1. Example con
Re: [libvirt] [RFC, PATCH] network: add 'netboot' option to dhcp config
On 09/11/2009 06:47 AM, Jeremy Kerr wrote: Currently, libvirtd will start a dnsmasq process for the virtual network, but (aside from killing the dnsmasq process and replacing it), there's no way to define tftp boot options. This change introduces a 'netboot' tag to the dhcp configuration: default When root= and file= attributes are present, these are passed to the arguments to dnsmasq: dnsmasq [...] --enable-tftp --tftp-root /srv/tftp --dhcp-boot pxeboot.img At present, only local tftp servers are supported (ie, dnsmasq runs as the tftp server), but we could improve this in future by adding a server= attribute. Since there is only one TFTP server running in the network, it is not possible to specify different roots for different dhcp ranges. I think the schema should be where in the future the bootp argument could grow a server attribute as mentioned by Jeremy. Paolo -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH]: Bug when you try to start machines made will older VBox versions
On Mon, Sep 14, 2009 at 04:53:32PM +0200, Pritesh Kothari wrote: > Hi All, > > Thanks to Florian, who pointed out the bug, due to which you can't start > domains defined with older builds or with empty "FRONTEND/Type" tag in their > xml files. > > Fixed it in the following patch. Okay since it's a bug fix and based on IRC discussions it was validated by the bug reporter, ACK, pushed to git, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH]: Bug when you try to start machines made will older VBox versions
Hi All, Thanks to Florian, who pointed out the bug, due to which you can't start domains defined with older builds or with empty "FRONTEND/Type" tag in their xml files. Fixed it in the following patch. Regards, Pritesh commit 612e914a8b5902f779223f70552a16d86ede6e6f Author: Pritesh Kothari Date: Mon Sep 14 16:35:10 2009 +0200 libvirt: sessionType can't be null while calling OpenRemoteSession diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 8024243..7270710 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -2850,6 +2850,13 @@ static int vboxDomainCreate(virDomainPtr dom) { vrdpPresent = 1; } +if (!vrdpPresent && !sdlPresent && !guiPresent) { +/* if nothing is selected it means either the machine xml + * file is really old or some values are missing so fallback + */ +guiPresent = 1; +} + data->pFuncs->pfnUtf8Free(valueTypeUtf8); } else { @@ -2882,12 +2889,12 @@ static int vboxDomainCreate(virDomainPtr dom) { data->pFuncs->pfnUtf8ToUtf16("vrdp", &sessionType); } -data->vboxObj->vtbl->OpenRemoteSession(data->vboxObj, - data->vboxSession, - iid, - sessionType, - env, - &progress ); +rc = data->vboxObj->vtbl->OpenRemoteSession(data->vboxObj, +data->vboxSession, +iid, +sessionType, +env, +&progress ); if (NS_FAILED(rc)) { vboxError(dom->conn, VIR_ERR_OPERATION_FAILED, "%s", "openremotesession failed, domain can't be started"); -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Interface driver and ESX support
2009/9/14 Daniel Veillard : > On Mon, Sep 14, 2009 at 02:57:52AM +0200, Matthias Bolte wrote: >> Okay, I finally got the patches cleaned up. >> >> I just posted this 12 patches series to the mailing list. Apply them >> all to an up to date git clone and apply the attached, updated ESX >> interface driver stub patch in the end. >> >> Patch 6 of 12 adds the binding for HostCpuIdInfo and contains the >> functions to handle ArrayOf* types. > > Okay, overall they look good to me, but at this point I would rather > add them post 0.7.1 except for a couple of cleanups, i.e. push them > tomorrow after the release, > > Daniel Yep, the patches were meant to be applied after the 0.7.1 release. I posted them now, so Shahar can use some of the new VI API bindings to work on the ESX interface driver. Matthias -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/4] Add usage type/id as a public API property of virSecret
On Fri, Sep 11, 2009 at 06:31:02PM +0100, Daniel P. Berrange wrote: > On Fri, Sep 11, 2009 at 06:17:40PM +0200, Daniel Veillard wrote: > > On Fri, Sep 11, 2009 at 03:19:18PM +0100, Daniel P. Berrange wrote: > > > > > > +/** > > > + * virSecretGetUsageType: > > > + * @secret: a secret object > > > + * > > > + * Get the type of object which uses this secret > > > + * > > > + * Returns a positive integer identifying the type of object, > > > + * or -1 upon error. > > > + */ > > > +int > > > +virSecretGetUsageType(virSecretPtr secret) > > > +{ > > > +DEBUG("secret=%p", secret); > > > + > > > +virResetLastError(); > > > + > > > +if (!VIR_IS_SECRET(secret)) { > > > +virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__); > > > +return (-1); > > > +} > > > +return (secret->usageType); > > > +} > > > + > > > +/** > > > + * virSecretGetUsageID: > > > + * @secret: a secret object > > > + * > > > + * Get the unique identifier of the object with which this > > > + * secret is to be used > > > + * > > > + * Returns a string identifying the object using the secret, > > > + * or NULL upon error > > > + */ > > > +const char * > > > +virSecretGetUsageID(virSecretPtr secret) > > > +{ > > > +DEBUG("secret=%p", secret); > > > + > > > +virResetLastError(); > > > + > > > +if (!VIR_IS_SECRET(secret)) { > > > +virLibSecretError(NULL, VIR_ERR_INVALID_SECRET, __FUNCTION__); > > > +return (NULL); > > > +} > > > +return (secret->usageID); > > > +} > > > + > > > > Looking from the outside I find that hard to graps especially the last > > one. virSecretGetUsageID return value supposed to be an UUID , the > > comment let the user expect this but it seems to be actually free form. > > > > I'm not against the patch but I think this needs some example or > > improved comments to really set properly the mechanism and expectations > > for the user. This may come after as a set of documentations, but if > > the function description could be clarified a bit this would be nice. > > I'll expand the API docs for this method. It is not returning a UUID. > I named it 'ID' to imply a arbitrary type of unique identifier since > the format of the identifier returned by 'virSecretGetUsageID' will > vary depending on what 'virSecretGetUsageType' shows. For a usage > type of VIR_SECRET_USAGE_TYPE_VOLUME, the identifier will be the > full volume file path, eg /var/lib/libvirt/images/encrypted1.img > > As and when we add new usage types (eg perhaps for VNC passwords, or > SPICE credentials), then we'll define appropriate formats for their > identifiers. > > As an example, with virsh, using the virSecretGetUsageID method, it > will now show > > $ virsh secret-list > UUID Usage > --- > 0a81f5b2-8403-7b23-c8d6-21ccc2f80d6f Volume > /home/berrange/VirtualMachines/encrypted2.img > 80cfa88e-baa3-3e6f-a2aa-12d0576bc7c5 Volume /foo/bar > e3a9758f-b0c6-7a3a-ebb9-71a69c930289 Volume > /home/berrange/VirtualMachines/encrypted1.img > e3b61a0f-714a-0b62-78c2-81eeb1d7d7a5 Unused > > The path bit of the usage there comes directly from the virSecretGetUsageType > method, and also happens to match te .. > XML element contents. Okay, that clears things up ! ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Interface driver and ESX support
On Mon, Sep 14, 2009 at 02:57:52AM +0200, Matthias Bolte wrote: > Okay, I finally got the patches cleaned up. > > I just posted this 12 patches series to the mailing list. Apply them > all to an up to date git clone and apply the attached, updated ESX > interface driver stub patch in the end. > > Patch 6 of 12 adds the binding for HostCpuIdInfo and contains the > functions to handle ArrayOf* types. Okay, overall they look good to me, but at this point I would rather add them post 0.7.1 except for a couple of cleanups, i.e. push them tomorrow after the release, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/4] Fix UUID handling in secrets/storage encryption APIs
On Fri, Sep 11, 2009 at 08:28:59PM -0400, Miloslav Trmac wrote: > > - "Daniel P. Berrange" wrote: > > @@ -635,49 +620,25 @@ secretLookupByUUIDString(virConnectPtr conn, > > const char *uuid) > > > > pptr = secretFind(driver, uuid); > > if (pptr == NULL) { > > +char uuidstr[VIR_UUID_STRING_BUFLEN]; > > +virUUIDFormat(uuid, uuidstr); > > virSecretReportError(conn, VIR_ERR_NO_SECRET, > > - _("no secret with matching id '%s'"), uuid); > > + _("no secret with matching uuid '%s'"), > > uuidstr); > > goto cleanup; > > } > > > > -ret = virGetSecret(conn, (*pptr)->def->id); > > +ret = virGetSecret(conn, (*pptr)->def->uuid); > > > > cleanup: > > +if (1) { > > +char uuidstr[VIR_UUID_STRING_BUFLEN]; > > +virUUIDFormat(uuid, uuidstr); > > +VIR_ERROR("Lookup %s got %p", uuidstr, ret); > > +} > This looks like a debug print that should be removed in the final version. Opps, yes that's killed now Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] RFE storage cloning across connections.
Virt-manager now supports migration and VM cloning however cloning only works within a connection though so you can't clone to another machine. It certainly would be a nice addition if supports storage cloning across connections. Best regards. Jóhann B. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Python binding to virConnectListInterfaces
On Mon, Sep 14, 2009 at 03:26:01AM -0700, Shahar Klein wrote: > > > Hi > > I'm trying to implement virConnectListInterfaces for the ESX driver > (actually the esx_interface driver) > but the python generator does not write the code for this function yes, basically it doesn't know how to handle char **const names parameter. > in generator.py this function is in a special table called: skip_impl > > and there is a comment saying: > # Class methods which are written by hand in libvir.c but the Python-level > # code is still automatically generated (so they are not in skip_function()) > > I'm not sure what does it mean add the function name there so that the generator won't try to add the bindings > should I implement in libvir.c? yes and > and I'm done? add an entry for the function in python/libvirt-python-api.xml that's an XML description of the intefaces fow which bindings are implemented manually. I guess if you have the 3 you should be all set. See for example how virConnectListDomains is handled, that should be fairly similar except with strings. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix win32 platform build
On Mon, Sep 14, 2009 at 01:32:38PM +0100, Daniel P. Berrange wrote: > * configure.in: Only define WITH_SECRETS if libvirtd is present > * src/Makefile.am: Only build secrets driver if WITH_SECRETS is > defined. Always add SECRET_DRIVER_SOURCES to EXTRA_DIST > --- > configure.in| 11 +++ > src/Makefile.am |3 +++ > 2 files changed, 14 insertions(+), 0 deletions(-) > > diff --git a/configure.in b/configure.in > index 120f7e7..fad1297 100644 > --- a/configure.in > +++ b/configure.in > @@ -1062,6 +1062,17 @@ AM_CONDITIONAL([WITH_NETCF], [test "$with_netcf" = > "yes"]) > AC_SUBST([NETCF_CFLAGS]) > AC_SUBST([NETCF_LIBS]) > > + > +with_secrets=yes > +if test "$with_libvirtd" = "no"; then > + with_secrets=no > +fi > +if test "$with_secrets" = "yes" ; then > + AC_DEFINE_UNQUOTED([WITH_SECRETS], 1, [whether local secrets management > driver is available]) > +fi > +AM_CONDITIONAL([WITH_SECRETS], [test "$with_secrets" = "yes"]) > + > + > AC_ARG_WITH([storage-fs], > [ --with-storage-fs with FileSystem backend for the storage > driver (on)],[],[with_storage_fs=check]) > AC_ARG_WITH([storage-lvm], > diff --git a/src/Makefile.am b/src/Makefile.am > index 14a3a63..69f5ee7 100644 > --- a/src/Makefile.am > +++ b/src/Makefile.am > @@ -461,6 +461,7 @@ endif > libvirt_driver_interface_la_SOURCES = $(INTERFACE_DRIVER_SOURCES) > endif > > +if WITH_SECRETS > if WITH_DRIVER_MODULES > mod_LTLIBRARIES += libvirt_driver_secret.la > else > @@ -471,6 +472,7 @@ if WITH_DRIVER_MODULES > libvirt_driver_secret_la_LDFLAGS = -module -avoid-version > endif > libvirt_driver_secret_la_SOURCES = $(SECRET_DRIVER_SOURCES) > +endif > > # Needed to keep automake quiet about conditionals > libvirt_driver_storage_la_SOURCES = > @@ -574,6 +576,7 @@ EXTRA_DIST += > \ > $(NODE_DEVICE_DRIVER_HAL_SOURCES) \ > $(NODE_DEVICE_DRIVER_DEVKIT_SOURCES)\ > $(SECURITY_DRIVER_SELINUX_SOURCES) \ > + $(SECRET_DRIVER_SOURCES)\ > $(VBOX_DRIVER_EXTRA_DIST) > > # Good catch, ACK ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix win32 platform build
* configure.in: Only define WITH_SECRETS if libvirtd is present * src/Makefile.am: Only build secrets driver if WITH_SECRETS is defined. Always add SECRET_DRIVER_SOURCES to EXTRA_DIST --- configure.in| 11 +++ src/Makefile.am |3 +++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/configure.in b/configure.in index 120f7e7..fad1297 100644 --- a/configure.in +++ b/configure.in @@ -1062,6 +1062,17 @@ AM_CONDITIONAL([WITH_NETCF], [test "$with_netcf" = "yes"]) AC_SUBST([NETCF_CFLAGS]) AC_SUBST([NETCF_LIBS]) + +with_secrets=yes +if test "$with_libvirtd" = "no"; then + with_secrets=no +fi +if test "$with_secrets" = "yes" ; then + AC_DEFINE_UNQUOTED([WITH_SECRETS], 1, [whether local secrets management driver is available]) +fi +AM_CONDITIONAL([WITH_SECRETS], [test "$with_secrets" = "yes"]) + + AC_ARG_WITH([storage-fs], [ --with-storage-fs with FileSystem backend for the storage driver (on)],[],[with_storage_fs=check]) AC_ARG_WITH([storage-lvm], diff --git a/src/Makefile.am b/src/Makefile.am index 14a3a63..69f5ee7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -461,6 +461,7 @@ endif libvirt_driver_interface_la_SOURCES = $(INTERFACE_DRIVER_SOURCES) endif +if WITH_SECRETS if WITH_DRIVER_MODULES mod_LTLIBRARIES += libvirt_driver_secret.la else @@ -471,6 +472,7 @@ if WITH_DRIVER_MODULES libvirt_driver_secret_la_LDFLAGS = -module -avoid-version endif libvirt_driver_secret_la_SOURCES = $(SECRET_DRIVER_SOURCES) +endif # Needed to keep automake quiet about conditionals libvirt_driver_storage_la_SOURCES = @@ -574,6 +576,7 @@ EXTRA_DIST += \ $(NODE_DEVICE_DRIVER_HAL_SOURCES) \ $(NODE_DEVICE_DRIVER_DEVKIT_SOURCES)\ $(SECURITY_DRIVER_SELINUX_SOURCES) \ + $(SECRET_DRIVER_SOURCES)\ $(VBOX_DRIVER_EXTRA_DIST) # -- 1.6.2.5 -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] ESX [07/12]: Whitespace cleanup
On Mon, Sep 14, 2009 at 02:43:33AM +0200, Matthias Bolte wrote: > Subject says it all. > diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c > index 745b744..8194b49 100644 > --- a/src/esx/esx_driver.c > +++ b/src/esx/esx_driver.c > @@ -752,13 +752,13 @@ esxGetHostname(virConnectPtr conn) > } > } > > -if (hostName == NULL || strlen (hostName) < 1) { > +if (hostName == NULL || strlen(hostName) < 1) { > ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, >"Missing or empty 'hostName' property"); > goto failure; > } > > -if (domainName == NULL || strlen (domainName) < 1) { > +if (domainName == NULL || strlen(domainName) < 1) { > ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, >"Missing or empty 'domainName' property"); > goto failure; > @@ -800,7 +800,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr > nodeinfo) > int32_t numaInfo_numNodes = 0; > char *ptr = NULL; > > -memset (nodeinfo, 0, sizeof (virNodeInfo)); > +memset(nodeinfo, 0, sizeof(virNodeInfo)); > > if (priv->phantom) { > ESX_ERROR(conn, VIR_ERR_OPERATION_INVALID, > @@ -891,11 +891,11 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr > nodeinfo) > > /* Strip the string to fit more relevant information in 32 chars > */ > while (*ptr != '\0') { > -if (STRPREFIX (ptr, " ")) { > -memmove(ptr, ptr + 1, strlen (ptr + 1) + 1); > +if (STRPREFIX(ptr, " ")) { > +memmove(ptr, ptr + 1, strlen(ptr + 1) + 1); > continue; > } else if (STRPREFIX(ptr, "(R)") || STRPREFIX(ptr, "(C)")) { > -memmove(ptr, ptr + 3, strlen (ptr + 3) + 1); > +memmove(ptr, ptr + 3, strlen(ptr + 3) + 1); > continue; > } else if (STRPREFIX(ptr, "(TM)")) { > memmove(ptr, ptr + 4, strlen(ptr + 4) + 1); > @@ -905,9 +905,9 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr > nodeinfo) > ++ptr; > } > > -strncpy (nodeinfo->model, dynamicProperty->val->string, > - sizeof (nodeinfo->model) - 1); > -nodeinfo->model[sizeof (nodeinfo->model) - 1] = '\0'; > +strncpy(nodeinfo->model, dynamicProperty->val->string, > +sizeof(nodeinfo->model) - 1); > +nodeinfo->model[sizeof(nodeinfo->model) - 1] = '\0'; > } else { > VIR_WARN("Unexpected '%s' property", dynamicProperty->name); > } > @@ -1196,7 +1196,7 @@ esxDomainLookupByUUID(virConnectPtr conn, const > unsigned char *uuid) > } > > if (memcmp(uuid, uuid_candidate, > - VIR_UUID_BUFLEN * sizeof (unsigned char)) != 0) { > + VIR_UUID_BUFLEN * sizeof(unsigned char)) != 0) { > continue; > } > > @@ -2732,7 +2732,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain, > dynamicProperty != NULL && mask != 7 && i < 3; > dynamicProperty = dynamicProperty->_next) { > if (STREQ(dynamicProperty->name, "config.cpuAllocation.reservation") > && > -!(mask & (1 << 0))) { > +! (mask & (1 << 0))) { > snprintf (params[i].field, VIR_DOMAIN_SCHED_FIELD_LENGTH, "%s", >"reservation"); > > @@ -2748,7 +2748,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain, > ++i; > } else if (STREQ(dynamicProperty->name, > "config.cpuAllocation.limit") && > - !(mask & (1 << 1))) { > + ! (mask & (1 << 1))) { > snprintf (params[i].field, VIR_DOMAIN_SCHED_FIELD_LENGTH, "%s", >"limit"); > > @@ -2764,7 +2764,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain, > ++i; > } else if (STREQ(dynamicProperty->name, > "config.cpuAllocation.shares") && > - !(mask & (1 << 2))) { > + ! (mask & (1 << 2))) { > snprintf (params[i].field, VIR_DOMAIN_SCHED_FIELD_LENGTH, "%s", >"shares"); > > diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c > index 38014de..7130a41 100644 > --- a/src/esx/esx_util.c > +++ b/src/esx/esx_util.c > @@ -271,7 +271,7 @@ esxUtil_ResolveHostname(virConnectPtr conn, const char > *hostname, > struct addrinfo *result = NULL; > int errcode; > > -memset(&hints, 0, sizeof (struct addrinfo)); > +memset(&hints, 0, sizeof(struct addrinfo)); > > hints.ai_flags = AI_ADDRCONFIG; > hints.ai_family = AF_INET; > @@ -455,12 +455,12 @@ esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr > conf, const char *name, > > int > esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf, > - const
Re: [libvirt] ESX [05/12]: Also strip (C) and (TM) from the CPU model string
On Mon, Sep 14, 2009 at 02:42:35AM +0200, Matthias Bolte wrote: > * src/esx/esx_driver.c: also strip (C) and (TM) from the CPU model string > diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c > index 3f3ee30..96d5976 100644 > --- a/src/esx/esx_driver.c > +++ b/src/esx/esx_driver.c > @@ -746,9 +746,12 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr > nodeinfo) > if (STRPREFIX (ptr, " ")) { > memmove(ptr, ptr + 1, strlen (ptr + 1) + 1); > continue; > -} else if (STRPREFIX (ptr, "(R)")) { > +} else if (STRPREFIX(ptr, "(R)") || STRPREFIX(ptr, "(C)")) { > memmove(ptr, ptr + 3, strlen (ptr + 3) + 1); > continue; > +} else if (STRPREFIX(ptr, "(TM)")) { > +memmove(ptr, ptr + 4, strlen(ptr + 4) + 1); > +continue; > } > > ++ptr; Okay, I think it's better to have this sooner than later, first it's a cleanup and it's also somehow an interface, if people start to use those values it's better for them to have the cleaned up set, and I don't see any risk. So pushed to git too, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] ESX [11/12]: Reorder some function calls to avoid potential virDomainPtr leaks
On Mon, Sep 14, 2009 at 02:45:34AM +0200, Matthias Bolte wrote: > * src/esx/esx_driver.c: avoid potential virDomainPtr leaks > diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c > index 5a93d1f..91de407 100644 > --- a/src/esx/esx_driver.c > +++ b/src/esx/esx_driver.c Okay, that's clearly a bug fix applying to current code, so commited now, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Python binding to virConnectListInterfaces
Hi I'm trying to implement virConnectListInterfaces for the ESX driver (actually the esx_interface driver) but the python generator does not write the code for this function in generator.py this function is in a special table called: skip_impl and there is a comment saying: # Class methods which are written by hand in libvir.c but the Python-level # code is still automatically generated (so they are not in skip_function()) I'm not sure what does it mean should I implement in libvir.c? and I'm done? thanks ahead Shahar -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH]: API Change patch for VBox 3.0.6
On Mon, Sep 14, 2009 at 09:11:29AM +0200, Pritesh Kothari wrote: > Hi All, > > VirtualBox 3.0.6 was released few days ago and there were some minor API > changes in it. I have created a patch for the same and posting it here. Okay, since you promised me on IRC this was really risk free and fully tested, I applied it so 0.7.1 can have support for the new release, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Interface driver and ESX support
Thanks Matthias works great : ) From: Matthias Bolte To: Shahar Klein Cc: libvir-list@redhat.com Sent: Monday, September 14, 2009 3:57:52 AM Subject: Re: [libvirt] Interface driver and ESX support Okay, I finally got the patches cleaned up. I just posted this 12 patches series to the mailing list. Apply them all to an up to date git clone and apply the attached, updated ESX interface driver stub patch in the end. Patch 6 of 12 adds the binding for HostCpuIdInfo and contains the functions to handle ArrayOf* types. Matthias 2009/9/13 Shahar Klein : > I see > You are making my (coding) life easier : ) > thanks > > From: Matthias Bolte > To: Shahar Klein > Cc: libvir-list@redhat.com > Sent: Sunday, September 13, 2009 4:39:22 PM > Subject: Re: [libvirt] Interface driver and ESX support > > No, as I said before you should wait until you can use the unpublished > binding of HostCpuIdInfo as an example. This also includes the code to > handle ArrayOf* types. I'm currently cleaning up this patches (didn't > have time on thursday for that) and will post them today, just wait > for this patches, because they will help you. > > Matthias > > 2009/9/13 Shahar Klein : >> I've defined (among others): >> int esxVI_PhysicalNic_CastListFromAnyType(virConnectPtr conn, >> esxVI_AnyType >> *anyType, esxVI_PhysicalNic **pNicList); >> but runing it returns somthing like: >> Expecting type 'PhysicalNic' but found 'ArrayOfPhysicalNic' >> Does it mean I should also implement: >> esxVI_ArrayOfPhysicalNic_CastListFromAnyType() >> and all the funcs/type definition coming with it? >> thanks >> Shahar >> >> From: Matthias Bolte >> To: Shahar Klein >> Cc: libvir-list@redhat.com >> Sent: Thursday, September 10, 2009 6:24:25 PM >> Subject: Re: [libvirt] Interface driver and ESX support >> >> 2009/9/10 Shahar Klein : >>> I'm not sure what you mean about mapping >>> lets take the pnics as a study case for me >>> do I need to define a structure similar to this: >>> >>> >>> http://www.vmware.com/support/developer/vc-sdk/visdk400pubs/ReferenceGuide/vim.host.PhysicalNic.html >>> and also take care for it's allocation? >>> >> >> Yes, you need to implement the mapping (a better word may be >> 'binding') of this VI API type to a C type, that also includes to care >> about its allocation. You'll need to implement at least this set of >> function in esx_vi_types.[ch]: >> >> esxVI_PhysicalNic_Alloc() >> esxVI_PhysicalNic_Free() >> esxVI_PhysicalNic_CastFromAnyType() >> esxVI_PhysicalNic_CastListFromAnyType() >> esxVI_PhysicalNic_Deserialize() >> esxVI_PhysicalNic_DeserializeList() >> >> You could use the binding for the HostCpuIdInfo type, but >> unfortunately I haven't published the code for it yet. This code also >> includes some essential helper functions for >> esxVI_PhysicalNic_CastListFromAnyType(). >> >> Beside the PhysicalNic type, you may also have to bind the types of >> its members like PhysicalNicLinkInfo, PhysicalNicSpec and >> HostIpConfig, if you need or care about the information provided by >> them. >> >> The binding for HostCpuIdInfo is part of a larger set of patches that >> add some new features to ESX driver, but the patches needs some >> cleanup first. I may have some time later this evening to clean them >> up and post them. >> >> PS: You should refer to version 2.5 of the VI API [1] and not 4.0, >> because the complete VI API mapping is currently based on version 2.5. >> At some point I'll have to properly distinguish between version 2.5 >> and 4.0, but currently I would like to stick to version 2.5 only. >> >> [1] >> http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/ >> >> Matthias >> >> > > -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH]: API Change patch for VBox 3.0.6
Hi All, VirtualBox 3.0.6 was released few days ago and there were some minor API changes in it. I have created a patch for the same and posting it here. Regards, Pritesh commit 72088db113ce5837cce91616ebbf64dcd1a2b0ee Author: Pritesh Kothari Date: Mon Sep 14 09:05:38 2009 +0200 libvirt: API Changes for VBox 3.0.6 diff --git a/src/vbox/vbox_CAPI_v3_0.h b/src/vbox/vbox_CAPI_v3_0.h index 13b4d4d..0644dd9 100644 --- a/src/vbox/vbox_CAPI_v3_0.h +++ b/src/vbox/vbox_CAPI_v3_0.h @@ -899,6 +899,7 @@ struct nsIEventQueue { struct IVirtualBoxErrorInfo; +struct ILocalOwner; struct IVirtualBoxCallback; struct IDHCPServer; struct IVirtualBox; @@ -954,6 +955,7 @@ struct IPerformanceMetric; struct IPerformanceCollector; typedef struct IVirtualBoxErrorInfo IVirtualBoxErrorInfo; +typedef struct ILocalOwner ILocalOwner; typedef struct IVirtualBoxCallback IVirtualBoxCallback; typedef struct IDHCPServer IDHCPServer; typedef struct IVirtualBox IVirtualBox; @@ -1840,6 +1842,30 @@ struct IVirtualBoxErrorInfo /* End of struct IVirtualBoxErrorInfo Declaration */ +/* Start of struct ILocalOwner Declaration */ +#define ILOCALOWNER_IID_STR "308FF42A-DC45-49D4-A950-B1EEE5E00BB5" +#define ILOCALOWNER_IID { \ +0x308FF42A, 0xDC45, 0x49D4, \ +{ 0xA9, 0x50, 0xB1, 0xEE, 0xE5, 0xE0, 0x0B, 0xB5 } \ +} +struct ILocalOwner_vtbl +{ +struct nsISupports_vtbl nsisupports; + +nsresult (*SetLocalObject)( +ILocalOwner *pThis, +nsISupports * object +); + +}; + +struct ILocalOwner +{ +struct ILocalOwner_vtbl *vtbl; +}; +/* End of struct ILocalOwner Declaration */ + + /* Start of struct IVirtualBoxCallback Declaration */ #define IVIRTUALBOXCALLBACK_IID_STR "2990059f-5bc8-4635-8415-658917cd3186" #define IVIRTUALBOXCALLBACK_IID { \ @@ -5050,9 +5076,9 @@ struct IInternalSessionControl /* Start of struct ISession Declaration */ -#define ISESSION_IID_STR "12F4DCDB-12B2-4ec1-B7CD-DDD9F6C5BF4D" +#define ISESSION_IID_STR "12F4DCDB-12B2-4EC1-B7CD-DDD9F6C5BF4D" #define ISESSION_IID { \ -0x12F4DCDB, 0x12B2, 0x4ec1, \ +0x12F4DCDB, 0x12B2, 0x4EC1, \ { 0xB7, 0xCD, 0xDD, 0xD9, 0xF6, 0xC5, 0xBF, 0x4D } \ } struct ISession_vtbl @@ -5262,7 +5288,7 @@ struct IPerformanceCollector #define NS_SESSION_CID { \ -0x3C02F46D, 0xC9D2, 0x4f11, \ +0x3C02F46D, 0xC9D2, 0x4F11, \ { 0xA3, 0x84, 0x53, 0xF0, 0xCF, 0x91, 0x72, 0x14 } \ } #define NS_SESSION_CONTRACTID "@virtualbox.org/Session;1" @@ -5271,6 +5297,16 @@ struct IPerformanceCollector +#define NS_CALLBACKWRAPPER_CID { \ +0x49EE8561, 0x5563, 0x4715, \ +{ 0xB1, 0x8C, 0xA4, 0xB1, 0xA4, 0x90, 0xDA, 0xFE } \ +} +#define NS_CALLBACKWRAPPER_CONTRACTID "@virtualbox.org/CallbackWrapper;1" +/* for compatibility with Win32 */ +#define CLSID_CallbackWrapper (nsCID) NS_CALLBACKWRAPPER_CID + + + #endif /* !__cplusplus */ #ifdef IN_VBOXXPCOMC -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list