Exemple #1
0
 def _check_if_tmp_folder_exists():
     # Copy the contents of the VM that were there just before the
     # snapshot was taken
     ds_ref_ret = vim_util.get_dynamic_property(self._session._get_vim(), vm_ref, "VirtualMachine", "datastore")
     if not ds_ref_ret:
         raise exception.DatastoreNotFound()
     ds_ref = ds_ref_ret.ManagedObjectReference[0]
     ds_browser = vim_util.get_dynamic_property(self._session._get_vim(), ds_ref, "Datastore", "browser")
     # Check if the vmware-tmp folder exists or not. If not, create one
     tmp_folder_path = vm_util.build_datastore_path(datastore_name, "vmware-tmp")
     if not self._path_exists(ds_browser, tmp_folder_path):
         self._mkdir(vm_util.build_datastore_path(datastore_name, "vmware-tmp"))
Exemple #2
0
 def test_get_dynamic_properties_missing_path_exists(self):
     self.useFixture(fixtures.MonkeyPatch(
             'nova.virt.vmwareapi.vim_util.get_object_properties',
             _fake_get_object_properties_missing))
     res = vim_util.get_dynamic_property('fake-vim', 'fake-obj',
                                         'fake-type', 'fake-property')
     self.assertIsNone(res)
Exemple #3
0
 def _get_ds_browser(self, ds_ref):
     ds_browser = self._ds_browser.get(ds_ref.value)
     if not ds_browser:
         ds_browser = vim_util.get_dynamic_property(
             self._session._get_vim(), ds_ref, "Datastore", "browser")
         self._ds_browser[ds_ref.value] = ds_browser
     return ds_browser
Exemple #4
0
 def _get_ds_browser(self, ds_ref):
     ds_browser = self._ds_browser.get(ds_ref)
     if not ds_browser:
         ds_browser = vim_util.get_dynamic_property(
                 self._session._get_vim(), ds_ref,
                 "Datastore", "browser")
         self._ds_browser[ds_ref] = ds_browser
     return ds_browser
Exemple #5
0
 def _check_if_tmp_folder_exists():
     # Copy the contents of the VM that were there just before the
     # snapshot was taken
     ds_ref_ret = vim_util.get_dynamic_property(
         self._session._get_vim(), vm_ref, "VirtualMachine",
         "datastore")
     if not ds_ref_ret:
         raise exception.DatastoreNotFound()
     ds_ref = ds_ref_ret.ManagedObjectReference[0]
     ds_browser = vim_util.get_dynamic_property(
         self._session._get_vim(), ds_ref, "Datastore", "browser")
     # Check if the vmware-tmp folder exists or not. If not, create one
     tmp_folder_path = vm_util.build_datastore_path(
         datastore_name, "vmware-tmp")
     if not self._path_exists(ds_browser, tmp_folder_path):
         self._mkdir(
             vm_util.build_datastore_path(datastore_name, "vmware-tmp"))
Exemple #6
0
 def test_get_dynamic_properties_missing_path_exists(self):
     self.useFixture(
         fixtures.MonkeyPatch(
             'nova.virt.vmwareapi.vim_util.get_object_properties',
             _fake_get_object_properties_missing))
     res = vim_util.get_dynamic_property('fake-vim', 'fake-obj',
                                         'fake-type', 'fake-property')
     self.assertIsNone(res)
Exemple #7
0
 def test_get_dynamic_properties_missing(self):
     self.useFixture(
         fixtures.MonkeyPatch("nova.virt.vmwareapi.vim_util.get_object_properties", _fake_get_object_properties)
     )
     res = vim_util.get_dynamic_property("fake-vim", "fake-obj", "fake-type", "fake-property")
     self.assertIsNone(res)