[libvirt] [PATCH 03/11] Convert Xen domain property driver methods to use virDomainDefPtr

Daniel P. Berrange berrange at redhat.com
Fri May 10 09:46:45 UTC 2013


On Thu, May 09, 2013 at 01:07:59PM -0600, Jim Fehlig wrote:
> Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> >
> > Introduce use of a virDomainDefPtr in the domain property
> > APIs to simplify introduction of ACL security checks.
> > The virDomainPtr cannot be safely used, since the app
> > may have supplied mis-matching name/uuid/id fields. eg
> > the name points to domain X, while the uuid points to
> > domain Y. Resolving the virDomainPtr to a virDomainDefPtr
> > ensures a consistent name/uuid/id set.
> >
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>

> >  xenUnifiedDomainGetOSType(virDomainPtr dom)
> >  {
> >      xenUnifiedPrivatePtr priv = dom->conn->privateData;
> > +    char *ret = NULL;
> > +    virDomainDefPtr def;
> >  
> > -    if (dom->id < 0) {
> > +    if (!(def = xenGetDomainDefForDom(dom)))
> > +        goto cleanup;
> > +
> > +    if (def->id < 0) {
> >          if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
> >              virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> >                             _("Unable to query OS type for inactive domain"));
> >              return NULL;
> >          } else {
> > -            return xenDaemonDomainGetOSType(dom);
> > +            ret = xenHypervisorDomainGetOSType(dom->conn, def);
> >   
> 
> Should still call xenDaemonDomainGetOSType here since id < 0 right?
> 
> >          }
> >      } else {
> > -        return xenHypervisorDomainGetOSType(dom);
> > +        ret = xenDaemonDomainGetOSType(dom->conn, def);
> >   
> 
> And call the hypervisor one here when the domain is active.

Yes, dunno how i managed to screw that up :-(


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




More information about the libvir-list mailing list