Module: VSphere::FileManager
- Included in:
- Deltacloud::Drivers::Vsphere::VsphereDriver
- Defined in:
- lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb
Constant Summary collapse
- DIRECTORY_PATH =
"deltacloud"
- MKISOFS_EXECUTABLE =
"mkisofs"
- ISO_SECTORS =
This value is setted in this way because mkisofs man said, less than this amount he have to pad the content of the iso file that mean a limit of 400 kb file since 1 sector of iso file = 2048 bytes
202
Class Method Summary collapse
- .delete_iso!(datastore, file_name) ⇒ Object
- .delete_mapping!(datastore, file_name) ⇒ Object
- .list_mappings(datastore) ⇒ Object
- .load_mapping(datastore, file_name) ⇒ Object
- .store_iso!(datastore, base64_iso, file_name) ⇒ Object
- .store_mapping!(datastore, yaml_object, file_name) ⇒ Object
- .user_data!(datastore, base64_content, file_name) ⇒ Object
Class Method Details
.delete_iso!(datastore, file_name) ⇒ Object
57 58 59 |
# File 'lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb', line 57 def delete_iso!(datastore,file_name) deleteFile(datastore, file_name) end |
.delete_mapping!(datastore, file_name) ⇒ Object
66 67 68 |
# File 'lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb', line 66 def delete_mapping!(datastore, file_name) deleteFile(datastore, file_name) end |
.list_mappings(datastore) ⇒ Object
74 75 76 |
# File 'lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb', line 74 def list_mappings(datastore) listFolder(datastore) end |
.load_mapping(datastore, file_name) ⇒ Object
70 71 72 |
# File 'lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb', line 70 def load_mapping(datastore, file_name) YAML::load(downloadFile(datastore, file_name)) end |
.store_iso!(datastore, base64_iso, file_name) ⇒ Object
40 41 42 43 |
# File 'lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb', line 40 def store_iso!(datastore,base64_iso, file_name) file = StringIO.new(get_plain_iso(base64_iso).read) uploadFile(datastore, file, file_name) end |
.store_mapping!(datastore, yaml_object, file_name) ⇒ Object
61 62 63 64 |
# File 'lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb', line 61 def store_mapping!(datastore, yaml_object, file_name) file = StringIO::new(yaml_object) uploadFile(datastore, file, file_name) end |
.user_data!(datastore, base64_content, file_name) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb', line 45 def user_data!(datastore,base64_content,file_name) command="#{MKISOFS_EXECUTABLE} -stream-file-name deltacloud-user-data.txt -stream-media-size #{ISO_SECTORS}" iso_file='' Open3::popen3(command) do |stdin, stdout, stderr| stdin.write(base64_content.unpack("m")) stdin.close() iso_file=StringIO::new(stdout.read) end uploadFile(datastore,iso_file,file_name) end |