[libvirt] [PATCH 13/13] virsh: Move command group definition into its own file

Martin Kletzander mkletzan at redhat.com
Wed Jul 25 16:06:52 UTC 2012


On 07/24/2012 11:18 AM, Osier Yang wrote:
> * virsh-domain-monitor.c: Add domMonitoringCmds
> * virsh-domain.c: Add domManagementCmds
> * virsh-host.c: Add hostAndHypervisorCmds
> * virsh-interface.c: Add ifaceCmds
> * virsh-network.c: Add networkCmds
> * virsh-nodedev.c: Add nodedevCmds
> * virsh-nwfilter.c: Add nwfilterCmds
> * virsh-pool.c: Add storagePoolCmds
> * virsh-secret.c: Add secretCmds
> * virsh-snapshot.c: Add snapshotCmds
> * virsh-volume.c: Add storageVolCmds
> * virsh.c: Remove all the above *Cmds.
> ---
>  tools/virsh-domain-monitor.c |   16 ++
>  tools/virsh-domain.c         |   95 +++++++++++++
>  tools/virsh-host.c           |   19 +++
>  tools/virsh-interface.c      |   32 ++++
>  tools/virsh-network.c        |   22 +++
>  tools/virsh-nodedev.c        |   19 +++
>  tools/virsh-nwfilter.c       |   14 ++
>  tools/virsh-pool.c           |   27 ++++
>  tools/virsh-secret.c         |   15 ++
>  tools/virsh-snapshot.c       |   24 +++
>  tools/virsh-volume.c         |   22 +++
>  tools/virsh.c                |  320 +-----------------------------------------
>  12 files changed, 307 insertions(+), 318 deletions(-)
> 

This patch is ok, but for the whole series together there are few more
things I've found out (thanks to syntax-check, mostly):
 - 'virsh-snapshot.c' file should be listed under the same exception as
     'virsh-domain-monitor.c' in 'cfg.mk'
 - All new files are missing a dot after 'Inc' in the copyright
 - All new files need to be added to 'po/POTFILES.in'
 - All new files should be added in the exception for 'require_config_h'
     and 'require_config_h_first'
 - tools/virsh.c should not have 'intprops.h' included, but
     'virsh-domain-monitor.c' should (we really need to refactor this in
     the future =) )

I attached a trivial patch that fixes all of that in case you want to
use that (maybe 'rebase -i' with 'add -p' would ease the pain).

ACK with the changes from the attached fixup implemented.

Martin
-------------- next part --------------
>From 1d4a4cf1b117911cc3d0693984410a46a9dcd90c Mon Sep 17 00:00:00 2001
Message-Id: <1d4a4cf1b117911cc3d0693984410a46a9dcd90c.1343231993.git.mkletzan at redhat.com>
From: Martin Kletzander <mkletzan at redhat.com>
Date: Wed, 25 Jul 2012 17:59:45 +0200
Subject: [PATCH] fixup

---
 cfg.mk                       |    7 ++++---
 po/POTFILES.in               |   11 +++++++++++
 tools/virsh-domain-monitor.c |    4 +++-
 tools/virsh-domain.c         |    2 +-
 tools/virsh-host.c           |    2 +-
 tools/virsh-interface.c      |    2 +-
 tools/virsh-network.c        |    2 +-
 tools/virsh-nodedev.c        |    2 +-
 tools/virsh-nwfilter.c       |    2 +-
 tools/virsh-pool.c           |    2 +-
 tools/virsh-secret.c         |    2 +-
 tools/virsh-snapshot.c       |    2 +-
 tools/virsh-volume.c         |    2 +-
 tools/virsh.c                |    1 -
 14 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 39d19b4..1c1e5e9 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -704,7 +704,7 @@ $(srcdir)/src/remote/remote_client_bodies.h: $(srcdir)/src/remote/remote_protoco
 	$(MAKE) -C src remote/remote_client_bodies.h

 # List all syntax-check exemptions:
-exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.c$$
+exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh(-domain-monitor|-snapshot)?\.c$$

 _src1=libvirt|fdstream|qemu/qemu_monitor|util/(command|util)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller
 exclude_file_name_regexp--sc_avoid_write = \
@@ -773,9 +773,10 @@ exclude_file_name_regexp--sc_prohibit_xmlURI = ^src/util/viruri\.c$$

 exclude_file_name_regexp--sc_prohibit_return_as_function = \.py$$

-exclude_file_name_regexp--sc_require_config_h = ^(examples/|tools/virsh-edit.c$$)
+_virsh_includes = (domain|domain-monitor|edit|host|interface|network|nodedev|nwfilter|pool|secret|snapshot|volume)
+exclude_file_name_regexp--sc_require_config_h = ^(examples/|tools/virsh-$(_virsh_includes).c$$)

-exclude_file_name_regexp--sc_require_config_h_first = ^(examples/|tools/virsh-edit.c$$)
+exclude_file_name_regexp--sc_require_config_h_first = ^(examples/|tools/virsh-$(_virsh_includes).c$$)

 exclude_file_name_regexp--sc_trailing_blank = \
   (/qemuhelpdata/|\.(fig|gif|ico|png)$$)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7587c61..0f32918 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -177,7 +177,18 @@ src/xenxs/xen_xm.c
 tools/console.c
 tools/libvirt-guests.init.sh
 tools/virsh.c
+tools/virsh-domain-monitor.c
+tools/virsh-domain.c
 tools/virsh-edit.c
+tools/virsh-host.c
+tools/virsh-interface.c
+tools/virsh-network.c
+tools/virsh-nodedev.c
+tools/virsh-nwfilter.c
+tools/virsh-pool.c
+tools/virsh-secret.c
+tools/virsh-snapshot.c
+tools/virsh-volume.c
 tools/virt-host-validate-common.c
 tools/virt-host-validate-lxc.c
 tools/virt-host-validate-qemu.c
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 249ff13..b318aba 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -1,7 +1,7 @@
 /*
  * virsh-domain.c: Commands to monitor domain status
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,8 @@
  *
  */

+#include "intprops.h"
+
 static const char *
 vshDomainIOErrorToString(int error)
 {
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 6da4f46..d79c47e 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1,7 +1,7 @@
 /*
  * virsh-domain.c: Commands to manage domain
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 298fb2a..52e8252 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -1,7 +1,7 @@
 /*
  * virsh-host.c: Commands in "Host and Hypervisor" group.
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index 8c116c8..12019b4 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -1,7 +1,7 @@
 /*
  * virsh-interface.c: Commands to manage host interface
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index f5df891..69a766d 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -1,7 +1,7 @@
 /*
  * virsh-network.c: Commands to manage network
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index ecff0d7..5a0987d 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -1,7 +1,7 @@
 /*
  * virsh-nodedev.c: Commands in node device group
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index 1fbe253..e937b63 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -1,7 +1,7 @@
 /*
  * virsh-domain.c: Commands to manage network filters
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 6c8e0a3..ccd9b79 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -1,7 +1,7 @@
 /*
  * virsh-pool.c: Commands to manage storage pool
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 6cbc635..39cbd74 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -1,7 +1,7 @@
 /*
  * virsh-domain.c: Commands to manage secret
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 819e7b3..9182c9a 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -1,7 +1,7 @@
 /*
  * virsh-domain.c: Commands to manage domain snapshot
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 39ba59a..5e5d925 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -1,7 +1,7 @@
 /*
  * virsh-volume.c: Commands to manage storage volume
  *
- * Copyright (C) 2005, 2007-2012 Red Hat, Inc
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tools/virsh.c b/tools/virsh.c
index 8840460..5658796 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -64,7 +64,6 @@
 #include "util/bitmap.h"
 #include "conf/domain_conf.h"
 #include "virtypedparam.h"
-#include "intprops.h"
 #include "conf/virdomainlist.h"

 static char *progname;
-- 
1.7.8.6



More information about the libvir-list mailing list