/*
  * 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;
 }
 /*
  * 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;
 }
 /*
  * Should do some input checking of ss and base
  * storage_plugin_getFileSystemInfo,
  * <class 'agent.api.storageplugin.StoragePlugin'> argument: impl_name -
  * default: None requires a minumum of uuid, access_host, storage_type
  * ss_uuid, access_path, uuid (the ss
  */
 public StorageDetails storagePluginGetFileSystemInfo(
     String propUuid, String mntUuid, String nfsHost, String nfsRemotePath)
     throws Ovm3ResourceException {
   /* clean the props */
   StorageServer ss = new StorageServer();
   StorageDetails sd = new StorageDetails();
   new FileProperties();
   ss.setUuid(propUuid);
   sd.setDetailsRelationalUuid(propUuid);
   sd.setUuid(mntUuid);
   ss.setAccessHost(nfsHost);
   if (nfsRemotePath.contains(nfsHost + ":")) {
     sd.setAccessPath(nfsRemotePath);
   } else {
     sd.setAccessPath(nfsHost + ":" + nfsRemotePath);
   }
   ss.setStorageType(FILESYS);
   sd.setDetails(
       (HashMap<String, Object>)
           callWrapper(
               "storage_plugin_getFileSystemInfo",
               getPluginType,
               ss.getDetails(),
               sd.getDetails()));
   return sd;
 }
 /*
  * 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());
 }
 /**
  * . storage_plugin_mount, <class 'agent.api.storageplugin.StoragePlugin'> argument: impl_name -
  * default: None
  */
 public final StorageDetails storagePluginMountNFS(
     String nfsHost, String nfsRemotePath, String mntUuid, String mountPoint)
     throws Ovm3ResourceException {
   String propUuid = deDash(mntUuid);
   StorageServer ss = new StorageServer();
   StorageDetails sd = new StorageDetails();
   ss.setUuid(propUuid);
   ss.setName(propUuid);
   ss.setAccessHost(nfsHost);
   sd.setDetailsRelationalUuid(propUuid);
   sd.setUuid(mntUuid);
   sd.setAccessPath(nfsHost + ":" + nfsRemotePath);
   if (!mountPoint.contains(mntUuid)) {
     mountPoint += "/" + mntUuid;
   }
   sd.setDetails(
       (HashMap<String, Object>)
           callWrapper(
               "storage_plugin_mount",
               getPluginType,
               ss.getDetails(),
               sd.getDetails(),
               mountPoint,
               EMPTY_STRING,
               ACTIVE,
               someList));
   /* this magically means it's already mounted....
    * double check */
   if (sd.getDetails() == null) {
     sd = storagePluginGetFileSystemInfo(propUuid, mntUuid, nfsHost, nfsRemotePath);
   }
   if (EMPTY_STRING.contains(ss.getUuid())) {
     throw new Ovm3ResourceException("Unable to mount NFS FileSystem");
   }
   return sd;
 }
 /**
  * . storage_plugin_unmount, <class 'agent.api.storageplugin.StoragePlugin'> argument: impl_name -
  * default: None
  *
  * @return boolean
  */
 public final Boolean storagePluginUnmountNFS(
     String nfsHost, String remotePath, String mntUuid, String localPath)
     throws Ovm3ResourceException {
   StorageServer ss = new StorageServer();
   StorageDetails sd = new StorageDetails();
   sd.setUuid(mntUuid);
   sd.setDetailsRelationalUuid(deDash(mntUuid));
   ss.setUuid(deDash(mntUuid));
   ss.setAccessHost(nfsHost);
   sd.setAccessPath(nfsHost + ":" + remotePath);
   sd.setState(1);
   ss.setStorageType(FILESYS);
   String mountPoint = localPath + "/" + mntUuid;
   callWrapper(
       "storage_plugin_unmount",
       getPluginType,
       ss.getDetails(),
       sd.getDetails(),
       mountPoint,
       ACTIVE);
   return true;
 }