Re: [libvirt] [PATCH v2] qemu: Limit rtc-reset-reinjection requirement to x86 only.

2015-05-28 Thread Andrea Bolognani
On Wed, 2015-05-27 at 16:55 +0200, Martin Kletzander wrote:

 ACK, will push in a while.

Thanks :)

-- 
Andrea Bolognani
Software Engineer - Virtualization Team
$ python -c print('a'.join(['', 'bologn', '@redh', 't.com']))

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v2] qemu: Limit rtc-reset-reinjection requirement to x86 only.

2015-05-27 Thread Martin Kletzander

On Tue, May 26, 2015 at 06:13:40PM +0200, Andrea Bolognani wrote:

The QMP command, like the interrupt reinjection logic it's connected
to, is only implemented in QEMU when TARGET_I386 is defined, so
checking for its availability on any other architecture is pointless.

On the other hand, when we're on x86, we shouldn still make sure that
rtc-reset-reinjection is available and refuse to set the time
otherwise.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211938
---
src/qemu/qemu_driver.c | 22 +++---
1 file changed, 15 insertions(+), 7 deletions(-)



ACK, will push in a while.


diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index aa0acde..db72bad 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18945,7 +18945,12 @@ qemuDomainSetTime(virDomainPtr dom,
goto endjob;
}

-if (!virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) {
+/* On x86, the rtc-reset-reinjection QMP command must be called after
+ * setting the time to avoid trouble down the line. If the command is
+ * not available, don't set the time at all and report an error */
+if (ARCH_IS_X86(vm-def-os.arch) 
+!virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION))
+{
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, %s,
   _(cannot set time: qemu doesn't support 
 rtc-reset-reinjection command));
@@ -18968,13 +18973,16 @@ qemuDomainSetTime(virDomainPtr dom,
goto endjob;
}

-qemuDomainObjEnterMonitor(driver, vm);
-rv = qemuMonitorRTCResetReinjection(priv-mon);
-if (qemuDomainObjExitMonitor(driver, vm)  0)
-goto endjob;
+/* Don't try to call rtc-reset-reinjection if it's not available */
+if (virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) {
+qemuDomainObjEnterMonitor(driver, vm);
+rv = qemuMonitorRTCResetReinjection(priv-mon);
+if (qemuDomainObjExitMonitor(driver, vm)  0)
+goto endjob;

-if (rv  0)
-goto endjob;
+if (rv  0)
+goto endjob;
+}

ret = 0;

--
2.1.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


signature.asc
Description: PGP signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH v2] qemu: Limit rtc-reset-reinjection requirement to x86 only.

2015-05-26 Thread Andrea Bolognani
The QMP command, like the interrupt reinjection logic it's connected
to, is only implemented in QEMU when TARGET_I386 is defined, so
checking for its availability on any other architecture is pointless.

On the other hand, when we're on x86, we shouldn still make sure that
rtc-reset-reinjection is available and refuse to set the time
otherwise.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1211938
---
 src/qemu/qemu_driver.c | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index aa0acde..db72bad 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -18945,7 +18945,12 @@ qemuDomainSetTime(virDomainPtr dom,
 goto endjob;
 }
 
-if (!virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) {
+/* On x86, the rtc-reset-reinjection QMP command must be called after
+ * setting the time to avoid trouble down the line. If the command is
+ * not available, don't set the time at all and report an error */
+if (ARCH_IS_X86(vm-def-os.arch) 
+!virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION))
+{
 virReportError(VIR_ERR_OPERATION_UNSUPPORTED, %s,
_(cannot set time: qemu doesn't support 
  rtc-reset-reinjection command));
@@ -18968,13 +18973,16 @@ qemuDomainSetTime(virDomainPtr dom,
 goto endjob;
 }
 
-qemuDomainObjEnterMonitor(driver, vm);
-rv = qemuMonitorRTCResetReinjection(priv-mon);
-if (qemuDomainObjExitMonitor(driver, vm)  0)
-goto endjob;
+/* Don't try to call rtc-reset-reinjection if it's not available */
+if (virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_RTC_RESET_REINJECTION)) {
+qemuDomainObjEnterMonitor(driver, vm);
+rv = qemuMonitorRTCResetReinjection(priv-mon);
+if (qemuDomainObjExitMonitor(driver, vm)  0)
+goto endjob;
 
-if (rv  0)
-goto endjob;
+if (rv  0)
+goto endjob;
+}
 
 ret = 0;
 
-- 
2.1.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list