fog / fog-xenserver

Module for the 'fog' gem to support XENSERVER
MIT License
16 stars 22 forks source link

Add support for events API #58

Closed fernandes closed 8 years ago

fernandes commented 8 years ago

This is the documentation for event API

http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=event

Usage

conn.event.register(["*"])
conn.event.next # next blocks waiting for next event

actually is returning a hash with event details, example, if someone trigger a SR.scan, the event is

=> {"id"=>"433",
 "timestamp"=>"1463421721.",
 "class"=>"task",
 "operation"=>"add",
 "ref"=>"OpaqueRef:0255a381-414b-a583-ff20-3d58a96e219b",
 "snapshot"=>
  {"uuid"=>"386bd667-2713-9d09-6ce0-4c5602254b67",
   "name_label"=>"SR.scan",
   "name_description"=>"",
   "allowed_operations"=>[],
   "current_operations"=>{},
   "created"=>#<XMLRPC::DateTime:0x007fd91f3086a8 @day=16, @hour=18, @min=2, @month=5, @sec=1, @year=2016>,
   "finished"=>#<XMLRPC::DateTime:0x007fd9176376d8 @day=1, @hour=0, @min=0, @month=1, @sec=0, @year=1970>,
   "status"=>"pending",
   "resident_on"=>"OpaqueRef:7f39cd64-a08b-042a-1bed-244e519bd2f3",
   "progress"=>0.0,
   "type"=>"<none/>",
   "result"=>"",
   "error_info"=>[],
   "other_config"=>{},
   "subtask_of"=>"OpaqueRef:NULL",
   "subtasks"=>[]}}
plribeiro3000 commented 8 years ago

@fernandes Can you fix the stylish comments by @houndci-bot ?

Also, would be nice to have some tests at least for the new model Event.

fernandes commented 8 years ago

@plribeiro3000 done!

plribeiro3000 commented 8 years ago

👍

plribeiro3000 commented 8 years ago

@fernandes The build is broken. do you think it is related to this changes?

fernandes commented 8 years ago

no, the eight errors are related to net/http, seems it's trying to connect to a running XenServer instance

seems it's not loading the VCR Cassetes, weird hahaha

[Cassette: 'create_server_get_all_hosts'] Initialized HTTPInteractionList with request matchers [:method, :uri] and 1 interaction(s): { [post http://192.168.10.2/] => [200 "Status"] }

plribeiro3000 commented 8 years ago

It also seems we are having issues with rubygems since is failing to install some gems in the first try. =s

fernandes commented 8 years ago

yeah, it's weird...

build for master https://travis-ci.org/fog/fog-xenserver/branches is also erroring too

plribeiro3000 commented 8 years ago

Yeah. I guess i will create a ticket to look at it later.

plribeiro3000 commented 8 years ago

Thanks for your contribution!

fernandes commented 8 years ago

😎 👍