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

[libvirt] [PATCH] Add actions to virDomainLifecycle enum



I'm not too fond of the schema change but thus far haven't found a way
to condense it.  Suggestions welcomed :-).

Regards,
Jim

>From a27589eb861fd487cb07e537b5da25125599e8a5 Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig novell com>
Date: Thu, 29 Jul 2010 12:21:47 -0600
Subject: [PATCH] Add actions to virDomainLifecycle enum

Xen supports on_crash actions coredump-{destroy,restart}.  libvirt
cannot parse config returned by xend that contains either of these
actions

xen52 # xm li -l test | grep on_crash
    (on_crash coredump-restart)
xen52 # virsh dumpxml test
error: internal error unknown lifecycle type coredump-restart

This patch includes these additional actions in virDomainLifecycle
enum.  Docs have also been updated, although the schema changes
might be further collapsed.
---
 docs/formatdomain.html.in |   14 ++++++++++++++
 docs/schemas/domain.rng   |   24 +++++++++++++++++++++++-
 src/conf/domain_conf.c    |    4 +++-
 src/conf/domain_conf.h    |    2 ++
 4 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 5269cc5..0d532e2 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -366,6 +366,20 @@
         a new name</dd>
     </dl>
 
+    <p>
+      on_crash supports these additional actions.
+    </p>
+
+    <dl>
+      <dt><code>coredump-destroy</code></dt>
+      <dd>The crashed domain's core will be dumped, and then the
+        domain will be terminated completely and all resources
+        released</dd>
+      <dt><code>coredump-restart</code></dt>
+      <dd>The crashed domain's core will be dumped, and then the
+        domain will be restarted with the same configuration</dd>
+    </dl>
+
     <h3><a name="elementsFeatures">Hypervisor features</a></h3>
 
     <p>
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index b2783b0..d384652 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -1177,7 +1177,7 @@
       </optional>
       <optional>
         <element name="on_crash">
-          <ref name="offOptions"/>
+          <ref name="crashOptions"/>
         </element>
       </optional>
     </interleave>
@@ -1199,6 +1199,28 @@
     </choice>
   </define>
   <!--
+      Options when a domain crashes:
+      destroy: The domain is cleaned up
+      restart: A new domain is started in place of the old one
+      preserve: The domain will remain in memory until it is destroyed manually
+      rename-restart: a variant of the previous one but where the old domain is
+                      renamed before being saved to allow a restart
+      coredump-destroy: The crashed domain's core will be dumped, and then the
+                        domain will be terminated completely and all resources
+                        released
+      coredump-restart: The crashed domain's core will be dumped, and then the                               domain will be restarted with the same configuration
+    -->
+  <define name="crashOptions">
+    <choice>
+      <value>destroy</value>
+      <value>restart</value>
+      <value>preserve</value>
+      <value>rename-restart</value>
+      <value>coredump-destroy</value>
+      <value>coredump-restart</value>
+    </choice>
+  </define>
+  <!--
       Specific setup for a qemu emulated character device.  Note: this
       definition doesn't fully specify the constraints on this node.
     -->
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 82e5ce7..5fdb022 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -81,7 +81,9 @@ VIR_ENUM_IMPL(virDomainLifecycle, VIR_DOMAIN_LIFECYCLE_LAST,
               "destroy",
               "restart",
               "rename-restart",
-              "preserve")
+              "preserve",
+              "coredump-destroy",
+              "coredump-restart")
 
 VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
               "disk",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e32188f..2e4e1bb 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -658,6 +658,8 @@ enum virDomainLifecycleAction {
     VIR_DOMAIN_LIFECYCLE_RESTART,
     VIR_DOMAIN_LIFECYCLE_RESTART_RENAME,
     VIR_DOMAIN_LIFECYCLE_PRESERVE,
+    VIR_DOMAIN_LIFECYCLE_COREDUMP_DESTROY,
+    VIR_DOMAIN_LIFECYCLE_COREDUMP_RESTART,
 
     VIR_DOMAIN_LIFECYCLE_LAST
 };
-- 
1.6.0.2


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