[PATCH v2 06/10] hyperv: implement connectGetMaxVcpus
Neal Gompa
ngompa13 at gmail.com
Tue Oct 6 01:00:00 UTC 2020
On Mon, Oct 5, 2020 at 12:21 PM Matt Coleman <mcoleman at datto.com> wrote:
>
> Co-authored-by: Sri Ramanujam <sramanujam at datto.com>
> Signed-off-by: Matt Coleman <matt at datto.com>
> ---
> src/hyperv/hyperv_driver.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
> index 93e08c54c0..bbe892fd62 100644
> --- a/src/hyperv/hyperv_driver.c
> +++ b/src/hyperv/hyperv_driver.c
> @@ -553,6 +553,39 @@ hypervConnectGetCapabilities(virConnectPtr conn)
>
>
>
> +static int
> +hypervConnectGetMaxVcpus(virConnectPtr conn, const char *type G_GNUC_UNUSED)
> +{
> + int result = -1;
> + hypervPrivate *priv = conn->privateData;
> + g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER;
> + Msvm_ProcessorSettingData *processorSettingData = NULL;
> +
> + /* Get max processors definition */
> + virBufferAddLit(&query,
> + MSVM_PROCESSORSETTINGDATA_WQL_SELECT
> + "WHERE InstanceID LIKE 'Microsoft:Definition%Maximum'");
> +
> + if (hypervGetWmiClass(Msvm_ProcessorSettingData, &processorSettingData) < 0)
> + goto cleanup;
> +
> + if (!processorSettingData) {
> + virReportError(VIR_ERR_INTERNAL_ERROR,
> + _("Could not get maximum definition of Msvm_ProcessorSettingData for host %s"),
> + conn->uri->server);
> + goto cleanup;
> + }
> +
> + result = processorSettingData->data.common->VirtualQuantity;
> +
> + cleanup:
> + hypervFreeObject(priv, (hypervObject *) processorSettingData);
> +
> + return result;
> +}
> +
> +
> +
> static int
> hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
> {
> @@ -1689,6 +1722,7 @@ static virHypervisorDriver hypervHypervisorDriver = {
> .connectClose = hypervConnectClose, /* 0.9.5 */
> .connectGetType = hypervConnectGetType, /* 0.9.5 */
> .connectGetHostname = hypervConnectGetHostname, /* 0.9.5 */
> + .connectGetMaxVcpus = hypervConnectGetMaxVcpus, /* 6.9.0 */
> .nodeGetInfo = hypervNodeGetInfo, /* 0.9.5 */
> .connectGetCapabilities = hypervConnectGetCapabilities, /* 6.9.0 */
> .connectListDomains = hypervConnectListDomains, /* 0.9.5 */
> --
> 2.27.0
>
>
Reviewed-by: Neal Gompa <ngompa13 at gmail.com>
--
真実はいつも一つ!/ Always, there's only one truth!
More information about the libvir-list
mailing list