Maor Lipchuk has uploaded a new change for review.

Change subject: core: Attach Cinder Storage Domain to pool
......................................................................

core: Attach Cinder Storage Domain to pool

Adding the ability to attach Cinder Storage Domain to pool

Change-Id: I7aacae7497a9dc423e2760c83656a2d455c5eda7
Bug-Url: https://bugzilla.redhat.com/1185826
Signed-off-by: Maor Lipchuk <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainToPoolCommand.java
1 file changed, 24 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/63/39163/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainToPoolCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainToPoolCommand.java
index 8f5de6c..9d27831 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainToPoolCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AttachStorageDomainToPoolCommand.java
@@ -92,6 +92,10 @@
     @Override
     protected void executeCommand() {
         if (getStorageDomain() != null) {
+            if (isCinderStorageDomain()) {
+                handleCinderDomain();
+                return;
+            }
             if (getStoragePool().getStatus() == 
StoragePoolStatus.Uninitialized) {
                 StoragePoolWithStoragesParameter parameters = new 
StoragePoolWithStoragesParameter(getStoragePool(),
                        Arrays.asList(getStorageDomain().getId()),
@@ -205,6 +209,16 @@
                 }
             }
         }
+    }
+
+    private void handleCinderDomain() {
+        CINDERStorageHelper CINDERStorageHelper = new CINDERStorageHelper();
+        
CINDERStorageHelper.attachCinderDomainToPool(getStorageDomain().getId(),
+                getParameters().getStoragePoolId());
+        if (getParameters().getActivate()) {
+            attemptToActivateCinderDomain();
+        }
+        setSucceeded(true);
     }
 
     /**
@@ -431,6 +445,16 @@
                         
cloneContext().withoutCompensationContext().withoutExecutionContext());
     }
 
+    protected void attemptToActivateCinderDomain() {
+        try {
+            CINDERStorageHelper CINDERStorageHelper = new 
CINDERStorageHelper();
+            CINDERStorageHelper.activateCinderDomain(
+                    getParameters().getStorageDomainId(), 
getParameters().getStoragePoolId());
+        } catch (RuntimeException e) {
+            auditLogDirector.log(this, 
AuditLogType.USER_ACTIVATE_STORAGE_DOMAIN_FAILED);
+        }
+    }
+
     @Override
     public AuditLogType getAuditLogTypeValue() {
         return getSucceeded() ? AuditLogType.USER_ATTACH_STORAGE_DOMAIN_TO_POOL


-- 
To view, visit https://gerrit.ovirt.org/39163
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7aacae7497a9dc423e2760c83656a2d455c5eda7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to