[libvirt] RFC: add new API to known if domain has been updated

Hi, all Suppose that one updated a domain, and want to restart the domain with original configuration. However, currently, unless shutdown the domain first, and then restart or reload libvirtd, otherwise domain will still be started with changed configuration. e.g. # virsh list --all Id Name State ---------------------------------- 1 f14 running # virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd1.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> # virsh update-device f14 cd2.xml # virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd2.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> # virsh destroy f14 # virsh start f14 # virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd2.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> it's caused by libvirtd doesn't known if a domain is updated or not, it updated the domain configuration in memory, but client could not known about it. As a result, one wants to start the domain with original configuration, he has to shutdown the domain first, and then restart libvirt. It will be better if client could known if the domain is updated or not, and could choose to start the domain with original configuration or the updated one. So, considered introducing a new member, the idea is adding "unsigned int updated :1;" for "virDomainObj", adn the functions which will update domain configuration should set it to "1" so that libvirtd could known the domain is updated. e.g. static int qemudDomainChangeEjectableMedia (....) { ................. /* if Media is changed or ejected successfully */ if (!vm->updated) vm->updated = 1; .................. } And the client such as virsh could provide optional parameter for user to choose if start the guest with original configuration or not. e.g. # virsh start f14 --original it tells "virsh" to start the domain with the persistent domain configuration "/etc/libvirt/qemu/$domain.xml" but not the updated one maitained by libvirtd. PS: if this API is introduced finnally, we can also add "updated" information in "dominfo". What do you think about it? patches are coming following this thread. awaiting feedback.. :-) - Osier

