Destroy virdomainlist.[ch]

As the consensus in:
https://www.redhat.com/archives/libvir-list/2012-July/msg01692.html,
this patch is to destroy conf/virdomainlist.[ch], folding the
helpers into conf/domain_conf.[ch].

* src/Makefile.am:
  - Various indention fixes incidentally
  - Add macro DATATYPES_SOURCES (datatypes.[ch])
  - Link datatypes.[ch] for libvirt_lxc

* src/conf/domain_conf.c:
  - Move all the stuffs from virdomainlist.c into it
  - Use virUnrefDomain and virUnrefDomainSnapshot instead of
    virDomainFree and virDomainSnapshotFree, which are defined
    in libvirt.c, and we don't want to link to it.
  - Remove "if" before "free" the object, as virObjectUnref
    is in the list "useless_free_options".

* src/conf/domain_conf.h:
  - Move all the stuffs from virdomainlist.h into it
  - s/LIST_FILTER/LIST_DOMAINS_FILTER/

* src/libxl/libxl_driver.c:
  - s/LIST_FILTER/LIST_DOMAINS_FILTER/
  - no (include "virdomainlist.h")

* src/libxl/libxl_driver.c: Likewise

* src/lxc/lxc_driver.c: Likewise

* src/openvz/openvz_driver.c: Likewise

* src/parallels/parallels_driver.c: Likewise

* src/qemu/qemu_driver.c: Likewise

* src/test/test_driver.c: Likewise

* src/uml/uml_driver.c: Likewise

* src/vbox/vbox_tmpl.c: Likewise

* src/vmware/vmware_driver.c: Likewise

* tools/virsh-domain-monitor.c: Likewise

* tools/virsh.c: Likewise
This commit is contained in:
Osier Yang
2012-08-03 23:48:05 +08:00
parent 43bfa23e6f
commit bb705e2519
16 changed files with 320 additions and 401 deletions

View File

@@ -1365,7 +1365,7 @@ fallback:
vshResetLibvirtError();
/* list active domains, if necessary */
if (!MATCH(VIR_CONNECT_LIST_FILTERS_ACTIVE) ||
if (!MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE) ||
MATCH(VIR_CONNECT_LIST_DOMAINS_ACTIVE)) {
if ((nids = virConnectNumOfDomains(ctl->conn)) < 0) {
vshError(ctl, "%s", _("Failed to list active domains"));
@@ -1382,7 +1382,7 @@ fallback:
}
}
if (!MATCH(VIR_CONNECT_LIST_FILTERS_ACTIVE) ||
if (!MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_ACTIVE) ||
MATCH(VIR_CONNECT_LIST_DOMAINS_INACTIVE)) {
if ((nnames = virConnectNumOfDefinedDomains(ctl->conn)) < 0) {
vshError(ctl, "%s", _("Failed to list inactive domains"));
@@ -1426,7 +1426,7 @@ filter:
dom = list->domains[i];
/* persistence filter */
if (MATCH(VIR_CONNECT_LIST_FILTERS_PERSISTENT)) {
if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_PERSISTENT)) {
if ((persistent = virDomainIsPersistent(dom)) < 0) {
vshError(ctl, "%s", _("Failed to get domain persistence info"));
goto cleanup;
@@ -1438,7 +1438,7 @@ filter:
}
/* domain state filter */
if (MATCH(VIR_CONNECT_LIST_FILTERS_STATE)) {
if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_STATE)) {
if (virDomainGetState(dom, &state, NULL, 0) < 0) {
vshError(ctl, "%s", _("Failed to get domain state"));
goto cleanup;
@@ -1458,7 +1458,7 @@ filter:
}
/* autostart filter */
if (MATCH(VIR_CONNECT_LIST_FILTERS_AUTOSTART)) {
if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_AUTOSTART)) {
if (virDomainGetAutostart(dom, &autostart) < 0) {
vshError(ctl, "%s", _("Failed to get domain autostart state"));
goto cleanup;
@@ -1470,7 +1470,7 @@ filter:
}
/* managed save filter */
if (MATCH(VIR_CONNECT_LIST_FILTERS_MANAGEDSAVE)) {
if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_MANAGEDSAVE)) {
if ((mansave = virDomainHasManagedSaveImage(dom, 0)) < 0) {
vshError(ctl, "%s",
_("Failed to check for managed save image"));
@@ -1483,7 +1483,7 @@ filter:
}
/* snapshot filter */
if (MATCH(VIR_CONNECT_LIST_FILTERS_SNAPSHOT)) {
if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_SNAPSHOT)) {
if ((nsnap = virDomainSnapshotNum(dom, 0)) < 0) {
vshError(ctl, "%s", _("Failed to get snapshot count"));
goto cleanup;