Moti Asayag has uploaded a new change for review.

Change subject: engine: Remove vnic profiles when of a removed data-center
......................................................................

engine: Remove vnic profiles when of a removed data-center

The patch removes the vnic profiles associated to networks
which reside in a data-center which is being removed.

Change-Id: Ifb399dc916983780be9895278e9335e3631ad1cd
Signed-off-by: Moti Asayag <masa...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/89/16789/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java
index 1aaf2b7..f6db910 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/RemoveStoragePoolCommand.java
@@ -27,6 +27,7 @@
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
 import org.ovirt.engine.core.common.businessentities.VmStatic;
 import org.ovirt.engine.core.common.businessentities.network.Network;
+import org.ovirt.engine.core.common.businessentities.network.VnicProfile;
 import org.ovirt.engine.core.common.errors.VdcBLLException;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.common.locks.LockingGroup;
@@ -94,6 +95,11 @@
             public Void runInTransaction() {
                 final List<Network> networks = 
getNetworkDAO().getAllForDataCenter(getStoragePoolId());
                 for (final Network net : networks) {
+                    List<VnicProfile> profiles = 
getDbFacade().getVnicProfileDao().getAllForNetwork(net.getId());
+                    for (VnicProfile vnicProfile : profiles) {
+                        getCompensationContext().snapshotEntity(vnicProfile);
+                        
getDbFacade().getVnicProfileDao().remove(vnicProfile.getId());
+                    }
                     getCompensationContext().snapshotEntity(net);
                     getNetworkDAO().remove(net.getId());
                 }


-- 
To view, visit http://gerrit.ovirt.org/16789
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb399dc916983780be9895278e9335e3631ad1cd
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <masa...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to