本文整理汇总了Python中marvin.lib.base.Host.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Host.delete方法的具体用法?Python Host.delete怎么用?Python Host.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.Host
的用法示例。
在下文中一共展示了Host.delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Host
# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import delete [as 别名]
for host in hosts:
print "host name={}, id={}".format(host.name, host.id)
if host.type == 'Routing':
if host.resourcestate == 'PrepareForMaintenance' \
or host.resourcestate == 'Maintenance':
print "delete host"
cmd = deleteHost.deleteHostCmd()
cmd.id = host.id
# cmd.forced = 'True'
apiClient.deleteHost(cmd)
else:
print "Delete host"
h = Host(tmp_dict)
# h.forced = 'True'
h.id = host.id
h.delete(apiClient)
clusters = Cluster.list(apiClient)
if clusters:
for cluster in clusters:
print "cluster name={}, id={}".format(cluster.name, cluster.id)
if cluster.allocationstate == 'Enabled':
print "Delete Cluster"
c = Cluster(tmp_dict)
c.id = cluster.id
c.delete(apiClient)
ipranges = PublicIpRange.list(apiClient)
if ipranges:
for iprange in ipranges:
print "ip range name={}, id={}".format(iprange.name, iprange.id)
示例2: test_vag_per_host_5
# 需要导入模块: from marvin.lib.base import Host [as 别名]
# 或者: from marvin.lib.base.Host import delete [as 别名]
def test_vag_per_host_5(self):
hosts = list_hosts(self.apiClient, clusterid=self.cluster.id)
self.assertTrue(
len(hosts) >= 2,
"There needs to be at least two hosts."
)
unique_vag_ids = self._get_unique_vag_ids(hosts)
self.assertTrue(len(hosts) == len(unique_vag_ids), "To run this test, each host should be in its own VAG.")
primarystorage = self.testdata[TestData.primaryStorage]
primary_storage = StoragePool.create(
self.apiClient,
primarystorage,
scope=primarystorage[TestData.scope],
zoneid=self.zone.id,
provider=primarystorage[TestData.provider],
tags=primarystorage[TestData.tags],
capacityiops=primarystorage[TestData.capacityIops],
capacitybytes=primarystorage[TestData.capacityBytes],
hypervisor=primarystorage[TestData.hypervisor]
)
self.cleanup.append(primary_storage)
self.virtual_machine = VirtualMachine.create(
self.apiClient,
self.testdata[TestData.virtualMachine],
accountid=self.account.name,
zoneid=self.zone.id,
serviceofferingid=self.compute_offering.id,
templateid=self.template.id,
domainid=self.domain.id,
startvm=True
)
root_volume = self._get_root_volume(self.virtual_machine)
sf_account_id = sf_util.get_sf_account_id(self.cs_api, self.account.id, primary_storage.id, self, TestAddRemoveHosts._sf_account_id_should_be_non_zero_int_err_msg)
sf_volumes = sf_util.get_active_sf_volumes(self.sfe, sf_account_id)
sf_volume = sf_util.check_and_get_sf_volume(sf_volumes, root_volume.name, self)
sf_vag_ids = sf_util.get_vag_ids(self.cs_api, self.cluster.id, primary_storage.id, self)
sf_util.check_vags(sf_volume, sf_vag_ids, self)
host = Host(hosts[0].__dict__)
host_iqn = self._get_host_iqn(host)
all_vags = sf_util.get_all_vags(self.sfe)
host_vag = self._get_host_vag(host_iqn, all_vags)
self.assertTrue(host_vag != None, "The host should be in a VAG.")
host.delete(self.apiClient)
sf_volumes = sf_util.get_active_sf_volumes(self.sfe, sf_account_id)
sf_volume = sf_util.check_and_get_sf_volume(sf_volumes, root_volume.name, self)
sf_util.check_vags(sf_volume, sf_vag_ids, self)
all_vags = sf_util.get_all_vags(self.sfe)
host_vag = self._get_host_vag(host_iqn, all_vags)
self.assertTrue(host_vag == None, "The host should not be in a VAG.")
details = {
TestData.username: "root",
TestData.password: "solidfire",
TestData.url: "http://" + host.ipaddress,
TestData.podId : host.podid,
TestData.zoneId: host.zoneid
}
host = Host.create(
self.apiClient,
self.cluster,
details,
hypervisor=host.hypervisor
)
self.assertTrue(
isinstance(host, Host),
"'host' is not a 'Host'."
)
hosts = list_hosts(self.apiClient, clusterid=self.cluster.id)
unique_vag_ids = self._get_unique_vag_ids(hosts)
self.assertTrue(len(hosts) == len(unique_vag_ids) + 1, "There should be one more host than unique VAG.")