introduce new public API "virDomainIsUpdated" * src/conf/domain_conf.h (new member "updated" for "virDomainObj") * src/libvirt_public.syms * include/libvirt/libvirt.h.in --- include/libvirt/libvirt.h.in | 1 + src/conf/domain_conf.h | 1 + src/libvirt_public.syms | 1 + 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 98c5281..716f7af 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1931,6 +1931,7 @@ int virStreamFree(virStreamPtr st); int virDomainIsActive(virDomainPtr dom); int virDomainIsPersistent(virDomainPtr dom); +int virDomainIsUpdated(virDomainPtr dom); int virNetworkIsActive(virNetworkPtr net); int virNetworkIsPersistent(virNetworkPtr net); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7d2d6f5..0fd3492 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1010,6 +1010,7 @@ struct _virDomainObj { unsigned int autostart : 1; unsigned int persistent : 1; + unsigned int updated : 1; virDomainDefPtr def; /* The current definition */ virDomainDefPtr newDef; /* New definition to activate at shutdown */ diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 4ef4c5a..96084ff 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -416,6 +416,7 @@ LIBVIRT_0.8.5 { LIBVIRT_0.8.6 { global: virDomainOpenConsole; + virDomainIsUpdated; } LIBVIRT_0.8.5; # .... define new API here using predicted next version number .... -- 1.7.3.2

On Mon, Nov 15, 2010 at 11:23:32AM +0800, Osier Yang wrote:
introduce new public API "virDomainIsUpdated"
* src/conf/domain_conf.h (new member "updated" for "virDomainObj") * src/libvirt_public.syms * include/libvirt/libvirt.h.in --- include/libvirt/libvirt.h.in | 1 + src/conf/domain_conf.h | 1 + src/libvirt_public.syms | 1 + 3 files changed, 3 insertions(+), 0 deletions(-)
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Mon, Nov 15, 2010 at 11:23:32AM +0800, Osier Yang wrote:
introduce new public API "virDomainIsUpdated"
* src/conf/domain_conf.h (new member "updated" for "virDomainObj") * src/libvirt_public.syms * include/libvirt/libvirt.h.in --- include/libvirt/libvirt.h.in | 1 + src/conf/domain_conf.h | 1 + src/libvirt_public.syms | 1 + 3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 98c5281..716f7af 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1931,6 +1931,7 @@ int virStreamFree(virStreamPtr st);
int virDomainIsActive(virDomainPtr dom); int virDomainIsPersistent(virDomainPtr dom); +int virDomainIsUpdated(virDomainPtr dom);
Oh, you seem to be missing the actualy impl of virDoaminIsUpdated from src/libvirt.c Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

于 2010年11月18日 17:47, Daniel P. Berrange 写道:
On Mon, Nov 15, 2010 at 11:23:32AM +0800, Osier Yang wrote:
introduce new public API "virDomainIsUpdated"
* src/conf/domain_conf.h (new member "updated" for "virDomainObj") * src/libvirt_public.syms * include/libvirt/libvirt.h.in --- include/libvirt/libvirt.h.in | 1 + src/conf/domain_conf.h | 1 + src/libvirt_public.syms | 1 + 3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 98c5281..716f7af 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1931,6 +1931,7 @@ int virStreamFree(virStreamPtr st);
int virDomainIsActive(virDomainPtr dom); int virDomainIsPersistent(virDomainPtr dom); +int virDomainIsUpdated(virDomainPtr dom);
Oh, you seem to be missing the actualy impl of virDoaminIsUpdated from src/libvirt.c
urgh, really, will come following this mail thread, thanks. - Osier
Daniel

* src/driver.h (new typedef, new callback member for "_virDriver") * src/esx/esx_driver.c * src/lxc/lxc_driver.c * src/opennebula/one_driver.c * src/openvz/openvz_driver.c * src/phyp/phyp_driver.c * src/qemu/qemu_driver.c * src/remote/remote_driver.c * src/test/test_driver.c * src/uml/uml_driver.c * src/vbox/vbox_tmpl.c * src/xen/xen_driver.c * src/xenapi/xenapi_driver.c --- src/driver.h | 3 +++ src/esx/esx_driver.c | 1 + src/lxc/lxc_driver.c | 1 + src/opennebula/one_driver.c | 1 + src/openvz/openvz_driver.c | 1 + src/phyp/phyp_driver.c | 1 + src/qemu/qemu_driver.c | 1 + src/remote/remote_driver.c | 1 + src/test/test_driver.c | 1 + src/uml/uml_driver.c | 1 + src/vbox/vbox_tmpl.c | 1 + src/xen/xen_driver.c | 1 + src/xenapi/xenapi_driver.c | 1 + 13 files changed, 15 insertions(+), 0 deletions(-) diff --git a/src/driver.h b/src/driver.h index 6417ee9..b770e5e 100644 --- a/src/driver.h +++ b/src/driver.h @@ -395,6 +395,8 @@ typedef int (*virDrvDomainIsActive)(virDomainPtr dom); typedef int (*virDrvDomainIsPersistent)(virDomainPtr dom); +typedef int + (*virDrvDomainIsUpdated)(virDomainPtr dom); typedef int (*virDrvCPUCompare)(virConnectPtr conn, @@ -581,6 +583,7 @@ struct _virDriver { virDrvConnectIsSecure isSecure; virDrvDomainIsActive domainIsActive; virDrvDomainIsPersistent domainIsPersistent; + virDrvDomainIsUpdated domainIsUpdated; virDrvCPUCompare cpuCompare; virDrvCPUBaseline cpuBaseline; virDrvDomainGetJobInfo domainGetJobInfo; diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 0ace38e..5c04596 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -4360,6 +4360,7 @@ static virDriver esxDriver = { esxIsSecure, /* isSecure */ esxDomainIsActive, /* domainIsActive */ esxDomainIsPersistent, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index f5014cb..8946224 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -2879,6 +2879,7 @@ static virDriver lxcDriver = { lxcIsSecure, /* isSecure */ lxcDomainIsActive, /* domainIsActive */ lxcDomainIsPersistent, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c index 43a2847..4fe7f9b 100644 --- a/src/opennebula/one_driver.c +++ b/src/opennebula/one_driver.c @@ -800,6 +800,7 @@ static virDriver oneDriver = { oneIsSecure, /* isSecure */ NULL, /* domainIsActive */ NULL, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index d5bd0ab..67d58cd 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -1669,6 +1669,7 @@ static virDriver openvzDriver = { openvzIsSecure, openvzDomainIsActive, openvzDomainIsPersistent, + NULL, /* domainIsUpdated */ NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 4c723a2..24b426e 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -4021,6 +4021,7 @@ static virDriver phypDriver = { phypIsSecure, /* isSecure */ NULL, /* domainIsActive */ NULL, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1903a8d..5516090 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13209,6 +13209,7 @@ static virDriver qemuDriver = { qemuIsSecure, /* isSecure */ qemuDomainIsActive, /* domainIsActive */ qemuDomainIsPersistent, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ qemuCPUCompare, /* cpuCompare */ qemuCPUBaseline, /* cpuBaseline */ qemuDomainGetJobInfo, /* domainGetJobInfo */ diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index f45476a..0965da8 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -10713,6 +10713,7 @@ static virDriver remote_driver = { remoteIsSecure, /* isSecure */ remoteDomainIsActive, /* domainIsActive */ remoteDomainIsPersistent, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ remoteCPUCompare, /* cpuCompare */ remoteCPUBaseline, /* cpuBaseline */ remoteDomainGetJobInfo, /* domainGetJobInfo */ diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 5693d7a..6aa28e7 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5421,6 +5421,7 @@ static virDriver testDriver = { testIsSecure, /* isEncrypted */ testDomainIsActive, /* domainIsActive */ testDomainIsPersistent, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 3588894..04a49a7 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -2243,6 +2243,7 @@ static virDriver umlDriver = { umlIsSecure, /* isSecure */ umlDomainIsActive, /* domainIsActive */ umlDomainIsPersistent, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 78f945c..46e9121 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -8437,6 +8437,7 @@ virDriver NAME(Driver) = { vboxIsSecure, /* isSecure */ vboxDomainIsActive, /* domainIsActive */ vboxDomainIsPersistent, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 168b619..417a50d 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -2069,6 +2069,7 @@ static virDriver xenUnifiedDriver = { xenUnifiedIsSecure, /* isSecure */ xenUnifiedDomainIsActive, /* domainIsActive */ xenUnifiedDomainisPersistent, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c index 03b0a6a..dec2d25 100644 --- a/src/xenapi/xenapi_driver.c +++ b/src/xenapi/xenapi_driver.c @@ -1847,6 +1847,7 @@ static virDriver xenapiDriver = { NULL, /* isSecure */ NULL, /* domainIsActive */ NULL, /* domainIsPersistent */ + NULL, /* domainIsUpdated */ NULL, /* cpuCompare */ NULL, /* cpuBaseline */ NULL, /* domainGetJobInfo */ -- 1.7.3.2

On Mon, Nov 15, 2010 at 11:23:33AM +0800, Osier Yang wrote:
* src/driver.h (new typedef, new callback member for "_virDriver") * src/esx/esx_driver.c * src/lxc/lxc_driver.c * src/opennebula/one_driver.c * src/openvz/openvz_driver.c * src/phyp/phyp_driver.c * src/qemu/qemu_driver.c * src/remote/remote_driver.c * src/test/test_driver.c * src/uml/uml_driver.c * src/vbox/vbox_tmpl.c * src/xen/xen_driver.c * src/xenapi/xenapi_driver.c --- src/driver.h | 3 +++ src/esx/esx_driver.c | 1 + src/lxc/lxc_driver.c | 1 + src/opennebula/one_driver.c | 1 + src/openvz/openvz_driver.c | 1 + src/phyp/phyp_driver.c | 1 + src/qemu/qemu_driver.c | 1 + src/remote/remote_driver.c | 1 + src/test/test_driver.c | 1 + src/uml/uml_driver.c | 1 + src/vbox/vbox_tmpl.c | 1 + src/xen/xen_driver.c | 1 + src/xenapi/xenapi_driver.c | 1 + 13 files changed, 15 insertions(+), 0 deletions(-)
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

* daemon/remote.c * daemon/remote_dispatch_args.h * daemon/remote_dispatch_prototypes.h * daemon/remote_dispatch_ret.h * daemon/remote_dispatch_table.h * src/remote/remote_driver.c * src/remote/remote_protocol.c * src/remote/remote_protocol.h * src/remote/remote_protocol.x * src/remote_protocol-structs --- daemon/remote.c | 28 ++++++++++++++++++++++++++++ daemon/remote_dispatch_args.h | 1 + daemon/remote_dispatch_prototypes.h | 8 ++++++++ daemon/remote_dispatch_ret.h | 1 + daemon/remote_dispatch_table.h | 5 +++++ src/remote/remote_driver.c | 26 +++++++++++++++++++++++++- src/remote/remote_protocol.c | 18 ++++++++++++++++++ src/remote/remote_protocol.h | 15 +++++++++++++++ src/remote/remote_protocol.x | 10 +++++++++- src/remote_protocol-structs | 6 ++++++ 10 files changed, 116 insertions(+), 2 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 1660815..9dba325 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -5965,6 +5965,34 @@ static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUT return 0; } +static int remoteDispatchDomainIsUpdated(struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, + remote_message_header *hdr ATTRIBUTE_UNUSED, + remote_error *err, + remote_domain_is_updated_args *args, + remote_domain_is_updated_ret *ret) +{ + virDomainPtr domain; + + domain = get_nonnull_domain(conn, args->dom); + if (domain == NULL) { + remoteDispatchConnError(err, conn); + return -1; + } + + ret->updated = virDomainIsUpdated(domain); + + if (ret->updated < 0) { + virDomainFree(domain); + remoteDispatchConnError(err, conn); + return -1; + } + + virDomainFree(domain); + return 0; +} + static int remoteDispatchInterfaceIsActive(struct qemud_server *server ATTRIBUTE_UNUSED, struct qemud_client *client ATTRIBUTE_UNUSED, virConnectPtr conn, diff --git a/daemon/remote_dispatch_args.h b/daemon/remote_dispatch_args.h index 971af80..221af88 100644 --- a/daemon/remote_dispatch_args.h +++ b/daemon/remote_dispatch_args.h @@ -170,3 +170,4 @@ remote_domain_set_vcpus_flags_args val_remote_domain_set_vcpus_flags_args; remote_domain_get_vcpus_flags_args val_remote_domain_get_vcpus_flags_args; remote_domain_open_console_args val_remote_domain_open_console_args; + remote_domain_is_updated_args val_remote_domain_is_updated_args; diff --git a/daemon/remote_dispatch_prototypes.h b/daemon/remote_dispatch_prototypes.h index 15c7ec7..4a5246f 100644 --- a/daemon/remote_dispatch_prototypes.h +++ b/daemon/remote_dispatch_prototypes.h @@ -354,6 +354,14 @@ static int remoteDispatchDomainIsPersistent( remote_error *err, remote_domain_is_persistent_args *args, remote_domain_is_persistent_ret *ret); +static int remoteDispatchDomainIsUpdated( + struct qemud_server *server, + struct qemud_client *client, + virConnectPtr conn, + remote_message_header *hdr, + remote_error *err, + remote_domain_is_updated_args *args, + remote_domain_is_updated_ret *ret); static int remoteDispatchDomainLookupById( struct qemud_server *server, struct qemud_client *client, diff --git a/daemon/remote_dispatch_ret.h b/daemon/remote_dispatch_ret.h index 3723b00..c01f3ba 100644 --- a/daemon/remote_dispatch_ret.h +++ b/daemon/remote_dispatch_ret.h @@ -137,3 +137,4 @@ remote_domain_create_with_flags_ret val_remote_domain_create_with_flags_ret; remote_domain_get_memory_parameters_ret val_remote_domain_get_memory_parameters_ret; remote_domain_get_vcpus_flags_ret val_remote_domain_get_vcpus_flags_ret; + remote_domain_is_updated_ret val_remote_domain_is_updated_ret; diff --git a/daemon/remote_dispatch_table.h b/daemon/remote_dispatch_table.h index 4cfa1b1..3e55424 100644 --- a/daemon/remote_dispatch_table.h +++ b/daemon/remote_dispatch_table.h @@ -1012,3 +1012,8 @@ .args_filter = (xdrproc_t) xdr_remote_domain_open_console_args, .ret_filter = (xdrproc_t) xdr_void, }, +{ /* DomainIsUpdated => 202 */ + .fn = (dispatch_fn) remoteDispatchDomainIsUpdated, + .args_filter = (xdrproc_t) xdr_remote_domain_is_updated_args, + .ret_filter = (xdrproc_t) xdr_remote_domain_is_updated_ret, +}, diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 0965da8..1e74648 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1962,6 +1962,30 @@ done: return rv; } +static int +remoteDomainIsUpdated(virDomainPtr domain) +{ + int rv = -1; + remote_domain_is_updated_args args; + remote_domain_is_updated_ret ret; + struct private_data *priv = domain->conn->privateData; + + remoteDriverLock(priv); + + make_nonnull_domain (&args.dom, domain); + + if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_IS_UPDATED, + (xdrproc_t) xdr_remote_domain_is_updated_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_is_updated_ret, (char *) &ret) == -1) + goto done; + + rv = ret.updated; + +done: + remoteDriverUnlock(priv); + return rv; +} + static virDomainPtr remoteDomainCreateXML (virConnectPtr conn, const char *xmlDesc, @@ -10713,7 +10737,7 @@ static virDriver remote_driver = { remoteIsSecure, /* isSecure */ remoteDomainIsActive, /* domainIsActive */ remoteDomainIsPersistent, /* domainIsPersistent */ - NULL, /* domainIsUpdated */ + remoteDomainIsUpdated, /* domainIsUpdated */ remoteCPUCompare, /* cpuCompare */ remoteCPUBaseline, /* cpuBaseline */ remoteDomainGetJobInfo, /* domainGetJobInfo */ diff --git a/src/remote/remote_protocol.c b/src/remote/remote_protocol.c index 41f5e7d..6e07b70 100644 --- a/src/remote/remote_protocol.c +++ b/src/remote/remote_protocol.c @@ -3177,6 +3177,24 @@ xdr_remote_domain_is_persistent_ret (XDR *xdrs, remote_domain_is_persistent_ret } bool_t +xdr_remote_domain_is_updated_args (XDR *xdrs, remote_domain_is_updated_args *objp) +{ + + if (!xdr_remote_nonnull_domain (xdrs, &objp->dom)) + return FALSE; + return TRUE; +} + +bool_t +xdr_remote_domain_is_updated_ret (XDR *xdrs, remote_domain_is_updated_ret *objp) +{ + + if (!xdr_int (xdrs, &objp->updated)) + return FALSE; + return TRUE; +} + +bool_t xdr_remote_network_is_active_args (XDR *xdrs, remote_network_is_active_args *objp) { diff --git a/src/remote/remote_protocol.h b/src/remote/remote_protocol.h index 8dc89a5..4240963 100644 --- a/src/remote/remote_protocol.h +++ b/src/remote/remote_protocol.h @@ -1801,6 +1801,16 @@ struct remote_domain_is_persistent_ret { }; typedef struct remote_domain_is_persistent_ret remote_domain_is_persistent_ret; +struct remote_domain_is_updated_args { + remote_nonnull_domain dom; +}; +typedef struct remote_domain_is_updated_args remote_domain_is_updated_args; + +struct remote_domain_is_updated_ret { + int updated; +}; +typedef struct remote_domain_is_updated_ret remote_domain_is_updated_ret; + struct remote_network_is_active_args { remote_nonnull_network net; }; @@ -2309,6 +2319,7 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199, REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200, REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201, + REMOTE_PROC_DOMAIN_IS_UPDATED = 202, }; typedef enum remote_procedure remote_procedure; @@ -2630,6 +2641,8 @@ extern bool_t xdr_remote_domain_is_active_args (XDR *, remote_domain_is_active_ extern bool_t xdr_remote_domain_is_active_ret (XDR *, remote_domain_is_active_ret*); extern bool_t xdr_remote_domain_is_persistent_args (XDR *, remote_domain_is_persistent_args*); extern bool_t xdr_remote_domain_is_persistent_ret (XDR *, remote_domain_is_persistent_ret*); +extern bool_t xdr_remote_domain_is_updated_args (XDR *, remote_domain_is_updated_args*); +extern bool_t xdr_remote_domain_is_updated_ret (XDR *, remote_domain_is_updated_ret*); extern bool_t xdr_remote_network_is_active_args (XDR *, remote_network_is_active_args*); extern bool_t xdr_remote_network_is_active_ret (XDR *, remote_network_is_active_ret*); extern bool_t xdr_remote_network_is_persistent_args (XDR *, remote_network_is_persistent_args*); @@ -2974,6 +2987,8 @@ extern bool_t xdr_remote_domain_is_active_args (); extern bool_t xdr_remote_domain_is_active_ret (); extern bool_t xdr_remote_domain_is_persistent_args (); extern bool_t xdr_remote_domain_is_persistent_ret (); +extern bool_t xdr_remote_domain_is_updated_args (); +extern bool_t xdr_remote_domain_is_updated_ret (); extern bool_t xdr_remote_network_is_active_args (); extern bool_t xdr_remote_network_is_active_ret (); extern bool_t xdr_remote_network_is_persistent_args (); diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index e84afe5..e1981fd 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -1600,6 +1600,13 @@ struct remote_domain_is_persistent_ret { int persistent; }; +struct remote_domain_is_updated_args { + remote_nonnull_domain dom; +}; + +struct remote_domain_is_updated_ret { + int updated; +}; struct remote_network_is_active_args { remote_nonnull_network net; @@ -2086,7 +2093,8 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS = 199, REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS = 200, - REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201 + REMOTE_PROC_DOMAIN_OPEN_CONSOLE = 201, + REMOTE_PROC_DOMAIN_IS_UPDATED = 202 /* * Notice how the entries are grouped in sets of 10 ? diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 3054bbf..7ca968f 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1152,6 +1152,12 @@ struct remote_domain_is_persistent_args { struct remote_domain_is_persistent_ret { int persistent; }; +struct remote_domain_is_updated_args { + remote_nonnull_domain dom; +}; +struct remote_domain_is_updated_ret { + int updated; +}; struct remote_network_is_active_args { remote_nonnull_network net; }; -- 1.7.3.2

On Mon, Nov 15, 2010 at 11:23:34AM +0800, Osier Yang wrote:
* daemon/remote.c * daemon/remote_dispatch_args.h * daemon/remote_dispatch_prototypes.h * daemon/remote_dispatch_ret.h * daemon/remote_dispatch_table.h * src/remote/remote_driver.c * src/remote/remote_protocol.c * src/remote/remote_protocol.h * src/remote/remote_protocol.x * src/remote_protocol-structs --- daemon/remote.c | 28 ++++++++++++++++++++++++++++ daemon/remote_dispatch_args.h | 1 + daemon/remote_dispatch_prototypes.h | 8 ++++++++ daemon/remote_dispatch_ret.h | 1 + daemon/remote_dispatch_table.h | 5 +++++ src/remote/remote_driver.c | 26 +++++++++++++++++++++++++- src/remote/remote_protocol.c | 18 ++++++++++++++++++ src/remote/remote_protocol.h | 15 +++++++++++++++ src/remote/remote_protocol.x | 10 +++++++++- src/remote_protocol-structs | 6 ++++++ 10 files changed, 116 insertions(+), 2 deletions(-)
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

* src/qemu/qemu_driver.c (add function qemuDomainIsUpdated) --- src/qemu/qemu_driver.c | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5516090..fd61864 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4734,6 +4734,26 @@ cleanup: return ret; } +static int qemuDomainIsUpdated(virDomainPtr dom) +{ + struct qemud_driver *driver = dom->conn->privateData; + virDomainObjPtr obj; + int ret = -1; + + qemuDriverLock(driver); + obj = virDomainFindByUUID(&driver->domains, dom->uuid); + qemuDriverUnlock(driver); + if (!obj) { + qemuReportError(VIR_ERR_NO_DOMAIN, NULL); + goto cleanup; + } + ret = obj->updated; + +cleanup: + if (obj) + virDomainObjUnlock(obj); + return ret; +} static int qemudGetVersion(virConnectPtr conn, unsigned long *version) { struct qemud_driver *driver = conn->privateData; @@ -13209,7 +13229,7 @@ static virDriver qemuDriver = { qemuIsSecure, /* isSecure */ qemuDomainIsActive, /* domainIsActive */ qemuDomainIsPersistent, /* domainIsPersistent */ - NULL, /* domainIsUpdated */ + qemuDomainIsUpdated, /* domainIsUpdated */ qemuCPUCompare, /* cpuCompare */ qemuCPUBaseline, /* cpuBaseline */ qemuDomainGetJobInfo, /* domainGetJobInfo */ -- 1.7.3.2

On Mon, Nov 15, 2010 at 11:23:35AM +0800, Osier Yang wrote:
* src/qemu/qemu_driver.c (add function qemuDomainIsUpdated) --- src/qemu/qemu_driver.c | 22 +++++++++++++++++++++- 1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5516090..fd61864 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4734,6 +4734,26 @@ cleanup: return ret; }
+static int qemuDomainIsUpdated(virDomainPtr dom) +{ + struct qemud_driver *driver = dom->conn->privateData; + virDomainObjPtr obj; + int ret = -1; + + qemuDriverLock(driver); + obj = virDomainFindByUUID(&driver->domains, dom->uuid); + qemuDriverUnlock(driver); + if (!obj) { + qemuReportError(VIR_ERR_NO_DOMAIN, NULL); + goto cleanup; + } + ret = obj->updated; + +cleanup: + if (obj) + virDomainObjUnlock(obj); + return ret; +}
static int qemudGetVersion(virConnectPtr conn, unsigned long *version) { struct qemud_driver *driver = conn->privateData; @@ -13209,7 +13229,7 @@ static virDriver qemuDriver = { qemuIsSecure, /* isSecure */ qemuDomainIsActive, /* domainIsActive */ qemuDomainIsPersistent, /* domainIsPersistent */ - NULL, /* domainIsUpdated */ + qemuDomainIsUpdated, /* domainIsUpdated */ qemuCPUCompare, /* cpuCompare */ qemuCPUBaseline, /* cpuBaseline */ qemuDomainGetJobInfo, /* domainGetJobInfo */
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Mon, Nov 15, 2010 at 10:26:22AM +0800, Osier Yang wrote:
Hi, all
Suppose that one updated a domain, and want to restart the domain with original configuration.
However, currently, unless shutdown the domain first, and then restart or reload libvirtd, otherwise domain will still be started with changed configuration. e.g.
# virsh list --all Id Name State ---------------------------------- 1 f14 running
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd1.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
# virsh update-device f14 cd2.xml
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd2.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
# virsh destroy f14 # virsh start f14
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd2.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
it's caused by libvirtd doesn't known if a domain is updated or not, it updated the domain configuration in memory, but client could not known about it.
As a result, one wants to start the domain with original configuration, he has to shutdown the domain first, and then restart libvirt.
This is a bug. libvirt should save a copy of the original configuration at the time the guest starts, so any live changes only remain for the duration of that boot and automatically revert at shutdown. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

于 2010年11月15日 18:56, Daniel P. Berrange 写道:
On Mon, Nov 15, 2010 at 10:26:22AM +0800, Osier Yang wrote:
Hi, all
Suppose that one updated a domain, and want to restart the domain with original configuration.
However, currently, unless shutdown the domain first, and then restart or reload libvirtd, otherwise domain will still be started with changed configuration. e.g.
# virsh list --all Id Name State ---------------------------------- 1 f14 running
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd1.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
# virsh update-device f14 cd2.xml
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd2.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
# virsh destroy f14 # virsh start f14
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd2.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
it's caused by libvirtd doesn't known if a domain is updated or not, it updated the domain configuration in memory, but client could not known about it.
As a result, one wants to start the domain with original configuration, he has to shutdown the domain first, and then restart libvirt.
This is a bug. libvirt should save a copy of the original configuration at the time the guest starts, so any live changes only remain for the duration of that boot and automatically revert at shutdown.
yeah, I'm tring to fix it.. :-) IMHO it's waste of some memory to let libvirtd save a copy of the original domain configuration, though it could just save the copy only when updating happens. My thought is to export APIs to work around it, the patches is to export API "virDomainIsUpdated", however, think also need another API, which is to update the hash entry of the domain configuration, need to invoke "virHashUpdateEntry". This API could be invoked when starting a updated domain. It reloads the persistent domain configuration and updates the updated domain configuration maintained by libvirtd. How about naming it as "virDomainUpdateConfig"? The diffrence with your thought is that it will really relys on client, reducing the work load of libvirt, but all the clients that using libvirt should be updated with the new APIs to fix the bug then, so, not sure if it's fine. Thanks - Osier
Regards, Daniel

On Mon, Nov 15, 2010 at 02:02:28PM +0800, Osier Yang wrote:
于 2010年11月15日 18:56, Daniel P. Berrange 写道:
On Mon, Nov 15, 2010 at 10:26:22AM +0800, Osier Yang wrote:
Hi, all
Suppose that one updated a domain, and want to restart the domain with original configuration.
However, currently, unless shutdown the domain first, and then restart or reload libvirtd, otherwise domain will still be started with changed configuration. e.g.
# virsh list --all Id Name State ---------------------------------- 1 f14 running
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd1.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
# virsh update-device f14 cd2.xml
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd2.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
# virsh destroy f14 # virsh start f14
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd2.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
it's caused by libvirtd doesn't known if a domain is updated or not, it updated the domain configuration in memory, but client could not known about it.
As a result, one wants to start the domain with original configuration, he has to shutdown the domain first, and then restart libvirt.
This is a bug. libvirt should save a copy of the original configuration at the time the guest starts, so any live changes only remain for the duration of that boot and automatically revert at shutdown.
yeah, I'm tring to fix it.. :-)
IMHO it's waste of some memory to let libvirtd save a copy of the original domain configuration, though it could just save the copy only when updating happens.
Yep, that would be ideal.
The diffrence with your thought is that it will really relys on client, reducing the work load of libvirt, but all the clients that using libvirt should be updated with the new APIs to fix the bug then, so, not sure if it's fine.
We can fix this entirely in the server side so we can avoid every single client having to be aware of it. Even though I don't think this API is the solution to the problem you describe, I think this API is still useful. There are a couple of further enhancements I'd like to see. First add implementation sof it to all the hypervisor drivers - it should be pretty trivial to do - the UML/LXC drivers will just be like the QEMU impl. The other drivers will all just return 0, because they don't have the separate config in memory vs on disk. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On 18/11/2010, at 8:44 PM, Daniel P. Berrange wrote:
On Mon, Nov 15, 2010 at 02:02:28PM +0800, Osier Yang wrote:
于 2010年11月15日 18:56, Daniel P. Berrange 写道: <snip>
On Mon, Nov 15, 2010 at 10:26:22AM +0800, Osier Yang wrote: This is a bug. libvirt should save a copy of the original configuration at the time the guest starts, so any live changes only remain for the duration of that boot and automatically revert at shutdown.
As a datapoint, VirtualBox has an option (per guest) to either keep or not keep the changes made while it's running. It's a persistent setting, and can be toggled while the guest is operating, so the user is able change whether they keep changes or not. Having our approach hard coded to never keep changes sounds a bit non-optimal, if there are use cases where people might like to keep them. Though, I haven't read the full thread for this... ;>

On 18/11/2010, at 8:44 PM, Daniel P. Berrange wrote:
On Mon, Nov 15, 2010 at 02:02:28PM +0800, Osier Yang wrote:
于 2010年11月15日 18:56, Daniel P. Berrange 写道: <snip>
On Mon, Nov 15, 2010 at 10:26:22AM +0800, Osier Yang wrote: This is a bug. libvirt should save a copy of the original configuration at the time the guest starts, so any live changes only remain for the duration of that boot and automatically revert at shutdown.
As a datapoint, VirtualBox has an option (per guest) to either keep or not keep the changes made while it's running. It's a persistent setting, and can be toggled while the guest is operating, so the user is able change whether they keep changes or not.
Having our approach hard coded to never keep changes sounds a bit non-optimal, if there are use cases where people might like to keep them.
Though, I haven't read the full thread for this... ;> yeah, agree, actually, currently we don't allow to make changes on the
于 2010年11月18日 18:20, Justin Clift 写道: persistent configs. - Osier

于 2010年11月18日 17:44, Daniel P. Berrange 写道:
On Mon, Nov 15, 2010 at 02:02:28PM +0800, Osier Yang wrote:
于 2010年11月15日 18:56, Daniel P. Berrange 写道:
On Mon, Nov 15, 2010 at 10:26:22AM +0800, Osier Yang wrote:
Hi, all
Suppose that one updated a domain, and want to restart the domain with original configuration.
However, currently, unless shutdown the domain first, and then restart or reload libvirtd, otherwise domain will still be started with changed configuration. e.g.
# virsh list --all Id Name State ---------------------------------- 1 f14 running
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd1.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
# virsh update-device f14 cd2.xml
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd2.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
# virsh destroy f14 # virsh start f14
# virsh dumpxml f14 | grep -A 7 cdrom <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/cd2.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk>
it's caused by libvirtd doesn't known if a domain is updated or not, it updated the domain configuration in memory, but client could not known about it.
As a result, one wants to start the domain with original configuration, he has to shutdown the domain first, and then restart libvirt.
This is a bug. libvirt should save a copy of the original configuration at the time the guest starts, so any live changes only remain for the duration of that boot and automatically revert at shutdown.
yeah, I'm tring to fix it.. :-)
IMHO it's waste of some memory to let libvirtd save a copy of the original domain configuration, though it could just save the copy only when updating happens.
Yep, that would be ideal.
The diffrence with your thought is that it will really relys on client, reducing the work load of libvirt, but all the clients that using libvirt should be updated with the new APIs to fix the bug then, so, not sure if it's fine.
We can fix this entirely in the server side so we can avoid every single client having to be aware of it.
yep, I'm changing to fix it like so.
Even though I don't think this API is the solution to the problem you describe, I think this API is still useful. There are a couple of further enhancements I'd like to see. First add implementation sof it to all the hypervisor drivers - it should be pretty trivial to do - the UML/LXC drivers will just be like the QEMU impl. The other drivers will all just return 0, because they don't have the separate config in memory vs on disk.
okay, will do it. - Osier
Regards, Daniel

* src/libvirt.c --- src/libvirt.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-) diff --git a/src/libvirt.c b/src/libvirt.c index 3c8bf30..3625695 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -11438,6 +11438,39 @@ error: } /** + * virDomainIsUpdated: + * @dom: pointer to the domain object + * + * Determine if the domain has been updated. + * + * Returns 1 if updated, 0 if not, -1 on error + */ +int virDomainIsUpdated(virDomainPtr dom) +{ + DEBUG("dom=%p", dom); + + virResetLastError(); + + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { + virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__); + virDispatchError(NULL); + return (-1); + } + if (dom->conn->driver->domainIsUpdated) { + int ret; + ret = dom->conn->driver->domainIsUpdated(dom); + if (ret < 0) + goto error; + return ret; + } + + virLibConnError(dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); +error: + virDispatchError(dom->conn); + return -1; +} + +/** * virNetworkIsActive: * @net: pointer to the network object * -- 1.7.3.2

Sorry for the trouble of patch names, anyone who would like to push these patches, could you please help update it? s|/4|/5| Thanks - Osier 于 2010年11月18日 19:12, Osier Yang 写道:
* src/libvirt.c --- src/libvirt.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/src/libvirt.c b/src/libvirt.c index 3c8bf30..3625695 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -11438,6 +11438,39 @@ error: }
/** + * virDomainIsUpdated: + * @dom: pointer to the domain object + * + * Determine if the domain has been updated. + * + * Returns 1 if updated, 0 if not, -1 on error + */ +int virDomainIsUpdated(virDomainPtr dom) +{ + DEBUG("dom=%p", dom); + + virResetLastError(); + + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { + virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__); + virDispatchError(NULL); + return (-1); + } + if (dom->conn->driver->domainIsUpdated) { + int ret; + ret = dom->conn->driver->domainIsUpdated(dom); + if (ret< 0) + goto error; + return ret; + } + + virLibConnError(dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); +error: + virDispatchError(dom->conn); + return -1; +} + +/** * virNetworkIsActive: * @net: pointer to the network object * -- 1.7.3.2
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 11/18/2010 04:20 AM, Osier Yang wrote:
Sorry for the trouble of patch names, anyone who would like to push these patches, could you please help update it?
s|/4|/5|
Actually, git strips [PATCH 2/5] altogether; the resulting patch name would be "implement public API virDomainIsUpdated" without reference to how long the series was that introduced it. However, is this supposed to be squashed into the 1/4 patch, or is everything still bisectable if this is inserted as a separate patch between 1 and 2 of the original series? [I could find out by manually applying things, but would rather save the time if you have the answer quickly] -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

于 2010年11月20日 02:57, Eric Blake 写道:
On 11/18/2010 04:20 AM, Osier Yang wrote:
Sorry for the trouble of patch names, anyone who would like to push these patches, could you please help update it?
s|/4|/5|
Actually, git strips [PATCH 2/5] altogether; the resulting patch name would be "implement public API virDomainIsUpdated" without reference to how long the series was that introduced it.
good to known it..
However, is this supposed to be squashed into the 1/4 patch, or is everything still bisectable if this is inserted as a separate patch between 1 and 2 of the original series?
It's the separate patch, and should be inserted between 1 and 2. Thanks. - Osier
[I could find out by manually applying things, but would rather save the time if you have the answer quickly]

On 11/19/2010 09:14 PM, Osier Yang wrote:
于 2010年11月20日 02:57, Eric Blake 写道:
On 11/18/2010 04:20 AM, Osier Yang wrote:
Sorry for the trouble of patch names, anyone who would like to push these patches, could you please help update it?
However, is this supposed to be squashed into the 1/4 patch, or is everything still bisectable if this is inserted as a separate patch between 1 and 2 of the original series?
It's the separate patch, and should be inserted between 1 and 2. Thanks.
As written, this had a compile error between the original 1 and 2: libvirt.c:11460:26: error: 'virDriver' has no member named 'domainIsUpdated' but the fix was to instead apply it between 2 and 3. ACK, and I've now pushed all five patches in the correct order. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

于 2010年11月24日 06:13, Eric Blake 写道:
On 11/19/2010 09:14 PM, Osier Yang wrote:
于 2010年11月20日 02:57, Eric Blake 写道:
On 11/18/2010 04:20 AM, Osier Yang wrote:
Sorry for the trouble of patch names, anyone who would like to push these patches, could you please help update it?
However, is this supposed to be squashed into the 1/4 patch, or is everything still bisectable if this is inserted as a separate patch between 1 and 2 of the original series?
It's the separate patch, and should be inserted between 1 and 2. Thanks.
As written, this had a compile error between the original 1 and 2:
libvirt.c:11460:26: error: 'virDriver' has no member named 'domainIsUpdated'
but the fix was to instead apply it between 2 and 3.
ACK, and I've now pushed all five patches in the correct order.
sorry for the trouble, and thanks. :-)
participants (4)
-
Daniel P. Berrange
-
Eric Blake
-
Justin Clift
-
Osier Yang