[libvirt] [PATCH 04/12] Move qemuCheckCCWS390AddressSupport to qemu_domain
John Ferlan
jferlan at redhat.com
Thu Oct 19 12:08:34 UTC 2017
On 10/17/2017 11:04 AM, Ján Tomko wrote:
> Let it be reused in qemu_domain_address.
Alternatively you could have added "#include qemu_command.h" to
qemu_domain_address.c, right?
IDC about moving, but if you do....
> ---
> src/qemu/qemu_command.c | 40 ----------------------------------------
> src/qemu/qemu_command.h | 5 -----
> src/qemu/qemu_domain.c | 40 ++++++++++++++++++++++++++++++++++++++++
> src/qemu/qemu_domain.h | 5 +++++
> 4 files changed, 45 insertions(+), 45 deletions(-)
>
> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index f68b82d08..138bbdf1a 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -1263,46 +1263,6 @@ qemuCheckDiskConfig(virDomainDiskDefPtr disk)
> }
>
>
> -/* Check whether the device address is using either 'ccw' or default s390
> - * address format and whether that's "legal" for the current qemu and/or
> - * guest os.machine type. This is the corollary to the code which doesn't
> - * find the address type set using an emulator that supports either 'ccw'
> - * or s390 and sets the address type based on the capabilities.
> - *
> - * If the address is using 'ccw' or s390 and it's not supported, generate
> - * an error and return false; otherwise, return true.
> - */
> -bool
> -qemuCheckCCWS390AddressSupport(const virDomainDef *def,
> - virDomainDeviceInfo info,
> - virQEMUCapsPtr qemuCaps,
> - const char *devicename)
> -{
> - if (info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
> - if (!qemuDomainIsS390CCW(def)) {
> - virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> - _("cannot use CCW address type for device "
> - "'%s' using machine type '%s'"),
> - devicename, def->os.machine);
> - return false;
> - } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
> - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> - _("CCW address type is not supported by "
> - "this QEMU"));
> - return false;
> - }
> - } else if (info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
> - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
> - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> - _("virtio S390 address type is not supported by "
> - "this QEMU"));
> - return false;
> - }
> - }
> - return true;
> -}
> -
> -
> /* QEMU 1.2 and later have a binary flag -enable-fips that must be
> * used for VNC auth to obey FIPS settings; but the flag only
> * exists on Linux, and with no way to probe for it via QMP. Our
> diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
> index 94e4592cc..1254ad4df 100644
> --- a/src/qemu/qemu_command.h
> +++ b/src/qemu/qemu_command.h
> @@ -189,11 +189,6 @@ int qemuCheckDiskConfig(virDomainDiskDefPtr disk);
> bool
> qemuCheckFips(void);
>
> -bool qemuCheckCCWS390AddressSupport(const virDomainDef *def,
> - virDomainDeviceInfo info,
> - virQEMUCapsPtr qemuCaps,
> - const char *devicename);
> -
> virJSONValuePtr qemuBuildHotpluggableCPUProps(const virDomainVcpuDef *vcpu)
> ATTRIBUTE_NONNULL(1);
>
> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 05e8b96aa..f6eb4277a 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -10122,3 +10122,43 @@ qemuDomainGetMachineName(virDomainObjPtr vm)
>
> return ret;
> }
> +
> +
> +/* Check whether the device address is using either 'ccw' or default s390
> + * address format and whether that's "legal" for the current qemu and/or
> + * guest os.machine type. This is the corollary to the code which doesn't
> + * find the address type set using an emulator that supports either 'ccw'
> + * or s390 and sets the address type based on the capabilities.
> + *
> + * If the address is using 'ccw' or s390 and it's not supported, generate
> + * an error and return false; otherwise, return true.
> + */
> +bool
> +qemuCheckCCWS390AddressSupport(const virDomainDef *def,
> + virDomainDeviceInfo info,
> + virQEMUCapsPtr qemuCaps,
> + const char *devicename)
... This should be renamed to qemuDomainCheckCCWS390AddressSupport since
it's in qemu_domain.c
> +{
> + if (info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
> + if (!qemuDomainIsS390CCW(def)) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> + _("cannot use CCW address type for device "
> + "'%s' using machine type '%s'"),
> + devicename, def->os.machine);
> + return false;
> + } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> + _("CCW address type is not supported by "
> + "this QEMU"));
> + return false;
> + }
> + } else if (info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
> + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
> + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> + _("virtio S390 address type is not supported by "
> + "this QEMU"));
> + return false;
> + }
> + }
> + return true;
> +}
> diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
> index 5201c6a0a..6abefc929 100644
> --- a/src/qemu/qemu_domain.h
> +++ b/src/qemu/qemu_domain.h
> @@ -978,4 +978,9 @@ qemuDomainFixupCPUs(virDomainObjPtr vm,
> char *
> qemuDomainGetMachineName(virDomainObjPtr vm);
>
> +bool qemuCheckCCWS390AddressSupport(const virDomainDef *def,
> + virDomainDeviceInfo info,
> + virQEMUCapsPtr qemuCaps,
> + const char *devicename);
More recently I've been encouraged by some reviewers to use:
bool
qemuDomainCheck...();
type format to follow the .c file format when adding functions.
John
> +
> #endif /* __QEMU_DOMAIN_H__ */
>
More information about the libvir-list
mailing list