当前位置: 首页>>代码示例>>Python>>正文


Python StoragePool.delete方法代码示例

本文整理汇总了Python中marvin.lib.base.StoragePool.delete方法的典型用法代码示例。如果您正苦于以下问题:Python StoragePool.delete方法的具体用法?Python StoragePool.delete怎么用?Python StoragePool.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在marvin.lib.base.StoragePool的用法示例。


在下文中一共展示了StoragePool.delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test13_update_primary_storage_capacityIops_to_zero

# 需要导入模块: from marvin.lib.base import StoragePool [as 别名]
# 或者: from marvin.lib.base.StoragePool import delete [as 别名]
    def test13_update_primary_storage_capacityIops_to_zero(self):
        updatedIops = 0
        StoragePool.update(self.apiClient,
                           id=self.primary_storage_id,
                           capacityiops=updatedIops,
                           tags=self.primary_tag)

        # Verify in cloudsatck
        storage_pools_response = list_storage_pools(
            self.apiClient, clusterid=self.cluster.id)
        for data in storage_pools_response:
            if data.id == self.primary_storage_id:
                storage_pool = data

        self.assertEqual(
            storage_pool.capacityiops, updatedIops,
            "Primary storage capacityiops not updated")

        # Verify in datera
        datera_primary_storage_name = "cloudstack-" + self.primary_storage_id
        for instance in self.datera_api.app_instances.list():
            if instance['name'] == datera_primary_storage_name:
                datera_instance = instance
        app_instance_response_iops = (
            datera_instance['storage_instances']
            ['storage-1']['volumes']['volume-1']['performance_policy']
            ['total_iops_max'])

        self.assertEqual(
            app_instance_response_iops, updatedIops,
            "app-instance capacityiops not updated")

        StoragePool.delete(self.primary_storage, self.apiClient)
        self.cleanup = []
开发者ID:Datera,项目名称:cloudstack-driver,代码行数:36,代码来源:test_edit_primary_storage.py

示例2: test06_primary_storage_cancel_maintenance_mode

# 需要导入模块: from marvin.lib.base import StoragePool [as 别名]
# 或者: from marvin.lib.base.StoragePool import delete [as 别名]
    def test06_primary_storage_cancel_maintenance_mode(self):
        StoragePool.enableMaintenance(self.apiClient,
                                      id=self.primary_storage_id)
        StoragePool.cancelMaintenance(self.apiClient,
                                      id=self.primary_storage_id)

        # Verify in cloudsatck
        storage_pools_response = list_storage_pools(
            self.apiClient, clusterid=self.cluster.id)
        for storage in storage_pools_response:
            if storage.id == self.primary_storage_id:
                storage_pool = storage
        self.assertEqual(
            storage_pool.state, "Up",
            "Primary storage not in up mode")

        # Verify in datera
        datera_primary_storage_name = "cloudstack-" + self.primary_storage_id
        for instance in self.datera_api.app_instances.list():
            if instance['name'] == datera_primary_storage_name:
                datera_instance = instance
        self.assertEqual(
            datera_instance["admin_state"], "online",
            "app-instance not in online mode")

        # Verify in xenserver
        for key, value in self.xen_session.xenapi.SR.get_all_records().items():
            if value['name_description'] == self.primary_storage_id:
                xen_sr = value
        self.assertEqual(
            set(["forget", "destroy"]).issubset(xen_sr["allowed_operations"]),
            False, "Xenserver SR in offline mode")

        StoragePool.delete(self.primary_storage, self.apiClient)
        self.cleanup = []
开发者ID:Datera,项目名称:cloudstack-driver,代码行数:37,代码来源:test_edit_primary_storage.py

示例3: test07_update_primary_storage_capacityBytes

