XMLRPC: Add method for listing domain with states
authorMichal Novotny <minovotn@redhat.com>
Mon, 8 Oct 2012 17:58:00 +0000 (19:58 +0200)
committerMichal Novotny <minovotn@redhat.com>
Mon, 8 Oct 2012 17:58:00 +0000 (19:58 +0200)
Signed-off-by: Michal Novotny <minovotn@redhat.com>

classes/libvirt-domain.php

index 25854a9..ab755e2 100644 (file)
                        $ret['state'] = $lv->domain_state_translate($ret['state']);
                        return $ret;
                }
+
+               function rpc_list_state($idUser, $lv, $ret) {
+                       $tmp = $lv->get_domains();
+
+                       $ret = array();
+                       for ($i = 0; $i < sizeof($tmp); $i++) {
+                               $tmp2 = $lv->domain_get_info_call($tmp[$i]);
+                               $state = $lv->domain_state_translate($tmp2[$tmp[$i]]['state']);
+
+                               $ret[] = $tmp[$i].' ('.$state.')';
+                       }
+
+                       return $ret;
+               }
        }
 ?>