File tree Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Expand file tree Collapse file tree 1 file changed +4
-15
lines changed Original file line number Diff line number Diff line change @@ -62,25 +62,14 @@ func (d *Domain) Close() error {
62
62
63
63
// Commands returns all QMP commands supported by the domain.
64
64
func (d * Domain ) Commands () ([]string , error ) {
65
- raw , err := d .Run (qmp. Command { Execute : "query-commands" } )
65
+ commands , err := d .rm . QueryCommands ( )
66
66
if err != nil {
67
67
return nil , err
68
68
}
69
-
70
- var response struct {
71
- ID string `json:"id"`
72
- Return []struct {
73
- Name string `json:"name"`
74
- } `json:"return"`
75
- }
76
-
77
- if err = json .Unmarshal (raw , & response ); err != nil {
78
- return nil , err
79
- }
80
-
69
+
81
70
// flatten response
82
- cmds := make ([]string , 0 , len (response . Return ))
83
- for _ , c := range response . Return {
71
+ cmds := make ([]string , 0 , len (commands ))
72
+ for _ , c := range commands {
84
73
cmds = append (cmds , c .Name )
85
74
}
86
75
You can’t perform that action at this time.
0 commit comments