def setUp(self): self.name = vmdk_ops.getVmdkName(path, self.volName) self.policy_names = ['good', 'impossible'] policy_content = ('(("proportionalCapacity" i50) ' '("hostFailuresToTolerate" i0))') for n in self.policy_names: vsan_policy.create(n, policy_content)
def setUp(self): self.name = vmdk_utils.get_vmdk_path(path, self.volName) self.policy_names = ['good', 'impossible'] self.orig_policy_content = ('(("proportionalCapacity" i0) ' '("hostFailuresToTolerate" i0))') self.new_policy_content = '(("hostFailuresToTolerate" i0))' for n in self.policy_names: vsan_policy.create(n, self.orig_policy_content)
def setUp(self): """ Create a bunch of policies """ self.policy_names = ['name1', 'name2', 'name3'] self.policy_content = ('(("proportionalCapacity" i50) ' '("hostFailuresToTolerate" i0))') self.path = vsan_info.get_vsan_datastore().info.url for n in self.policy_names: result = vsan_policy.create(n, self.policy_content) self.assertEquals(None, result, "failed creating policy %s (%s)" % (n, result))
def test_create_list(self): self.assertEqual(None, vsan_policy.create(self.name, self.content)) policies = vsan_policy.get_policies() self.assertTrue(self.content + '\n', policies[self.name])
def test_create_delete(self): self.assertEqual(None, vsan_policy.create(self.name, self.content)) self.assertPoliciesEqual() self.assertEqual(None, vsan_policy.delete(self.name)) self.assertFalse(os.path.isfile(self.policy_path))
def test_double_create_fails(self): self.assertEqual(None, vsan_policy.create(self.name, self.content)) self.assertNotEqual(None, vsan_policy.create(self.name, self.content)) self.assertPoliciesEqual()
def test_create(self): self.assertEqual(None, vsan_policy.create(self.name, self.content)) self.assertPoliciesEqual()
def policy_create(args): output = vsan_policy.create(args.name, args.content) if output: print(output) else: print('Successfully created policy: {0}'.format(args.name))