[PATCH V4 4/5] libxl: implement .domainSendSysrq method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Support .domainSendSysrq in libxl driver.

Signed-off-by: Chunyan Liu <cyliu@xxxxxxxx>
---
 src/libxl/libxl_driver.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 4135670..5ae565e 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4745,6 +4745,30 @@ libxlDomainMigrateConfirm3Params(virDomainPtr domain,
     return libxlDomainMigrationConfirm(driver, vm, flags, cancelled);
 }
 
+static int
+libxlDomainSendSysrq(virDomainPtr dom, char key, unsigned int flags)
+{
+    virDomainObjPtr vm;
+    libxlDomainObjPrivatePtr priv;
+    int ret = -1;
+
+    virCheckFlags(0, -1);
+
+    if (!(vm = libxlDomObjFromDomain(dom)))
+        goto cleanup;
+
+    priv = vm->privateData;
+
+    if (virDomainSendSysrqEnsureACL(dom->conn, vm->def) < 0)
+        goto cleanup;
+
+    ret = libxl_send_sysrq(priv->ctx, vm->def->id, key);
+
+ cleanup:
+    if (vm)
+        virObjectUnlock(vm);
+    return ret;
+}
 
 static virHypervisorDriver libxlDriver = {
     .no = VIR_DRV_LIBXL,
@@ -4840,6 +4864,7 @@ static virHypervisorDriver libxlDriver = {
     .domainMigratePerform3Params = libxlDomainMigratePerform3Params, /* 1.2.6 */
     .domainMigrateFinish3Params = libxlDomainMigrateFinish3Params, /* 1.2.6 */
     .domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.6 */
+    .domainSendSysrq = libxlDomainSendSysrq, /* 1.2.12 */
 };
 
 static virStateDriver libxlStateDriver = {
-- 
1.8.4.5

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]