Revision 493d48ce src/vmm_mad/remotes/lib/vcenter_driver/datastore.rb

View differences:

src/vmm_mad/remotes/lib/vcenter_driver/datastore.rb
177 177
        end
178 178
    end
179 179

  
180
    def rm_directory(directory)
181
        ds_name = self['name']
182

  
183
        rm_directory_params = {
184
            :name                     => "[#{ds_name}] #{directory}",
185
            :datacenter               => get_dc.item
186
        }
187

  
188
        get_fm.DeleteDatastoreFile_Task(rm_directory_params)
189
    end
190

  
191
    def dir_empty?(path)
192
        ds_name = self['name']
193

  
194
        spec = RbVmomi::VIM::HostDatastoreBrowserSearchSpec.new
195

  
196
        search_params = {
197
            'datastorePath' => "[#{ds_name}] #{path}",
198
            'searchSpec'    => spec
199
        }
200

  
201
        ls = self['browser'].SearchDatastoreSubFolders_Task(search_params)
202

  
203
        ls.info.result && ls.info.result.length == 1  && \
204
                ls.info.result.first.file.length == 0
205
    end
206

  
180 207
    def upload_file(source_path, target_path)
181 208
        @item.upload(target_path, source_path)
182 209
    end

Also available in: Unified diff