Daniel P. Berrange wrote:
On Sun, Jul 19, 2015 at 11:20:35AM +0300, Roman Bogorodskiy wrote:
> Bhyve as of r279225 (FreeBSD -CURRENT) or r284894 (FreeBSD 10-STABLE)
> supports using UTC time offset via the '-u' argument to bhyve(8). By
> default it's still using localtime.
>
> Make the bhyve driver use UTC clock if it's requested by specifying
> <clock offset='utc'> in domain XML and if the bhyve(8) binary
supports
> the '-u' flag.
> ---
> src/bhyve/bhyve_capabilities.c | 31 ++++++++++++++++++++++
> src/bhyve/bhyve_capabilities.h | 5 ++++
> src/bhyve/bhyve_command.c | 21 +++++++++++++++
> src/bhyve/bhyve_driver.c | 13 +++++++++
> src/bhyve/bhyve_driver.h | 2 ++
> src/bhyve/bhyve_utils.h | 1 +
> .../bhyvexml2argvdata/bhyvexml2argv-acpiapic.args | 2 +-
> tests/bhyvexml2argvdata/bhyvexml2argv-base.args | 2 +-
> .../bhyvexml2argv-bhyveload-explicitargs.args | 2 +-
> tests/bhyvexml2argvdata/bhyvexml2argv-console.args | 2 +-
> .../bhyvexml2argv-custom-loader.args | 2 +-
> .../bhyvexml2argv-disk-cdrom-grub.args | 2 +-
> .../bhyvexml2argv-disk-cdrom.args | 2 +-
> .../bhyvexml2argv-disk-virtio.args | 2 +-
> .../bhyvexml2argv-grub-bootorder.args | 2 +-
> .../bhyvexml2argv-grub-bootorder2.args | 2 +-
> .../bhyvexml2argv-grub-defaults.args | 2 +-
> .../bhyvexml2argvdata/bhyvexml2argv-localtime.args | 3 +++
> .../bhyvexml2argv-localtime.ldargs | 1 +
> .../bhyvexml2argvdata/bhyvexml2argv-localtime.xml | 23 ++++++++++++++++
> tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.args | 2 +-
> .../bhyvexml2argv-serial-grub-nocons.args | 2 +-
> .../bhyvexml2argv-serial-grub.args | 2 +-
> tests/bhyvexml2argvdata/bhyvexml2argv-serial.args | 2 +-
> tests/bhyvexml2argvtest.c | 2 ++
> 25 files changed, 117 insertions(+), 15 deletions(-)
> create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-localtime.args
> create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-localtime.ldargs
> create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-localtime.xml
>
> diff --git a/src/bhyve/bhyve_capabilities.c b/src/bhyve/bhyve_capabilities.c
> index 3a55879..9b21649 100644
> --- a/src/bhyve/bhyve_capabilities.c
> +++ b/src/bhyve/bhyve_capabilities.c
> @@ -141,3 +141,34 @@ virBhyveProbeGrubCaps(virBhyveGrubCapsFlags *caps)
> VIR_FREE(binary);
> return ret;
> }
> +
> +int
> +virBhyveProbeCaps(virBhyveCapsFlags *caps)
This output parameter is intended to be a union of many enum
values, so you can't declare it as an enum - it should be a
plain unsigned int.
> +{
> + char *binary, *help;
> + virCommandPtr cmd = NULL;
> + int ret = 0, exit;
> +
> + binary = virFindFileInPath("bhyve");
> + if (binary == NULL)
> + goto out;
> + if (!virFileIsExecutable(binary))
> + goto out;
> +
> + cmd = virCommandNew(binary);
> + virCommandAddArg(cmd, "-h");
> + virCommandSetErrorBuffer(cmd, &help);
> + if (virCommandRun(cmd, &exit) < 0) {
> + ret = -1;
> + goto out;
> + }
> +
> + if (strstr(help, "-u:") != NULL)
> + *caps |= BHYVE_CAP_RTC_UTC;
> +
> + out:
> + VIR_FREE(help);
> + virCommandFree(cmd);
> + VIR_FREE(binary);
> + return ret;
> +}
ACK if that is fixed.
Pushed with this fixed, thanks!
Roman Bogorodskiy