Guest User

Untitled

a guest
Sep 21st, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. require 'fog'
  2. require 'pp'
  3.  
  4. conn = Fog::Compute.new({
  5. :provider => 'XenServer',
  6. :xenserver_url => 'xenserver-test',
  7. :xenserver_username => 'root',
  8. :xenserver_password => 'changeme',
  9. })
  10.  
  11.  
  12. # Find a storage repository (SR)
  13. sr = conn.storage_repositories.find { |sr| sr.name == 'Local storage' }
  14.  
  15. # Create a ~17GB VDI in storage repository 'Local Storage'
  16. vdi = conn.vdis.create :name => 'foovdi',
  17. :storage_repository => sr,
  18. :description => 'my foovdi',
  19. :virtual_size => '18589934592' # ~17GB in bytes
  20.  
  21.  
  22. # List all VDIs
  23. conn.vdis.each { |vdi| puts vdi.name }
  24.  
  25. # Destroy the VDI
  26. vdi.destroy
Add Comment
Please, Sign In to add comment