Fabian Freyer wrote: > This patch adds virConnectGetDomainCapabilities support for bhyve. ^^^^^ I've removed this line because it doesn't add anything to what's been specified in the commit title already. Generally, usually it's good to elaborate more on what and why you are committing. > --- > src/bhyve/bhyve_capabilities.c | 26 ++++++++++++++++++++ > src/bhyve/bhyve_capabilities.h | 5 ++++ > src/bhyve/bhyve_driver.c | 56 ++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 87 insertions(+) > > diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c > index d0af4d9..10c33b9 100644 > --- a/src/bhyve/bhyve_capabilities.c > +++ b/src/bhyve/bhyve_capabilities.c > @@ -3,6 +3,7 @@ > * > * Copyright (C) 2014 Roman Bogorodskiy > * Copyright (C) 2014 Semihalf > + * Copyright (C) 2016 Fabian Freyer > * > * This library is free software; you can redistribute it and/or > * modify it under the terms of the GNU Lesser General Public > @@ -106,6 +107,31 @@ virBhyveCapsBuild(void) > return NULL; > } > > +virDomainCapsPtr > +virBhyveDomainCapsBuild(const char *emulatorbin, > + const char *machine, > + virArch arch, > + virDomainVirtType virttype) > +{ > + virDomainCapsPtr caps = NULL; > + > + if (!(caps = virDomainCapsNew(emulatorbin, machine, arch, virttype))) > + goto cleanup; > + > + caps->os.supported = true; > + caps->disk.supported = true; > + VIR_DOMAIN_CAPS_ENUM_SET(caps->disk.diskDevice, > + VIR_DOMAIN_DISK_DEVICE_DISK, > + VIR_DOMAIN_DISK_DEVICE_CDROM); > + > + VIR_DOMAIN_CAPS_ENUM_SET(caps->disk.bus, > + VIR_DOMAIN_DISK_BUS_SATA, > + VIR_DOMAIN_DISK_BUS_VIRTIO); > + > + cleanup: > + return caps; > +} > + > int > virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps) > { > diff --git a/src/bhyve/bhyve_capabilities.h b/src/bhyve/bhyve_capabilities.h > index 0eb22a4..85018cb 100644 > --- a/src/bhyve/bhyve_capabilities.h > +++ b/src/bhyve/bhyve_capabilities.h > @@ -23,8 +23,13 @@ > # define _BHYVE_CAPABILITIES > > # include "capabilities.h" > +#include "conf/domain_capabilities.h" Indent: should be "# include ..." (syntax-check caches that). > > virCapsPtr virBhyveCapsBuild(void); > +virDomainCapsPtr virBhyveDomainCapsBuild(const char *emulatorbin, > + const char *machine, > + virArch arch, > + virDomainVirtType virttype); > > /* These are bit flags: */ > typedef enum { > diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c > index 8036661..ae37a2d 100644 > --- a/src/bhyve/bhyve_driver.c > +++ b/src/bhyve/bhyve_driver.c > @@ -53,6 +53,7 @@ > #include "nodeinfo.h" > #include "virhostcpu.h" > #include "virhostmem.h" > +#include "conf/domain_capabilities.h" > > #include "bhyve_device.h" > #include "bhyve_driver.h" > @@ -1539,6 +1540,60 @@ bhyveConnectIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED) > return 0; > } > > +static char * > +bhyveConnectGetDomainCapabilities(virConnectPtr conn, > + const char *emulatorbin, > + const char *arch_str, > + const char *machine, > + const char *virttype_str, > + unsigned int flags) > +{ > + //bhyveConnPtr privconn = conn->privateData; Stale comment. > + virDomainCapsPtr caps = NULL; > + char *ret = NULL; > + int virttype = VIR_DOMAIN_VIRT_BHYVE; > + int arch = virArchFromHost(); /* virArch */ > + > + virCheckFlags(0, ret); > + > + if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0) > + return ret; > + > + if (virttype_str && > + (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) { > + virReportError(VIR_ERR_INVALID_ARG, > + _("unknown virttype: %s"), > + virttype_str); > + goto cleanup; > + } > + > + if (virttype != VIR_DOMAIN_VIRT_BHYVE) { > + virReportError(VIR_ERR_INVALID_ARG, > + _("unknown virttype: %s"), > + virttype_str); > + goto cleanup; > + } > + > + if (arch_str && (arch = virArchFromString(arch_str)) == VIR_ARCH_NONE) { > + virReportError(VIR_ERR_INVALID_ARG, > + _("unknown architecture: %s"), > + arch_str); > + goto cleanup; > + } > + > + if (emulatorbin == NULL) > + emulatorbin = "/usr/sbin/bhyve"; I've inserted this bit as we discussed yesterday: https://gist.github.com/fabianfreyer/d54d36ce53004af3d7da4c5ecf973421 (with a minor change to not check emulatorbin twice). > + if (!(caps = virBhyveDomainCapsBuild(emulatorbin, machine, arch, virttype))) > + goto cleanup; > + > + ret = virDomainCapsFormat(caps); > + > + cleanup: > + virObjectUnref(caps); > + return ret; > +} > + > static virHypervisorDriver bhyveHypervisorDriver = { > .name = "bhyve", > .connectOpen = bhyveConnectOpen, /* 1.2.2 */ > @@ -1592,6 +1647,7 @@ static virHypervisorDriver bhyveHypervisorDriver = { > .connectIsAlive = bhyveConnectIsAlive, /* 1.3.5 */ > .connectIsSecure = bhyveConnectIsSecure, /* 1.3.5 */ > .connectIsEncrypted = bhyveConnectIsEncrypted, /* 1.3.5 */ > + .connectGetDomainCapabilities = bhyveConnectGetDomainCapabilities, /* 2.1.0 */ > }; > ACK and pushed with the described changes squashed in. Roman Bogorodskiy
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list