Class: Archipel::Api::Internal::VmXmlMessages
- Inherits:
-
Object
- Object
- Archipel::Api::Internal::VmXmlMessages
- Includes:
- XmlMessages
- Defined in:
- lib/archipel/api/internal/vm_xml_messages.rb
Instance Method Summary collapse
- #autostart(jid, new_state) ⇒ Object
- #create_disk(jid, name, size_gb, format = 'qcow2') ⇒ Object
- #define_vm(jid, params = {}) ⇒ Object
- #force_stop(jid) ⇒ Object
- #grant_permissions(jid, user_jid) ⇒ Object
- #info(jid) ⇒ Object
- #list_disks(jid) ⇒ Object
- #remove_disk(jid, file) ⇒ Object
- #revoke_permissions(jid, user_jid) ⇒ Object
- #start(jid) ⇒ Object
- #stop(jid) ⇒ Object
- #subscribe(jid, user_jid) ⇒ Object
- #xml(jid) ⇒ Object
Instance Method Details
#autostart(jid, new_state) ⇒ Object
57 58 59 60 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 57 def autostart jid, new_state render 'autostart', jid: jid, uuid: uuid_from_jid(jid), new_state: new_state end |
#create_disk(jid, name, size_gb, format = 'qcow2') ⇒ Object
7 8 9 10 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 7 def create_disk jid, name, size_gb, format = 'qcow2' render 'create_disk', jid: jid, uuid: uuid_from_jid(jid), name: name, size: size_gb, format: format end |
#define_vm(jid, params = {}) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 12 def define_vm jid, params = {} params = params.dup uuid = uuid_from_jid jid params.merge! jid: jid, uuid: uuid params.merge! mac: generate_mac unless params.key? :mac if params.key? :ip params[:ips] = [params[:ip]] end params[:vnc_password] = generate_password 50 unless params.key? :vnc_password params[:vnc_port] = -1 unless params.key? :vnc_port render 'define_vm', params end |
#force_stop(jid) ⇒ Object
70 71 72 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 70 def force_stop jid render 'force_stop', jid: jid, uuid: uuid_from_jid(jid) end |
#grant_permissions(jid, user_jid) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 38 def jid, user_jid enabled = %w(settags getavatars setavatar presence message info create shutdown destroy reboot suspend resume xmldesc networkinfo define undefine capabilities nodeinfo network_getnames network_bridges appliance_get appliance_attach appliance_detach appliance_package drives_get oom_getadjust scheduler_jobs scheduler_schedule scheduler_unschedule scheduler_actions vnc_display snapshot_take snapshot_delete snapshot_get snapshot_current snapshot_revert) disabled = %w(all permission_get permission_getown permission_list permission_set permission_setown subscription_add subscription_remove migrate autostart memory setvcpus free xmppserver_users_list xmppserver_users_number oom_setadjust drives_create drives_delete drives_getiso drives_convert drives_rename vmparking_park) render 'grant_permissions', jid: jid, uuid: uuid_from_jid(jid), user_jid: user_jid, enabled_permissions: enabled, disabled_permissions: disabled end |
#info(jid) ⇒ Object
53 54 55 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 53 def info jid render 'info', jid: jid, uuid: uuid_from_jid(jid) end |
#list_disks(jid) ⇒ Object
30 31 32 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 30 def list_disks jid render 'list_disks', uuid: uuid_from_jid(jid) end |
#remove_disk(jid, file) ⇒ Object
34 35 36 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 34 def remove_disk jid, file render 'remove_disk', uuid: uuid_from_jid(jid), file: file end |
#revoke_permissions(jid, user_jid) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 46 def jid, user_jid disabled = %w(settags getavatars setavatar presence message info create shutdown destroy reboot suspend resume xmldesc networkinfo define undefine capabilities nodeinfo network_getnames network_bridges appliance_get appliance_attach appliance_detach appliance_package drives_get oom_getadjust scheduler_jobs scheduler_schedule scheduler_unschedule scheduler_actions vnc_display snapshot_take snapshot_delete snapshot_get snapshot_current snapshot_revert all permission_get permission_getown permission_list permission_set permission_setown subscription_add subscription_remove migrate autostart memory setvcpus free xmppserver_users_list xmppserver_users_number oom_setadjust drives_create drives_delete drives_getiso drives_convert drives_rename vmparking_park) render 'grant_permissions', jid: jid, uuid: uuid_from_jid(jid), user_jid: user_jid, enabled_permissions: [], disabled_permissions: disabled end |
#start(jid) ⇒ Object
62 63 64 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 62 def start jid render 'start', jid: jid, uuid: uuid_from_jid(jid) end |
#stop(jid) ⇒ Object
66 67 68 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 66 def stop jid render 'stop', jid: jid, uuid: uuid_from_jid(jid) end |
#subscribe(jid, user_jid) ⇒ Object
78 79 80 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 78 def subscribe jid, user_jid render 'subscribe', jid: jid, uuid: uuid_from_jid(jid), user_jid: user_jid end |
#xml(jid) ⇒ Object
74 75 76 |
# File 'lib/archipel/api/internal/vm_xml_messages.rb', line 74 def xml jid render 'xml', jid: jid, uuid: uuid_from_jid(jid) end |