[libvirt] [PATCH v2 1/4] api: Add public api for 'reset'

Add new public api for 'reset'. It can reset domain immediately without any guest shutdown. Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com> --- include/libvirt/libvirt.h.in | 3 ++ src/driver.h | 4 +++ src/libvirt.c | 50 ++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + 4 files changed, 58 insertions(+), 0 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index afeb83f..a3c581d 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1031,6 +1031,9 @@ virDomainPtr virDomainLookupByUUIDString (virConnectPtr conn, int virDomainShutdown (virDomainPtr domain); int virDomainReboot (virDomainPtr domain, unsigned int flags); +int virDomainReset (virDomainPtr domain, + unsigned int flags); + int virDomainDestroy (virDomainPtr domain); int virDomainDestroyFlags (virDomainPtr domain, unsigned int flags); diff --git a/src/driver.h b/src/driver.h index 7dcab8f..f85a1b1 100644 --- a/src/driver.h +++ b/src/driver.h @@ -124,6 +124,9 @@ typedef int (*virDrvDomainReboot) (virDomainPtr domain, unsigned int flags); typedef int + (*virDrvDomainReset) (virDomainPtr domain, + unsigned int flags); +typedef int (*virDrvDomainDestroy) (virDomainPtr domain); typedef int (*virDrvDomainDestroyFlags) (virDomainPtr domain, @@ -759,6 +762,7 @@ struct _virDriver { virDrvDomainResume domainResume; virDrvDomainShutdown domainShutdown; virDrvDomainReboot domainReboot; + virDrvDomainReset domainReset; virDrvDomainDestroy domainDestroy; virDrvDomainDestroyFlags domainDestroyFlags; virDrvDomainGetOSType domainGetOSType; diff --git a/src/libvirt.c b/src/libvirt.c index 38fcfbc..7fcbda4 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -3017,6 +3017,56 @@ error: } /** + * virDomainReset: + * @domain: a domain object + * @flags: extra flags for the reboot operation, not used yet + * + * Reset a domain immediately without any guest OS shutdown. + * Reset emulates the power reset of a button on a machine, i.e. + * All hardware see the RST line set and reinitialize their internal state. + * + * Note that the risk of data loss caused by reset without any + * guest OS shutdown. + * + * Returns 0 in case of success and -1 in case of failure. + */ +int +virDomainReset(virDomainPtr domain, unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "flags=%x", flags); + + virResetLastError(); + + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { + virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); + virDispatchError(NULL); + return -1; + } + if (domain->conn->flags & VIR_CONNECT_RO) { + virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__); + goto error; + } + + conn = domain->conn; + + if (conn->driver->domainReset) { + int ret; + ret = conn->driver->domainReset (domain, flags); + if (ret < 0) + goto error; + return ret; + } + + virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); + +error: + virDispatchError(domain->conn); + return -1; +} + +/** * virDomainGetName: * @domain: a domain object * diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index cef14f0..9e6f104 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -492,6 +492,7 @@ LIBVIRT_0.9.5 { LIBVIRT_0.9.7 { global: virDomainSnapshotGetParent; + virDomainReset; } LIBVIRT_0.9.5; # .... define new API here using predicted next version number .... -- 1.7.4.1

Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com> --- src/qemu/qemu_driver.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ffa8b4c..3f89c62 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1596,6 +1596,53 @@ cleanup: } +static int qemuDomainReset(virDomainPtr dom, unsigned int flags) { + struct qemud_driver *driver = dom->conn->privateData; + virDomainObjPtr vm; + int ret = -1; + qemuDomainObjPrivatePtr priv; + + virCheckFlags(0, -1); + + qemuDriverLock(driver); + vm = virDomainFindByUUID(&driver->domains, dom->uuid); + qemuDriverUnlock(driver); + + if (!vm) { + char uuidstr[VIR_UUID_STRING_BUFLEN]; + virUUIDFormat(dom->uuid, uuidstr); + qemuReportError(VIR_ERR_NO_DOMAIN, + _("no domain with matching uuid '%s'"), uuidstr); + goto cleanup; + } + + if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0) + goto cleanup; + + if (!virDomainObjIsActive(vm)) { + qemuReportError(VIR_ERR_OPERATION_INVALID, + "%s", _("domain is not running")); + goto endjob; + } + + priv = vm->privateData; + qemuDomainObjEnterMonitor(driver, vm); + ret = qemuMonitorSystemReset(priv->mon); + qemuDomainObjExitMonitor(driver, vm); + + priv->fakeReboot = false; + +endjob: + if (qemuDomainObjEndJob(driver, vm) == 0) + vm = NULL; + +cleanup: + if (vm) + virDomainObjUnlock(vm); + return ret; +} + + /* Count how many snapshots in a set have external disk snapshots. */ static void qemuDomainSnapshotCountExternal(void *payload, @@ -10386,6 +10433,7 @@ static virDriver qemuDriver = { .domainResume = qemudDomainResume, /* 0.2.0 */ .domainShutdown = qemuDomainShutdown, /* 0.2.0 */ .domainReboot = qemuDomainReboot, /* 0.9.3 */ + .domainReset = qemuDomainReset, /* 0.9.7 */ .domainDestroy = qemuDomainDestroy, /* 0.2.0 */ .domainDestroyFlags = qemuDomainDestroyFlags, /* 0.9.4 */ .domainGetOSType = qemudDomainGetOSType, /* 0.2.2 */ -- 1.7.4.1

On 09/29/2011 02:54 AM, Xu He Jie wrote:
Signed-off-by: Xu He Jie<xuhj@linux.vnet.ibm.com> --- src/qemu/qemu_driver.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ffa8b4c..3f89c62 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1596,6 +1596,53 @@ cleanup: }
+static int qemuDomainReset(virDomainPtr dom, unsigned int flags) {
Formatting - while we aren't completely consistent, most new functions use: return type name(args) { rather than cramming it into one line. I'll squash this in when pushing: diff --git i/src/qemu/qemu_driver.c w/src/qemu/qemu_driver.c index 3f89c62..0f18983 100644 --- i/src/qemu/qemu_driver.c +++ w/src/qemu/qemu_driver.c @@ -1596,7 +1596,9 @@ cleanup: } -static int qemuDomainReset(virDomainPtr dom, unsigned int flags) { +static int +qemuDomainReset(virDomainPtr dom, unsigned int flags) +{ struct qemud_driver *driver = dom->conn->privateData; virDomainObjPtr vm; int ret = -1; -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com> --- src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 740dd75..83f4f3c 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -4313,6 +4313,7 @@ static virDriver remote_driver = { .domainResume = remoteDomainResume, /* 0.3.0 */ .domainShutdown = remoteDomainShutdown, /* 0.3.0 */ .domainReboot = remoteDomainReboot, /* 0.3.0 */ + .domainReset = remoteDomainReset, /* 0.9.7 */ .domainDestroy = remoteDomainDestroy, /* 0.3.0 */ .domainDestroyFlags = remoteDomainDestroyFlags, /* 0.9.4 */ .domainGetOSType = remoteDomainGetOSType, /* 0.3.0 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 3504e34..c8a92fd 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -688,6 +688,11 @@ struct remote_domain_reboot_args { unsigned int flags; }; +struct remote_domain_reset_args { + remote_nonnull_domain dom; + unsigned int flags; +}; + struct remote_domain_destroy_args { remote_nonnull_domain dom; }; @@ -2519,7 +2524,8 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB = 241, /* skipgen skipgen */ REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_SPEED = 242, /* autogen autogen */ REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS = 243, /* skipgen skipgen */ - REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT = 244 /* autogen autogen */ + REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT = 244, /* autogen autogen */ + REMOTE_PROC_DOMAIN_RESET = 245 /* autogen autogen */ /* * Notice how the entries are grouped in sets of 10 ? -- 1.7.4.1

On 09/29/2011 02:56 AM, Xu He Jie wrote:
Signed-off-by: Xu He Jie<xuhj@linux.vnet.ibm.com> --- src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletions(-)
Missing a change to src/remote_protocol-structs, which 'make check' validates if you have pdwtags (from the 'dwarves' package) installed. I'm squashing this in: diff --git i/src/remote_protocol-structs w/src/remote_protocol-structs index 53705bf..69175cc 100644 --- i/src/remote_protocol-structs +++ w/src/remote_protocol-structs @@ -400,6 +400,10 @@ struct remote_domain_reboot_args { remote_nonnull_domain dom; u_int flags; }; +struct remote_domain_reset_args { + remote_nonnull_domain dom; + u_int flags; +}; struct remote_domain_destroy_args { remote_nonnull_domain dom; }; @@ -1966,4 +1970,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_SPEED = 242, REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS = 243, REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT = 244, + REMOTE_PROC_DOMAIN_RESET = 245, }; -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com> --- tools/virsh.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tools/virsh.pod | 8 ++++++++ 2 files changed, 54 insertions(+), 0 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 807324b..a7d0559 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3192,6 +3192,51 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd) } /* + * "reset" command + */ +static const vshCmdInfo info_reset[] = { + {"help", N_("reset a domain immediately without any guest OS shutdown")}, + {"desc", + N_("Reset the target domain immediately without any guest OS shutdown. " + "That emulates the power reset of a button on a machine, i.e. " + "All hardware see the RST line set and reinitialize their " + "internal state.\n" + "\n" + " Note that the risk of data loss caused by reset without " + "guest os shutdown.")}, + {NULL, NULL} +}; + +static const vshCmdOptDef opts_reset[] = { + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")}, + {NULL, 0, 0, NULL} +}; + +static bool +cmdReset(vshControl *ctl, const vshCmd *cmd) +{ + virDomainPtr dom; + bool ret = true; + const char *name; + + if (!vshConnectionUsability(ctl, ctl->conn)) + return false; + + if (!(dom = vshCommandOptDomain(ctl, cmd, &name))) + return false; + + if (virDomainReset(dom, 0) == 0) { + vshPrint(ctl, _("Domain %s is being reseted\n"), name); + } else { + vshError(ctl, _("Failed to reset domain %s"), name); + ret = false; + } + + virDomainFree(dom); + return ret; +} + +/* * "destroy" command */ static const vshCmdInfo info_destroy[] = { @@ -13665,6 +13710,7 @@ static const vshCmdDef domManagementCmds[] = { {"migrate-getspeed", cmdMigrateGetMaxSpeed, opts_migrate_getspeed, info_migrate_getspeed, 0}, {"reboot", cmdReboot, opts_reboot, info_reboot, 0}, + {"reset", cmdReset, opts_reset, info_reset, 0}, {"restore", cmdRestore, opts_restore, info_restore, 0}, {"resume", cmdResume, opts_resume, info_resume, 0}, {"save", cmdSave, opts_save, info_save, 0}, diff --git a/tools/virsh.pod b/tools/virsh.pod index 614b5a3..2192600 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -790,6 +790,14 @@ domain actually reboots. The exact behavior of a domain when it reboots is set by the I<on_reboot> parameter in the domain's XML definition. +=item B<reset> I<domain-id> + +Reset a domain immediately without any guest shutdown. B<reset> +emulates the power reset of a button on a machine, i.e. +All hardware see the RST line set and reinitialize their internal state. + +B<Note>: Reset without any guest OS shutdown cause the risk of data loss. + =item B<restore> I<state-file> [I<--bypass-cache>] [I<--xml> B<file>] [{I<--running> | I<--paused>}] -- 1.7.4.1

On 09/29/2011 02:57 AM, Xu He Jie wrote:
Signed-off-by: Xu He Jie<xuhj@linux.vnet.ibm.com> --- tools/virsh.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tools/virsh.pod | 8 ++++++++ 2 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c index 807324b..a7d0559 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -3192,6 +3192,51 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd) }
/* + * "reset" command + */ +static const vshCmdInfo info_reset[] = { + {"help", N_("reset a domain immediately without any guest OS shutdown")}, + {"desc", + N_("Reset the target domain immediately without any guest OS shutdown. " + "That emulates the power reset of a button on a machine, i.e. " + "All hardware see the RST line set and reinitialize their " + "internal state.\n" + "\n" + " Note that the risk of data loss caused by reset without " + "guest os shutdown.")},
That's a bit verbose, compared to most other help commands.
+static bool +cmdReset(vshControl *ctl, const vshCmd *cmd) +{ + virDomainPtr dom; + bool ret = true; + const char *name; + + if (!vshConnectionUsability(ctl, ctl->conn)) + return false; + + if (!(dom = vshCommandOptDomain(ctl, cmd,&name))) + return false; + + if (virDomainReset(dom, 0) == 0) { + vshPrint(ctl, _("Domain %s is being reseted\n"), name);
Grammar.
+=item B<reset> I<domain-id> + +Reset a domain immediately without any guest shutdown. B<reset> +emulates the power reset of a button on a machine, i.e. +All hardware see the RST line set and reinitialize their internal state. + +B<Note>: Reset without any guest OS shutdown cause the risk of data loss.
I applied the same wording changes here as in libvirt.c, then pushed the series. diff --git i/tools/virsh.c w/tools/virsh.c index a7d0559..1909dce 100644 --- i/tools/virsh.c +++ w/tools/virsh.c @@ -3195,15 +3195,8 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd) * "reset" command */ static const vshCmdInfo info_reset[] = { - {"help", N_("reset a domain immediately without any guest OS shutdown")}, - {"desc", - N_("Reset the target domain immediately without any guest OS shutdown. " - "That emulates the power reset of a button on a machine, i.e. " - "All hardware see the RST line set and reinitialize their " - "internal state.\n" - "\n" - " Note that the risk of data loss caused by reset without " - "guest os shutdown.")}, + {"help", N_("reset a domain")}, + {"desc", N_("Reset the target domain as if by power button")}, {NULL, NULL} }; @@ -3226,7 +3219,7 @@ cmdReset(vshControl *ctl, const vshCmd *cmd) return false; if (virDomainReset(dom, 0) == 0) { - vshPrint(ctl, _("Domain %s is being reseted\n"), name); + vshPrint(ctl, _("Domain %s was reset\n"), name); } else { vshError(ctl, _("Failed to reset domain %s"), name); ret = false; diff --git i/tools/virsh.pod w/tools/virsh.pod index 2192600..be81afc 100644 --- i/tools/virsh.pod +++ w/tools/virsh.pod @@ -793,10 +793,10 @@ I<on_reboot> parameter in the domain's XML definition. =item B<reset> I<domain-id> Reset a domain immediately without any guest shutdown. B<reset> -emulates the power reset of a button on a machine, i.e. -All hardware see the RST line set and reinitialize their internal state. +emulates the power reset button on a machine, where all guest +hardware sees the RST line set and reinitializes internal state. -B<Note>: Reset without any guest OS shutdown cause the risk of data loss. +B<Note>: Reset without any guest OS shutdown risks data loss. =item B<restore> I<state-file> [I<--bypass-cache>] [I<--xml> B<file>] [{I<--running> | I<--paused>}] -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Thu, Sep 29, 2011 at 04:53:29PM +0800, Xu He Jie wrote:
Add new public api for 'reset'. It can reset domain immediately without any guest shutdown.
Signed-off-by: Xu He Jie <xuhj@linux.vnet.ibm.com> --- include/libvirt/libvirt.h.in | 3 ++ src/driver.h | 4 +++ src/libvirt.c | 50 ++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + 4 files changed, 58 insertions(+), 0 deletions(-)
ACK to all 4 patches, this follows what I suggested previously and the code is good. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On 2011年09月29日 18:44, Daniel P. Berrange wrote:
On Thu, Sep 29, 2011 at 04:53:29PM +0800, Xu He Jie wrote:
Add new public api for 'reset'. It can reset domain immediately without any guest shutdown.
Signed-off-by: Xu He Jie<xuhj@linux.vnet.ibm.com> --- include/libvirt/libvirt.h.in | 3 ++ src/driver.h | 4 +++ src/libvirt.c | 50 ++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 1 + 4 files changed, 58 insertions(+), 0 deletions(-) ACK to all 4 patches, this follows what I suggested previously and the code is good.
Regards, Daniel Thanks!

On 09/29/2011 02:53 AM, Xu He Jie wrote:
Add new public api for 'reset'. It can reset domain immediately without any guest shutdown.
/** + * virDomainReset: + * @domain: a domain object + * @flags: extra flags for the reboot operation, not used yet + * + * Reset a domain immediately without any guest OS shutdown. + * Reset emulates the power reset of a button on a machine, i.e. + * All hardware see the RST line set and reinitialize their internal state. + * + * Note that the risk of data loss caused by reset without any + * guest OS shutdown.
I made some grammar tweaks.
+++ b/src/libvirt_public.syms @@ -492,6 +492,7 @@ LIBVIRT_0.9.5 { LIBVIRT_0.9.7 { global: virDomainSnapshotGetParent; + virDomainReset;
Also, I sorted these. I'll squash this in and push shortly. diff --git i/src/libvirt.c w/src/libvirt.c index 7fcbda4..9080b2f 100644 --- i/src/libvirt.c +++ w/src/libvirt.c @@ -3022,10 +3022,10 @@ error: * @flags: extra flags for the reboot operation, not used yet * * Reset a domain immediately without any guest OS shutdown. - * Reset emulates the power reset of a button on a machine, i.e. - * All hardware see the RST line set and reinitialize their internal state. + * Reset emulates the power reset button on a machine, where all + * hardware sees the RST line set and reinitializes internal state. * - * Note that the risk of data loss caused by reset without any + * Note that there is a risk of data loss caused by reset without any * guest OS shutdown. * * Returns 0 in case of success and -1 in case of failure. diff --git i/src/libvirt_public.syms w/src/libvirt_public.syms index 9e6f104..afea29b 100644 --- i/src/libvirt_public.syms +++ w/src/libvirt_public.syms @@ -491,8 +491,8 @@ LIBVIRT_0.9.5 { LIBVIRT_0.9.7 { global: - virDomainSnapshotGetParent; virDomainReset; + virDomainSnapshotGetParent; } LIBVIRT_0.9.5; # .... define new API here using predicted next version number .... -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On Thu, Sep 29, 2011 at 06:52:33AM -0600, Eric Blake wrote:
On 09/29/2011 02:53 AM, Xu He Jie wrote:
Add new public api for 'reset'. It can reset domain immediately without any guest shutdown.
/** + * virDomainReset: + * @domain: a domain object + * @flags: extra flags for the reboot operation, not used yet + * + * Reset a domain immediately without any guest OS shutdown. + * Reset emulates the power reset of a button on a machine, i.e. + * All hardware see the RST line set and reinitialize their internal state. + * + * Note that the risk of data loss caused by reset without any + * guest OS shutdown.
I made some grammar tweaks.
+++ b/src/libvirt_public.syms @@ -492,6 +492,7 @@ LIBVIRT_0.9.5 { LIBVIRT_0.9.7 { global: virDomainSnapshotGetParent; + virDomainReset;
Also, I sorted these. I'll squash this in and push shortly.
diff --git i/src/libvirt.c w/src/libvirt.c index 7fcbda4..9080b2f 100644 --- i/src/libvirt.c +++ w/src/libvirt.c @@ -3022,10 +3022,10 @@ error: * @flags: extra flags for the reboot operation, not used yet * * Reset a domain immediately without any guest OS shutdown. - * Reset emulates the power reset of a button on a machine, i.e. - * All hardware see the RST line set and reinitialize their internal state. + * Reset emulates the power reset button on a machine, where all + * hardware sees the RST line set and reinitializes internal state. * - * Note that the risk of data loss caused by reset without any + * Note that there is a risk of data loss caused by reset without any * guest OS shutdown. * * Returns 0 in case of success and -1 in case of failure. diff --git i/src/libvirt_public.syms w/src/libvirt_public.syms index 9e6f104..afea29b 100644 --- i/src/libvirt_public.syms +++ w/src/libvirt_public.syms @@ -491,8 +491,8 @@ LIBVIRT_0.9.5 {
LIBVIRT_0.9.7 { global: - virDomainSnapshotGetParent; virDomainReset; + virDomainSnapshotGetParent; } LIBVIRT_0.9.5;
# .... define new API here using predicted next version number ....
Ah, I was aobout to commit those too, please add the following to 3/4 too then add remote_protocol-structs diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 53705bf..2c893a0 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -400,6 +400,9 @@ struct remote_domain_reboot_args { remote_nonnull_domain dom; u_int flags; }; +struct remote_domain_reset_args { + remote_nonnull_domain dom; +}; struct remote_domain_destroy_args { remote_nonnull_domain dom; }; @@ -1966,4 +1969,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_SPEED = 242, REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS = 243, REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT = 244, + REMOTE_PROC_DOMAIN_RESET = 245, }; -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Thanks a lot! On 2011年09月29日 20:52, Eric Blake wrote:
On 09/29/2011 02:53 AM, Xu He Jie wrote:
Add new public api for 'reset'. It can reset domain immediately without any guest shutdown.
/** + * virDomainReset: + * @domain: a domain object + * @flags: extra flags for the reboot operation, not used yet + * + * Reset a domain immediately without any guest OS shutdown. + * Reset emulates the power reset of a button on a machine, i.e. + * All hardware see the RST line set and reinitialize their internal state. + * + * Note that the risk of data loss caused by reset without any + * guest OS shutdown.
I made some grammar tweaks.
+++ b/src/libvirt_public.syms @@ -492,6 +492,7 @@ LIBVIRT_0.9.5 { LIBVIRT_0.9.7 { global: virDomainSnapshotGetParent; + virDomainReset;
Also, I sorted these. I'll squash this in and push shortly.
diff --git i/src/libvirt.c w/src/libvirt.c index 7fcbda4..9080b2f 100644 --- i/src/libvirt.c +++ w/src/libvirt.c @@ -3022,10 +3022,10 @@ error: * @flags: extra flags for the reboot operation, not used yet * * Reset a domain immediately without any guest OS shutdown. - * Reset emulates the power reset of a button on a machine, i.e. - * All hardware see the RST line set and reinitialize their internal state. + * Reset emulates the power reset button on a machine, where all + * hardware sees the RST line set and reinitializes internal state. * - * Note that the risk of data loss caused by reset without any + * Note that there is a risk of data loss caused by reset without any * guest OS shutdown. * * Returns 0 in case of success and -1 in case of failure. diff --git i/src/libvirt_public.syms w/src/libvirt_public.syms index 9e6f104..afea29b 100644 --- i/src/libvirt_public.syms +++ w/src/libvirt_public.syms @@ -491,8 +491,8 @@ LIBVIRT_0.9.5 {
LIBVIRT_0.9.7 { global: - virDomainSnapshotGetParent; virDomainReset; + virDomainSnapshotGetParent; } LIBVIRT_0.9.5;
# .... define new API here using predicted next version number ....
participants (4)
-
Daniel P. Berrange
-
Daniel Veillard
-
Eric Blake
-
Xu He Jie