Пример #1
0
 /*
  * storage_plugin_getFileInfo, <class
  * 'agent.api.storageplugin.StoragePlugin'> argument: impl_name - default:
  * None
  */
 public FileProperties storagePluginGetFileInfo(String poolUuid, String host, String file)
     throws Ovm3ResourceException {
   /* file path is the full path */
   String uuid = deDash(poolUuid);
   StorageServer ss = new StorageServer();
   StorageDetails sd = new StorageDetails();
   FileProperties fp = new FileProperties();
   ss.setUuid(uuid);
   ss.setAccessHost(host);
   sd.setUuid(poolUuid);
   sd.setDetailsRelationalUuid(uuid);
   sd.setState(1);
   fp.setName(file);
   fp.setProperties(
       (HashMap<String, Object>)
           callWrapper(
               "storage_plugin_getFileInfo",
               getPluginType,
               ss.getDetails(),
               sd.getDetails(),
               fp.getProperties()));
   if ("".equals(fp.getName())) {
     throw new Ovm3ResourceException("Unable to get file info for " + file);
   }
   return fp;
 }
Пример #2
0
 /*
  * now only for files
  * storage_plugin_create, <class
  * 'agent.api.storageplugin.StoragePlugin'> argument: impl_name - default:
  * None - calls resize secretly.. after "create"
  */
 public FileProperties storagePluginCreate(
     String poolUuid, String host, String file, Long size, Boolean dir)
     throws Ovm3ResourceException {
   /* this is correct ordering stuff and correct naming!!! */
   String uuid = deDash(poolUuid);
   StorageServer ss = new StorageServer();
   StorageDetails sd = new StorageDetails();
   FileProperties fp = new FileProperties();
   ss.setUuid(uuid);
   ss.setStorageType(FILESYS);
   ss.setAccessHost(host);
   sd.setUuid(poolUuid);
   sd.setDetailsRelationalUuid(uuid);
   sd.setState(2);
   String type = "File";
   if (dir) {
     type = "Directory";
   }
   fp.setProperties(
       (HashMap<String, Object>)
           callWrapper(
               "storage_plugin_create",
               getPluginType,
               ss.getDetails(),
               sd.getDetails(),
               file,
               type,
               size));
   return fp;
 }
Пример #3
0
 /*
  * INFO: is used for files and dirs..., we only implement files for now...
  * storage_plugin_destroy, <class 'agent.api.storageplugin.StoragePlugin'>
  * argument: impl_name - default: None
  */
 public Boolean storagePluginDestroy(String poolUuid, String file) throws Ovm3ResourceException {
   String uuid = deDash(poolUuid);
   StorageServer ss = new StorageServer();
   StorageDetails sd = new StorageDetails();
   FileProperties fp = new FileProperties();
   ss.setUuid(uuid);
   sd.setDetailsRelationalUuid(uuid);
   sd.setUuid(poolUuid);
   fp.setType("file");
   fp.setUuid(poolUuid);
   fp.setName(file);
   return nullIsTrueCallWrapper(
       "storage_plugin_destroy",
       getPluginType,
       ss.getDetails(),
       sd.getDetails(),
       fp.getProperties());
 }