Merge branch 'stable-2.8' into stable-2.9
authorGuido Trotter <ultrotter@google.com>
Thu, 25 Jul 2013 13:40:32 +0000 (15:40 +0200)
committerGuido Trotter <ultrotter@google.com>
Thu, 25 Jul 2013 14:27:16 +0000 (16:27 +0200)
* stable-2.8:
  Update NEWS and version for Ganeti 2.7.1
  Add hvparam to disable VNET_HDR on tap devices
  daemon-util: pass --oknodo at rotate_logs
  Add logrotate example
  daemon-util: provide rotate_logs and rotate_all_logs actions
  Fix permission errors for split users
  Make RAPI export device names and UUIDs

Conflicts:
lib/constants.py: trivial
lib/rapi/rlib2.py: trivial

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

13 files changed:
.gitignore
Makefile.am
NEWS
daemons/daemon-util.in
devel/upload
doc/examples/ganeti.logrotate.in [new file with mode: 0644]
doc/install.rst
lib/constants.py
lib/hypervisor/hv_kvm.py
lib/rapi/rlib2.py
lib/runtime.py
lib/tools/ensure_dirs.py
src/Ganeti/Luxi.hs

index c593b79..0e9b955 100644 (file)
@@ -68,6 +68,7 @@
 /doc/examples/bash_completion-debug
 /doc/examples/ganeti.cron
 /doc/examples/ganeti.initd
+/doc/examples/ganeti.logrotate
 /doc/examples/ganeti-kvm-poweroff.initd
 /doc/examples/ganeti-master-role.ocf
 /doc/examples/ganeti-node-role.ocf
index 6bfa4b8..c359728 100644 (file)
@@ -255,6 +255,7 @@ BUILT_EXAMPLES = \
        doc/examples/ganeti-kvm-poweroff.initd \
        doc/examples/ganeti.cron \
        doc/examples/ganeti.initd \
+       doc/examples/ganeti.logrotate \
        doc/examples/ganeti-master-role.ocf \
        doc/examples/ganeti-node-role.ocf \
        doc/examples/gnt-config-backup \
diff --git a/NEWS b/NEWS
index cb7ef77..7f9766f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -116,6 +116,20 @@ For Python:
 - ``yaml`` library (only for running the QA).
 
 
+Version 2.7.1
+-------------
+
+*(Released Thu, 25 Jul 2013)*
+
+- Add logrotate functionality in daemon-util
+- Add logrotate example file
+- Add missing fields to network queries over rapi
+- Fix network object timestamps
+- Add support for querying network timestamps
+- Fix a typo in the example crontab
+- Fix a documentation typo
+
+
 Version 2.7.0
 -------------
 
index 158eb1a..44c39a9 100644 (file)
@@ -324,6 +324,34 @@ stop_all() {
   done
 }
 
