Beispiel #1
0
 def test_lookup_datastore_host_not_found(self, m_SmartConnectNoSSL):
   vsphere = VsphereVcenter(vcenter_host="fake_vcenter",
                            vcenter_user="******",
                            vcenter_password="******")
   with vsphere:
     with self.assertRaises(CurieTestException) as ar:
       vsphere.lookup_datastore(self.m_vim_cluster,
                                "fake_datastore",
                                "this_is_a_non_existent_host")
   self.assertEqual("Host 'this_is_a_non_existent_host' not found",
                    str(ar.exception))
Beispiel #2
0
 def test_lookup_datastore_does_not_exist(self, m_SmartConnectNoSSL):
   vsphere = VsphereVcenter(vcenter_host="fake_vcenter",
                            vcenter_user="******",
                            vcenter_password="******")
   with vsphere:
     datastore = vsphere.lookup_datastore(self.m_vim_cluster,
                                          "this_is_a_non_existent_datastore")
   self.assertIsNone(datastore)
Beispiel #3
0
 def test_lookup_datastore_mounted_on_all_hosts(self, m_SmartConnectNoSSL):
   vsphere = VsphereVcenter(vcenter_host="fake_vcenter",
                            vcenter_user="******",
                            vcenter_password="******")
   with vsphere:
     datastore = vsphere.lookup_datastore(self.m_vim_cluster,
                                          "fake_datastore")
   self.assertIsInstance(datastore, vim.Datastore)
   self.assertEqual(datastore.name, "fake_datastore")
Beispiel #4
0
 def test_lookup_datastore_not_on_all_hosts(self, m_SmartConnectNoSSL):
   m_some_other_datastore = mock.Mock(spec=vim.Datastore)
   m_some_other_datastore.name = "some_other_datastore"
   self.m_vim_cluster.host[0].datastore = [m_some_other_datastore]
   vsphere = VsphereVcenter(vcenter_host="fake_vcenter",
                            vcenter_user="******",
                            vcenter_password="******")
   with vsphere:
     datastore = vsphere.lookup_datastore(self.m_vim_cluster,
                                          "fake_datastore")
   self.assertIsNone(datastore)