# 需要导入模块: from marvin.lib.base import StoragePool [as 别名]
# 或者: from marvin.lib.base.StoragePool import delete [as 别名]
    def test07_update_primary_storage_capacityBytes(self):
        updatedDiskSize = self.testdata[TestData.newCapacityBytes]
        StoragePool.update(self.apiClient,
                           id=self.primary_storage_id,
                           capacitybytes=updatedDiskSize,
                           tags=self.primary_tag)

        # Verify in cloudsatck
        storage_pools_response = list_storage_pools(
            self.apiClient, clusterid=self.cluster.id)
        for data in storage_pools_response:
            if data.id == self.primary_storage_id:
                storage_pool = data

        self.assertEqual(
            storage_pool.disksizetotal, updatedDiskSize,
            "Primary storage not updated")

        # Verify in datera
        datera_primary_storage_name = "cloudstack-" + self.primary_storage_id
        for instance in self.datera_api.app_instances.list():
            if instance['name'] == datera_primary_storage_name:
                datera_instance = instance
        app_instance_response_disk_size = (
            datera_instance['storage_instances']
            ['storage-1']['volumes']['volume-1']['size'] * 1073741824)

        self.assertEqual(
            app_instance_response_disk_size, updatedDiskSize,
            "app-instance not updated")

        # Verify in xenserver
       #for key, value in self.xen_session.xenapi.SR.get_all_records().items():
        #    if value['name_description'] == self.primary_storage_id:
        #        xen_sr = value
        #Uncomment after xen fix
        #print xen_sr
        #print xen_sr['physical_size'], updatedDiskSize
        #self.assertEqual(
        #    int(xen_sr['physical_size']) + 12582912, updatedDiskSize,
        #    "Xen server physical storage not updated")

        StoragePool.delete(self.primary_storage, self.apiClient)
        self.cleanup = []
开发者ID:Datera,项目名称:cloudstack-driver,代码行数:46,代码来源:test_edit_primary_storage.py

示例4: test04_delete_primary_storage

# 需要导入模块: from marvin.lib.base import StoragePool [as 别名]
# 或者: from marvin.lib.base.StoragePool import delete [as 别名]
    def test04_delete_primary_storage(self):
        #cleanup_resources(self.apiClient, self._primary_storage)
        StoragePool.delete(self.primary_storage, self.apiClient)
        self.cleanup = []

        # Verify in Cloudstack
        storage_pools_response = list_storage_pools(
            self.apiClient, clusterid=self.cluster.id)
        if len(storage_pools_response) > 0:
            for storage in storage_pools_response:
                self.assertNotEqual(
                    storage.id,
                    self.primary_storage_id,
                    "Primary storage not deleted")

        # Verify in Datera
        flag = 0
        datera_primary_storage_name = "cloudstack-" + self.primary_storage_id
        for item in self.datera_api.app_instances.list():
            if item['name'] == datera_primary_storage_name:
                flag = 1
        self.assertEqual(flag, 0, "app instance not deleted.")

        # Verify in xenserver
        for key, value in self.xen_session.xenapi.SR.get_all_records().items():
            self.assertNotEqual(
                value['name_description'],
                self.primary_storage_id,
                "SR not deleted in xenserver")

        # Verify in sql database
        command = "select uuid from storage_pool"
        sql_result = self.dbConnection.execute(command)
        key = 0
        for uuid in sql_result:
            if uuid[0] == self.primary_storage_id:
                key = 1
        self.assertEqual(
            key, 0, "Primary storage not deleted in database")
开发者ID:sheshananda,项目名称:cloudstack-driver,代码行数:41,代码来源:test_edit_primary_storage.py

示例5: StoragePool

# 需要导入模块: from marvin.lib.base import StoragePool [as 别名]
# 或者: from marvin.lib.base.StoragePool import delete [as 别名]
    storages = StoragePool.list(apiClient)
    if storages:
      for storage in storages:
        print "storage name={}, id={}".format(storage.name, storage.id)
        if storage.state == 'Maintenance':
          print "delete StoragePool"
          cmd = deleteStoragePool.deleteStoragePoolCmd()
          cmd.id = storage.id
          cmd.forced = 'True'
          apiClient.deleteStoragePool(cmd)
        else:
          print "Delete StoragePool"
          s = StoragePool(tmp_dict)
          s.id = storage.id
          s.forced = 'True'
          s.delete(apiClient)

#    hosts = Host.list(apiClient)
#    if hosts:
#      for host in hosts:
#        print "host name={}, id={}".format(host.name, host.id)
#        if host.type == 'Routing':
#          h = Host(tmp_dict)
#          if host.resourcestate != 'PrepareForMaintenance' \
#              and host.resourcestate != 'Maintenance':
#            print "Maintenance for host"
#            h.enableMaintenance(apiClient, host.id)

    hosts = Host.list(apiClient)
    if hosts:
      for host in hosts:
开发者ID:realsystem,项目名称:my_scripts,代码行数:33,代码来源:clean.py


注:本文中的marvin.lib.base.StoragePool.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。