+# SIGHUP a process to force re-opening its logfiles
+rotate_logs() {
+  if [[ "$#" -lt 1 ]]; then
+    echo 'Missing daemon name.' >&2
+    return 1
+  fi
+
+  local name="$1"; shift
+  local pidfile=$(_daemon_pidfile $name)
+  local daemonexec=$(_daemon_executable $name)
+
+  if type -p start-stop-daemon >/dev/null; then
+    start-stop-daemon --stop --signal HUP --quiet \
+      --oknodo --pidfile $pidfile
+  else
+    _ignore_error killproc \
+      -p $pidfile \
+      $daemonexec -HUP
+  fi
+}
+
+# SIGHUP all processes
+rotate_all_logs() {
+  for i in $(list_stop_daemons); do
+    rotate_logs $i
+  done
+}
+
 # Reloads the SSH keys
 reload_ssh_keys() {
   @RPL_SSH_INITD_SCRIPT@ restart
index 8b7051d..da2e4df 100755 (executable)
@@ -100,6 +100,10 @@ PKGLIBDIR="$(echo @PKGLIBDIR@ | $SED)"
 install -D --mode=0755 doc/examples/ganeti.initd \
   "$TXD/$SYSCONFDIR/init.d/ganeti"
 
+[ -f doc/examples/ganeti.logrotate ] && \
+install -D --mode=0755 doc/examples/ganeti.logrotate \
+  "$TXD/$SYSCONFDIR/logrotate.d/ganeti"
+
 [ -f doc/examples/ganeti-master-role.ocf ] && \
 install -D --mode=0755 doc/examples/ganeti-master-role.ocf \
   "$TXD/$LIBDIR/ocf/resource.d/ganeti/ganeti-master-role"
diff --git a/doc/examples/ganeti.logrotate.in b/doc/examples/ganeti.logrotate.in
new file mode 100644 (file)
index 0000000..05b1895
--- /dev/null
@@ -0,0 +1,13 @@
+/var/log/ganeti/*.log {
+        weekly
+        missingok
+        rotate 52
+        notifempty
+        compress
+        delaycompress
+        create 640 root root
+        sharedscripts
+        postrotate
+               @PKGLIBDIR@/daemon-util rotate-all-logs
+        endscript
+}
index d797111..04ea7c0 100644 (file)
@@ -582,7 +582,10 @@ distribution's startup scripts, for example in Debian::
 In order to automatically restart failed instances, you need to setup a
 cron job run the *ganeti-watcher* command. A sample cron file is
 provided in the source at ``doc/examples/ganeti.cron`` and you can copy
-that (eventually altering the path) to ``/etc/cron.d/ganeti``.
+that (eventually altering the path) to ``/etc/cron.d/ganeti``. Finally,
+a sample logrotate snippet is provided in the source at
+``doc/examples/ganeti.logrotate`` and you can copy it to
+``/etc/logrotate.d/ganeti`` to have Ganeti's logs rotated automatically.
 
 What gets installed
 ~~~~~~~~~~~~~~~~~~~
index fe4f88d..0e721ba 100644 (file)
@@ -191,7 +191,7 @@ LAST_DRBD_PORT = 14999
 DAEMONS_LOGBASE = {
   NODED: "node-daemon",
   CONFD: "conf-daemon",
-  LUXID: "query-daemon",
+  LUXID: "luxi-daemon",
   RAPI: "rapi-daemon",
   MASTERD: "master-daemon",
   MOND: "monitoring-daemon",
@@ -959,6 +959,7 @@ HV_KVM_PATH = "kvm_path"
 HV_VIF_TYPE = "vif_type"
 HV_VIF_SCRIPT = "vif_script"
 HV_XEN_CMD = "xen_cmd"
+HV_VNET_HDR = "vnet_hdr"
 
 
 HVS_PARAMETER_TYPES = {
@@ -1031,6 +1032,7 @@ HVS_PARAMETER_TYPES = {
   HV_VIF_TYPE: VTYPE_STRING,
   HV_VIF_SCRIPT: VTYPE_STRING,
   HV_XEN_CMD: VTYPE_STRING,
+  HV_VNET_HDR: VTYPE_BOOL,
   }
 
 HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys())
@@ -2156,6 +2158,7 @@ HVC_DEFAULTS = {
     HV_VGA: "",
     HV_KVM_EXTRA: "",
     HV_KVM_MACHINE_VERSION: "",
+    HV_VNET_HDR: True,
     },
   HT_FAKE: {
     HV_MIGRATION_MODE: HT_MIGRATION_LIVE,
index 4bd8a9e..14c5807 100644 (file)
@@ -529,6 +529,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     constants.HV_VGA: hv_base.NO_CHECK,
     constants.HV_KVM_EXTRA: hv_base.NO_CHECK,
     constants.HV_KVM_MACHINE_VERSION: hv_base.NO_CHECK,
+    constants.HV_VNET_HDR: hv_base.NO_CHECK,
     }
 
   _VIRTIO = "virtio"
@@ -1533,7 +1534,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
           devlist = self._GetKVMOutput(kvm_path, self._KVMOPT_DEVICELIST)
           if self._NEW_VIRTIO_RE.search(devlist):
             nic_model = self._VIRTIO_NET_PCI
-            vnet_hdr = True
+            vnet_hdr = up_hvp[constants.HV_VNET_HDR]
         except errors.HypervisorError, _:
           # Older versions of kvm don't support DEVICE_LIST, but they don't
           # have new virtio syntax either.
index 8fef531..d8d9b8c 100644 (file)
@@ -71,10 +71,11 @@ _COMMON_FIELDS = ["ctime", "mtime", "uuid", "serial_no", "tags"]
 I_FIELDS = ["name", "admin_state", "os",
             "pnode", "snodes",
             "disk_template",
-            "nic.ips", "nic.macs", "nic.modes",
+            "nic.ips", "nic.macs", "nic.modes", "nic.uuids", "nic.names",
             "nic.links", "nic.networks", "nic.networks.names", "nic.bridges",
             "network_port",
-            "disk.sizes", "disk.spindles", "disk_usage",
+            "disk.sizes", "disk.spindles", "disk_usage", "disk.uuids",
+            "disk.names",
             "beparams", "hvparams",
             "oper_state", "oper_ram", "oper_vcpus", "status",
             "custom_hvparams", "custom_beparams", "custom_nicparams",
index c06c493..bb586f1 100644 (file)
@@ -104,6 +104,9 @@ class GetentResolver:
     self.noded_uid = GetUid(constants.NODED_USER, _getpwnam)
     self.noded_gid = GetGid(constants.NODED_GROUP, _getgrnam)
 
+    self.mond_uid = GetUid(constants.MOND_USER, _getpwnam)
+    self.mond_gid = GetGid(constants.MOND_GROUP, _getgrnam)
+
     # Misc Ganeti groups
     self.daemons_gid = GetGid(constants.DAEMONS_GROUP, _getgrnam)
     self.admin_gid = GetGid(constants.ADMIN_GROUP, _getgrnam)
@@ -114,6 +117,7 @@ class GetentResolver:
       self.luxid_uid: constants.LUXID_USER,
       self.rapi_uid: constants.RAPI_USER,
       self.noded_uid: constants.NODED_USER,
+      self.mond_uid: constants.MOND_USER,
       }
 
     self._gid2group = {
@@ -122,6 +126,7 @@ class GetentResolver:
       self.luxid_gid: constants.LUXID_GROUP,
       self.rapi_gid: constants.RAPI_GROUP,
       self.noded_gid: constants.NODED_GROUP,
+      self.mond_gid: constants.MOND_GROUP,
       self.daemons_gid: constants.DAEMONS_GROUP,
       self.admin_gid: constants.ADMIN_GROUP,
       }
index f0a4425..c173f43 100644 (file)
@@ -122,7 +122,9 @@ def GetPaths():
   masterd_log = constants.DAEMONS_LOGFILES[constants.MASTERD]
   noded_log = constants.DAEMONS_LOGFILES[constants.NODED]
   confd_log = constants.DAEMONS_LOGFILES[constants.CONFD]
+  luxid_log = constants.DAEMONS_LOGFILES[constants.LUXID]
   rapi_log = constants.DAEMONS_LOGFILES[constants.RAPI]
+  mond_log = constants.DAEMONS_LOGFILES[constants.MOND]
 
   rapi_dir = os.path.join(pathutils.DATA_DIR, "rapi")
   cleaner_log_dir = os.path.join(pathutils.LOG_DIR, "cleaner")
@@ -194,8 +196,10 @@ def GetPaths():
     (pathutils.LOG_DIR, DIR, 0770, getent.masterd_uid, getent.daemons_gid),
     (masterd_log, FILE, 0600, getent.masterd_uid, getent.masterd_gid, False),
     (confd_log, FILE, 0600, getent.confd_uid, getent.masterd_gid, False),
+    (luxid_log, FILE, 0600, getent.luxid_uid, getent.masterd_gid, False),
     (noded_log, FILE, 0600, getent.noded_uid, getent.masterd_gid, False),
     (rapi_log, FILE, 0600, getent.rapi_uid, getent.masterd_gid, False),
+    (mond_log, FILE, 0600, getent.mond_uid, getent.masterd_gid, False),
     (pathutils.LOG_OS_DIR, DIR, 0750, getent.noded_uid, getent.daemons_gid),
     (pathutils.LOG_XEN_DIR, DIR, 0750, getent.noded_uid, getent.daemons_gid),
     (cleaner_log_dir, DIR, 0750, getent.noded_uid, getent.noded_gid),
index b0c8b8f..ecad598 100644 (file)
@@ -228,7 +228,7 @@ getServer :: Bool -> FilePath -> IO S.Socket
 getServer setOwner path = do
   s <- S.socket S.AF_UNIX S.Stream S.defaultProtocol
   S.bindSocket s (S.SockAddrUnix path)
-  when setOwner . setOwnerAndGroupFromNames path GanetiConfd $
+  when setOwner . setOwnerAndGroupFromNames path GanetiLuxid $
     ExtraGroup DaemonsGroup
   S.listen s 5 -- 5 is the max backlog
   return s