Re: [libvirt] [PATCH V2 12/13] libxl: use job functions in libxlDomainSetAutostart

2014-02-19 Thread Daniel P. Berrange
On Wed, Feb 12, 2014 at 06:56:26PM -0700, Jim Fehlig wrote:
 Setting autostart is a modify operation that needs to wait in the
 queue of modify jobs.
 
 Signed-off-by: Jim Fehlig jfeh...@suse.com
 ---
 
 V2: Check libxlDomainObjEndJob() return value
 
  src/libxl/libxl_driver.c | 19 +--
  1 file changed, 13 insertions(+), 6 deletions(-)

ACK


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 :|

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


[libvirt] [PATCH V2 12/13] libxl: use job functions in libxlDomainSetAutostart

2014-02-12 Thread Jim Fehlig
Setting autostart is a modify operation that needs to wait in the
queue of modify jobs.

Signed-off-by: Jim Fehlig jfeh...@suse.com
---

V2: Check libxlDomainObjEndJob() return value

 src/libxl/libxl_driver.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index f19d551..9741b3a 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3866,40 +3866,43 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart)
 if (virDomainSetAutostartEnsureACL(dom-conn, vm-def)  0)
 goto cleanup;
 
+if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY)  0)
+goto cleanup;
+
 if (!vm-persistent) {
 virReportError(VIR_ERR_OPERATION_INVALID,
%s, _(cannot set autostart for transient domain));
-goto cleanup;
+goto endjob;
 }
 
 autostart = (autostart != 0);
 
 if (vm-autostart != autostart) {
 if (!(configFile = virDomainConfigFile(cfg-configDir, vm-def-name)))
-goto cleanup;
+goto endjob;
 if (!(autostartLink = virDomainConfigFile(cfg-autostartDir, 
vm-def-name)))
-goto cleanup;
+goto endjob;
 
 if (autostart) {
 if (virFileMakePath(cfg-autostartDir)  0) {
 virReportSystemError(errno,
  _(cannot create autostart directory %s),
  cfg-autostartDir);
-goto cleanup;
+goto endjob;
 }
 
 if (symlink(configFile, autostartLink)  0) {
 virReportSystemError(errno,
  _(Failed to create symlink '%s to '%s'),
  autostartLink, configFile);
-goto cleanup;
+goto endjob;
 }
 } else {
 if (unlink(autostartLink)  0  errno != ENOENT  errno != 
ENOTDIR) {
 virReportSystemError(errno,
  _(Failed to delete symlink '%s'),
  autostartLink);
-goto cleanup;
+goto endjob;
 }
 }
 
@@ -3907,6 +3910,10 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart)
 }
 ret = 0;
 
+endjob:
+if (!libxlDomainObjEndJob(driver, vm))
+vm = NULL;
+
 cleanup:
 VIR_FREE(configFile);
 VIR_FREE(autostartLink);
-- 
1.8.1.4

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