]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
locking: relax PID requirement
authorJim Fehlig <jfehlig@suse.com>
Thu, 16 Apr 2015 17:32:42 +0000 (11:32 -0600)
committerJim Fehlig <jfehlig@suse.com>
Wed, 22 Apr 2015 20:16:44 +0000 (14:16 -0600)
Some hypervisors like Xen do not have PIDs associated with domains.
Relax the requirement for PID != 0 in the locking code so it can
be used by hypervisors that do not represent domains as a process
running on the host.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
src/locking/lock_daemon.c
src/locking/lock_daemon_dispatch.c
src/locking/lock_driver_lockd.c

index bb165c0d500b16fe83aae39c683f420543929f37..042ff947f804739286790c200cdf32aa4e86ab19 100644 (file)
@@ -678,7 +678,7 @@ virLockDaemonClientFree(void *opaque)
                     signum = SIGKILL;
                 else
                     signum = 0;
-                if (virProcessKill(priv->clientPid, signum) < 0) {
+                if (priv->clientPid != 0 && virProcessKill(priv->clientPid, signum) < 0) {
                     if (errno == ESRCH)
                         break;
 
index a7cee9df04dc38709880d9d2fd5274e53ca7d1a8..bad646c6d07b2db2d7ee73bcfac5865520e3a237 100644 (file)
@@ -62,7 +62,7 @@ virLockSpaceProtocolDispatchAcquireResource(virNetServerPtr server ATTRIBUTE_UNU
         goto cleanup;
     }
 
-    if (!priv->ownerPid) {
+    if (!priv->ownerId) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("lock owner details have not been registered"));
         goto cleanup;
@@ -120,7 +120,7 @@ virLockSpaceProtocolDispatchCreateResource(virNetServerPtr server ATTRIBUTE_UNUS
         goto cleanup;
     }
 
-    if (!priv->ownerPid) {
+    if (!priv->ownerId) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("lock owner details have not been registered"));
         goto cleanup;
@@ -169,7 +169,7 @@ virLockSpaceProtocolDispatchDeleteResource(virNetServerPtr server ATTRIBUTE_UNUS
         goto cleanup;
     }
 
-    if (!priv->ownerPid) {
+    if (!priv->ownerId) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("lock owner details have not been registered"));
         goto cleanup;
@@ -218,7 +218,7 @@ virLockSpaceProtocolDispatchNew(virNetServerPtr server ATTRIBUTE_UNUSED,
         goto cleanup;
     }
 
-    if (!priv->ownerPid) {
+    if (!priv->ownerId) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("lock owner details have not been registered"));
         goto cleanup;
@@ -273,9 +273,9 @@ virLockSpaceProtocolDispatchRegister(virNetServerPtr server ATTRIBUTE_UNUSED,
         goto cleanup;
     }
 
-    if (priv->ownerPid) {
+    if (!args->owner.id) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                       _("lock owner details have already been registered"));
+                       _("lock owner details have not been registered"));
         goto cleanup;
     }
 
@@ -320,7 +320,7 @@ virLockSpaceProtocolDispatchReleaseResource(virNetServerPtr server ATTRIBUTE_UNU
         goto cleanup;
     }
 
-    if (!priv->ownerPid) {
+    if (!priv->ownerId) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("lock owner details have not been registered"));
         goto cleanup;
@@ -370,7 +370,7 @@ virLockSpaceProtocolDispatchRestrict(virNetServerPtr server ATTRIBUTE_UNUSED,
         goto cleanup;
     }
 
-    if (!priv->ownerPid) {
+    if (!priv->ownerId) {
         virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                        _("lock owner details have not been registered"));
         goto cleanup;
index 3a48a6adc9c682b4ecd7c774475dfadde6314455..c974d60da7fb35eb8a7b6dc51931689eced8b1c4 100644 (file)
@@ -466,11 +466,8 @@ static int virLockManagerLockDaemonNew(virLockManagerPtr lock,
                            _("Missing ID parameter for domain object"));
             return -1;
         }
-        if (priv->pid == 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Missing PID parameter for domain object"));
-            return -1;
-        }
+        if (priv->pid == 0)
+            VIR_DEBUG("Missing PID parameter for domain object");
         if (!priv->name) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("Missing name parameter for domain object"));