from dbaas_cloudstack.provider import CloudStackProvider
from pre_provisioned.pre_provisioned_provider import  PreProvisionedProvider
import logging

LOG = logging.getLogger(__name__)

class IaaSManager():
    
    @classmethod
    def destroy_instance(cls, database, *args, **kwargs):
        plan = database.plan
        provider = plan.provider
        if provider == plan.PREPROVISIONED:
            LOG.info("Destroying pre provisioned database...")
            PreProvisionedProvider().destroy_instance(database, *args, **kwargs)
        elif provider == plan.CLOUDSTACK:
            LOG.info("Destroying cloud stack instance...")
            CloudStackProvider().destroy_instance(database, *args, **kwargs)
            
    @classmethod 
    def create_instance(cls, plan, environment, name):
        if plan.provider == plan.PREPROVISIONED:
            LOG.info("Creating pre provisioned instance...")
            return PreProvisionedProvider().create_instance(plan, environment)
        elif plan.provider == plan.CLOUDSTACK:
            LOG.info("Creating cloud stack instance...")
            return CloudStackProvider().create_instance(plan, environment, name)        

@@ -127,16 +127,78 @@
 rovider%0A
+from integrations.monitoring.manager import MonitoringManager%0A
 import l
@@ -684,32 +684,104 @@
 k instance...%22)%0A
+            MonitoringManager.remove_monitoring(database.databaseinfra)%0A
             Clou
@@ -1232,22 +1232,31 @@
         
-return
+databaseinfra =
  CloudSt
@@ -1309,17 +1309,18 @@
 t, name)
+%0A
         
 %0A
@@ -1310,17 +1310,150 @@
 , name)%0A        
+    if databaseinfra is not None:%0A                MonitoringManager.create_monitoring(databaseinfra)%0A            return databaseinfra
 %0A

Add call to monitoring app