From 276e520380816da1e03ad5eb38aa0aeec8c6431c Mon Sep 17 00:00:00 2001 From: Liam Hopkins Date: Tue, 21 Jan 2020 10:29:57 -0800 Subject: Configs for new guest agent (#858) * Remove relevant files and configs for legacy python daemons * Add dependency on guest-agent package --- .../packaging/debian/changelog | 7 + .../google-compute-engine/packaging/debian/control | 8 +- .../google-compute-engine/packaging/debian/install | 2 - .../packaging/debian/postinst | 33 --- .../google-compute-engine/packaging/debian/preinst | 28 +-- .../google-compute-engine/packaging/debian/prerm | 28 --- .../google-compute-engine/packaging/debian/rules | 6 +- .../packaging/google-compute-engine-el6.spec | 88 ------- .../packaging/google-compute-engine.el6.spec | 70 ++++++ .../packaging/google-compute-engine.spec | 69 ++--- .../google-compute-engine/packaging/setup_deb.sh | 2 +- .../google-compute-engine/packaging/setup_rpm.sh | 2 +- .../src/etc/init/google-accounts-daemon.conf | 6 - .../src/etc/init/google-clock-skew-daemon.conf | 5 - .../src/etc/init/google-instance-setup.conf | 6 - .../src/etc/init/google-network-daemon.conf | 5 - .../src/etc/init/google-shutdown-scripts.conf | 5 - .../src/etc/init/google-startup-scripts.conf | 4 - .../system-preset/90-google-compute-engine.preset | 6 - .../systemd/system/google-accounts-daemon.service | 13 - .../system/google-clock-skew-daemon.service | 11 - .../systemd/system/google-instance-setup.service | 13 - .../systemd/system/google-network-daemon.service | 13 - .../systemd/system/google-shutdown-scripts.service | 15 -- .../systemd/system/google-startup-scripts.service | 14 -- .../packaging/debian/changelog | 278 --------------------- .../packaging/debian/compat | 1 - .../packaging/debian/control | 38 --- .../packaging/debian/copyright | 27 -- .../packaging/debian/rules | 18 -- .../packaging/python-google-compute-engine.spec | 55 ---- .../packaging/python3-google-compute-engine.spec | 48 ---- .../packaging/setup_deb.sh | 44 ---- .../packaging/setup_rpm.sh | 46 ---- packages/python-google-compute-engine/setup.py | 17 +- 35 files changed, 116 insertions(+), 915 deletions(-) delete mode 100644 packages/google-compute-engine/packaging/debian/postinst mode change 100644 => 100755 packages/google-compute-engine/packaging/debian/preinst delete mode 100644 packages/google-compute-engine/packaging/debian/prerm delete mode 100644 packages/google-compute-engine/packaging/google-compute-engine-el6.spec create mode 100644 packages/google-compute-engine/packaging/google-compute-engine.el6.spec delete mode 100644 packages/google-compute-engine/src/etc/init/google-accounts-daemon.conf delete mode 100644 packages/google-compute-engine/src/etc/init/google-clock-skew-daemon.conf delete mode 100644 packages/google-compute-engine/src/etc/init/google-instance-setup.conf delete mode 100644 packages/google-compute-engine/src/etc/init/google-network-daemon.conf delete mode 100644 packages/google-compute-engine/src/etc/init/google-shutdown-scripts.conf delete mode 100644 packages/google-compute-engine/src/etc/init/google-startup-scripts.conf delete mode 100644 packages/google-compute-engine/src/lib/systemd/system-preset/90-google-compute-engine.preset delete mode 100644 packages/google-compute-engine/src/lib/systemd/system/google-accounts-daemon.service delete mode 100644 packages/google-compute-engine/src/lib/systemd/system/google-clock-skew-daemon.service delete mode 100644 packages/google-compute-engine/src/lib/systemd/system/google-instance-setup.service delete mode 100644 packages/google-compute-engine/src/lib/systemd/system/google-network-daemon.service delete mode 100644 packages/google-compute-engine/src/lib/systemd/system/google-shutdown-scripts.service delete mode 100644 packages/google-compute-engine/src/lib/systemd/system/google-startup-scripts.service delete mode 100644 packages/python-google-compute-engine/packaging/debian/changelog delete mode 100644 packages/python-google-compute-engine/packaging/debian/compat delete mode 100644 packages/python-google-compute-engine/packaging/debian/control delete mode 100644 packages/python-google-compute-engine/packaging/debian/copyright delete mode 100755 packages/python-google-compute-engine/packaging/debian/rules delete mode 100644 packages/python-google-compute-engine/packaging/python-google-compute-engine.spec delete mode 100644 packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec delete mode 100755 packages/python-google-compute-engine/packaging/setup_deb.sh delete mode 100755 packages/python-google-compute-engine/packaging/setup_rpm.sh diff --git a/packages/google-compute-engine/packaging/debian/changelog b/packages/google-compute-engine/packaging/debian/changelog index 59b0c07..5e31890 100644 --- a/packages/google-compute-engine/packaging/debian/changelog +++ b/packages/google-compute-engine/packaging/debian/changelog @@ -1,3 +1,10 @@ +google-compute-engine (1:20200113.00-g1) stable; urgency=medium + + * Remove python daemon configs. + * Add dependency on guest-agent package. + + -- Google Cloud Team Mon, 13 Jan 2020 13:27:55 -0700 + google-compute-engine (1:20190916.00-g2) stable; urgency=medium * Update dependencies. diff --git a/packages/google-compute-engine/packaging/debian/control b/packages/google-compute-engine/packaging/debian/control index 4b670f0..350c63d 100644 --- a/packages/google-compute-engine/packaging/debian/control +++ b/packages/google-compute-engine/packaging/debian/control @@ -9,10 +9,8 @@ Homepage: https://github.com/GoogleCloudPlatform/compute-image-packages Package: google-compute-engine Architecture: all Depends: google-compute-engine-oslogin, - python-google-compute-engine, - python3-google-compute-engine, - ${misc:Depends}, - systemd + google-guest-agent, + ${misc:Depends} Recommends: rsyslog | system-log-daemon Provides: irqbalance Conflicts: google-compute-engine-jessie, @@ -33,5 +31,5 @@ Replaces: google-compute-engine-jessie, google-compute-daemon, google-startup-scripts Description: Google Compute Engine guest environment. - This package contains scripts, configuration, and systemd init files for + This package contains scripts and configuration files for features specific to the Google Compute Engine cloud environment. diff --git a/packages/google-compute-engine/packaging/debian/install b/packages/google-compute-engine/packaging/debian/install index b436f83..22d4b3d 100644 --- a/packages/google-compute-engine/packaging/debian/install +++ b/packages/google-compute-engine/packaging/debian/install @@ -2,7 +2,5 @@ etc/apt/apt.conf.d/* etc/modprobe.d/* etc/rsyslog.d/* etc/sysctl.d/* -lib/systemd/system/* -lib/systemd/system-preset/* lib/udev/rules.d/* usr/bin/* diff --git a/packages/google-compute-engine/packaging/debian/postinst b/packages/google-compute-engine/packaging/debian/postinst deleted file mode 100644 index c00b76e..0000000 --- a/packages/google-compute-engine/packaging/debian/postinst +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# Copyright 2017 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#DEBHELPER# - -# Service reload or restart. We do not start or restart -# google-shutdown-scripts.service google-startup-scripts.service. -set -e -if [ -d /run/systemd/system ]; then - systemctl --system daemon-reload >/dev/null || true - if [ -n "$2" ]; then - _dh_action=reload-or-restart - else - _dh_action=start - fi - deb-systemd-invoke $_dh_action \ - google-instance-setup.service \ - google-accounts-daemon.service \ - google-clock-skew-daemon.service \ - google-network-daemon.service >/dev/null || true -fi diff --git a/packages/google-compute-engine/packaging/debian/preinst b/packages/google-compute-engine/packaging/debian/preinst old mode 100644 new mode 100755 index 2f04366..f3ce046 --- a/packages/google-compute-engine/packaging/debian/preinst +++ b/packages/google-compute-engine/packaging/debian/preinst @@ -13,20 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -#DEBHELPER# - set -e -if [ -d /run/systemd/system ] ; then - if [ "$1" = upgrade ]; then - # Remove old services if they exist on upgrade. - if [ -f /lib/systemd/system/google-ip-forwarding-daemon.service ]; then - systemctl stop google-ip-forwarding-daemon.service - systemctl disable google-ip-forwarding-daemon.service - fi - - if [ -f /lib/systemd/system/google-network-setup.service ]; then - systemctl stop google-network-setup.service - systemctl disable google-network-setup.service - fi - fi +if [ "$1" = upgrade ]; then + # Remove old services if they exist on upgrade. + for svc in google-ip-forwarding-daemon google-network-setup \ + google-network-daemon google-accounts-daemon google-clock-skew-daemon \ + google-instance-setup; do + if systemctl is-enabled ${svc}.service >/dev/null 2>&1; then + systemctl --no-reload disable ${svc}.service >/dev/null 2>&1 || : + if [ -d /run/systemd/system ]; then + systemctl stop ${svc}.service >/dev/null 2>&1 || : + fi + fi + done + systemdctl daemon-reload >/dev/null 2>&1 || : fi diff --git a/packages/google-compute-engine/packaging/debian/prerm b/packages/google-compute-engine/packaging/debian/prerm deleted file mode 100644 index e8ac50d..0000000 --- a/packages/google-compute-engine/packaging/debian/prerm +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# Copyright 2017 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -#DEBHELPER# - -# Stop all services on remove. -set -e -if [ -d /run/systemd/system ] && [ "$1" = remove ]; then - deb-systemd-invoke stop \ - google-instance-setup.service \ - google-accounts-daemon.service \ - google-clock-skew-daemon.service \ - google-network-daemon.service \ - google-shutdown-scripts.service \ - google-startup-scripts.service >/dev/null -fi diff --git a/packages/google-compute-engine/packaging/debian/rules b/packages/google-compute-engine/packaging/debian/rules index d82bff9..2dd01ce 100755 --- a/packages/google-compute-engine/packaging/debian/rules +++ b/packages/google-compute-engine/packaging/debian/rules @@ -1,7 +1,7 @@ #!/usr/bin/make -f %: - dh $@ --with systemd + dh $@ -override_dh_systemd_start: - # Configured in postinst. +override_dh_install: + dh_install --sourcedir=src diff --git a/packages/google-compute-engine/packaging/google-compute-engine-el6.spec b/packages/google-compute-engine/packaging/google-compute-engine-el6.spec deleted file mode 100644 index 0e8afb1..0000000 --- a/packages/google-compute-engine/packaging/google-compute-engine-el6.spec +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright 2017 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Name: google-compute-engine -Epoch: 1 -Version: %{_version} -Release: g2.el6 -Summary: Google Compute Engine guest environment. -License: ASL 2.0 -Url: https://github.com/GoogleCloudPlatform/compute-image-packages -Source0: %{name}_%{version}.orig.tar.gz -Requires: curl -Requires: google-compute-engine-oslogin -Requires: python-google-compute-engine >= 1:20190916.00 -Requires: rsyslog -# Old packages. -Obsoletes: google-compute-engine-init -Obsoletes: google-config -Obsoletes: google-startup-scripts - -BuildArch: noarch - -# Allow other files in the source that don't end up in the package. -%define _unpackaged_files_terminate_build 0 - -%description -This package contains scripts, configuration, and init files for features -specific to the Google Compute Engine cloud environment. - -%prep -%autosetup - -%install -cp -a src/{etc,usr} %{buildroot} -install -d %{buildroot}/lib/ -cp -a src/lib/udev %{buildroot}/lib -mkdir -p %{buildroot}/etc/dhcp -ln -sf /usr/bin/google_set_hostname %{buildroot}/etc/dhcp/dhclient-exit-hooks - -%files -%defattr(0644,root,root,0755) -%attr(0755,-,-) %{_bindir}/* -%attr(0755,-,-) %{_sbindir}/* -/lib/udev/rules.d/* -/etc/init/*.conf -/etc/dhcp/dhclient-exit-hooks -%config /etc/modprobe.d/* -%config /etc/rsyslog.d/* -%config /etc/sysctl.d/* - -%post -# On upgrade run instance setup again to handle any new configs and restart -# daemons. -if [ $1 -eq 2 ]; then - stop -q -n google-accounts-daemon - stop -q -n google-clock-skew-daemon - stop -q -n google-network-daemon - /usr/bin/google_instance_setup - start -q -n google-accounts-daemon - start -q -n google-clock-skew-daemon - start -q -n google-network-daemon -fi - -if initctl status google-ip-forwarding-daemon | grep -q 'running'; then - stop -q -n google-ip-forwarding-daemon -fi - -%preun -# On uninstall only. -if [ $1 -eq 0 ]; then - stop -q -n google-accounts-daemon - stop -q -n google-clock-skew-daemon - stop -q -n google-network-daemon - if initctl status google-ip-forwarding-daemon | grep -q 'running'; then - stop -q -n google-ip-forwarding-daemon - fi -fi diff --git a/packages/google-compute-engine/packaging/google-compute-engine.el6.spec b/packages/google-compute-engine/packaging/google-compute-engine.el6.spec new file mode 100644 index 0000000..aeb29be --- /dev/null +++ b/packages/google-compute-engine/packaging/google-compute-engine.el6.spec @@ -0,0 +1,70 @@ +# Copyright 2017 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Name: google-compute-engine +Epoch: 1 +Version: %{_version} +Release: g2.el6 +Summary: Google Compute Engine guest environment. +License: ASL 2.0 +Url: https://github.com/GoogleCloudPlatform/compute-image-packages +Source0: %{name}_%{version}.orig.tar.gz +Requires: curl +Requires: google-compute-engine-oslogin +Requires: google-guest-agent +Requires: rsyslog +# Old packages. +Obsoletes: google-compute-engine-init +Obsoletes: google-config +Obsoletes: google-startup-scripts + +BuildArch: noarch + +# Allow other files in the source that don't end up in the package. +%define _unpackaged_files_terminate_build 0 + +%description +This package contains scripts, configuration, and init files for features +specific to the Google Compute Engine cloud environment. + +%prep +%autosetup + +%install +cp -a src/{etc,usr} %{buildroot} +install -d %{buildroot}/lib/ +cp -a src/lib/udev %{buildroot}/lib +mkdir -p %{buildroot}/etc/dhcp +ln -sf /usr/bin/google_set_hostname %{buildroot}/etc/dhcp/dhclient-exit-hooks + +%files +%defattr(0644,root,root,0755) +%attr(0755,-,-) %{_bindir}/* +%attr(0755,-,-) %{_sbindir}/* +/lib/udev/rules.d/* +/etc/dhcp/dhclient-exit-hooks +%config /etc/modprobe.d/* +%config /etc/rsyslog.d/* +%config /etc/sysctl.d/* + +%pre +if [ $1 -gt 1 ] ; then + # This is an upgrade. Stop services previously owned by this package, if any. + for svc in google-ip-forwarding-daemon google-network-setup \ + google-network-daemon google-accounts-daemon google-clock-skew-daemon; do + if initctl status $svc >/dev/null 2>&1; then + initctl stop ${svc} || : + fi + done +fi diff --git a/packages/google-compute-engine/packaging/google-compute-engine.spec b/packages/google-compute-engine/packaging/google-compute-engine.spec index 3f5fcb1..c0833f3 100644 --- a/packages/google-compute-engine/packaging/google-compute-engine.spec +++ b/packages/google-compute-engine/packaging/google-compute-engine.spec @@ -27,15 +27,10 @@ Url: https://github.com/GoogleCloudPlatform/compute-image-packages Source0: %{name}_%{version}.orig.tar.gz Requires: curl Requires: google-compute-engine-oslogin -%if 0%{?rhel} == 8 -Requires: python3-google-compute-engine >= 1:20190916.00 -%else -Requires: python-google-compute-engine >= 1:20190916.00 -%endif +Requires: google-guest-agent Requires: rsyslog BuildArch: noarch -BuildRequires: systemd # Allow other files in the source that don't end up in the package. %define _unpackaged_files_terminate_build 0 @@ -49,9 +44,7 @@ specific to the Google Compute Engine cloud environment. %install cp -a src/{etc,usr} %{buildroot} -install -d %{buildroot}/{%{_unitdir},%{_presetdir},%{_udevrulesdir}} -cp -a src/lib/systemd/system/* %{buildroot}/%{_unitdir} -cp -a src/lib/systemd/system-preset/* %{buildroot}/%{_presetdir} +install -d %{buildroot}/%{_udevrulesdir} cp -a src/lib/udev/rules.d/* %{buildroot}/%{_udevrulesdir} %files @@ -59,52 +52,24 @@ cp -a src/lib/udev/rules.d/* %{buildroot}/%{_udevrulesdir} %attr(0755,-,-) %{_bindir}/* %attr(0755,-,-) /etc/dhcp/dhclient.d/google_hostname.sh %{_udevrulesdir}/* -%{_unitdir}/* -%{_presetdir}/* %config /etc/modprobe.d/* %config /etc/rsyslog.d/* %config /etc/sysctl.d/* -%post -if [ $1 -eq 2 ]; then - # New service might not be enabled during upgrade. - systemctl enable google-network-daemon.service -fi - -# On upgrade run instance setup again to handle any new configs and restart -# daemons. -if [ $1 -eq 2 ]; then - /usr/bin/google_instance_setup - systemctl reload-or-restart google-accounts-daemon.service - systemctl reload-or-restart google-clock-skew-daemon.service - systemctl reload-or-restart google-network-daemon.service +%pre +if [ $1 -gt 1 ] ; then + # This is an upgrade. Stop and disable services previously owned by this + # package, if any. + for svc in google-ip-forwarding-daemon google-network-setup \ + google-network-daemon google-accounts-daemon google-clock-skew-daemon \ + google-instance-setup; do + if systemctl is-enabled ${svc}.service >/dev/null 2>&1; then + systemctl --no-reload disable ${svc}.service >/dev/null 2>&1 || : + if [ -d /run/systemd/system ]; then + systemctl stop ${svc}.service >/dev/null 2>&1 || : + fi + fi + done + systemctl daemon-reload >/dev/null 2>&1 || : fi -%systemd_post google-accounts-daemon.service -%systemd_post google-clock-skew-daemon.service -%systemd_post google-instance-setup.service -%systemd_post google-network-daemon.service -%systemd_post google-shutdown-scripts.service -%systemd_post google-startup-scripts.service - -# Remove old services. -if [ -f /lib/systemd/system/google-ip-forwarding-daemon.service ]; then - systemctl stop --no-block google-ip-forwarding-daemon - systemctl disable google-ip-forwarding-daemon.service -fi - -if [ -f /lib/systemd/system/google-network-setup.service ]; then - systemctl stop --no-block google-network-setup - systemctl disable google-network-setup.service -fi - -%preun -# On uninstall only. -if [ $1 -eq 0 ]; then - %systemd_preun google-accounts-daemon.service - %systemd_preun google-clock-skew-daemon.service - %systemd_preun google-instance-setup.service - %systemd_preun google-network-daemon.service - %systemd_preun google-shutdown-scripts.service - %systemd_preun google-startup-scripts.service -fi diff --git a/packages/google-compute-engine/packaging/setup_deb.sh b/packages/google-compute-engine/packaging/setup_deb.sh index 66c2f30..19b4521 100755 --- a/packages/google-compute-engine/packaging/setup_deb.sh +++ b/packages/google-compute-engine/packaging/setup_deb.sh @@ -14,7 +14,7 @@ # limitations under the License. NAME="google-compute-engine" -VERSION="20190916.00" +VERSION="20200113.00" working_dir=${PWD} if [[ $(basename "$working_dir") != $NAME ]]; then diff --git a/packages/google-compute-engine/packaging/setup_rpm.sh b/packages/google-compute-engine/packaging/setup_rpm.sh index b0590e2..801c9aa 100755 --- a/packages/google-compute-engine/packaging/setup_rpm.sh +++ b/packages/google-compute-engine/packaging/setup_rpm.sh @@ -14,7 +14,7 @@ # limitations under the License. NAME="google-compute-engine" -VERSION="20190916.00" +VERSION="20200113.00" rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION} working_dir=${PWD} diff --git a/packages/google-compute-engine/src/etc/init/google-accounts-daemon.conf b/packages/google-compute-engine/src/etc/init/google-accounts-daemon.conf deleted file mode 100644 index 02a7d65..0000000 --- a/packages/google-compute-engine/src/etc/init/google-accounts-daemon.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Manages accounts from metadata SSH keys. -start on started google-network-daemon -oom -16 - -respawn -exec /usr/bin/google_accounts_daemon diff --git a/packages/google-compute-engine/src/etc/init/google-clock-skew-daemon.conf b/packages/google-compute-engine/src/etc/init/google-clock-skew-daemon.conf deleted file mode 100644 index 05c73ce..0000000 --- a/packages/google-compute-engine/src/etc/init/google-clock-skew-daemon.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Sync the system clock on migration. -start on started google-network-daemon - -respawn -exec /usr/bin/google_clock_skew_daemon diff --git a/packages/google-compute-engine/src/etc/init/google-instance-setup.conf b/packages/google-compute-engine/src/etc/init/google-instance-setup.conf deleted file mode 100644 index 2c7d596..0000000 --- a/packages/google-compute-engine/src/etc/init/google-instance-setup.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Runs instance setup on boot. -start on started rsyslog - -task - -exec /usr/bin/google_instance_setup diff --git a/packages/google-compute-engine/src/etc/init/google-network-daemon.conf b/packages/google-compute-engine/src/etc/init/google-network-daemon.conf deleted file mode 100644 index d2e985a..0000000 --- a/packages/google-compute-engine/src/etc/init/google-network-daemon.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Manages network interfaces. -start on stopped google-instance-setup - -respawn -exec /usr/bin/google_network_daemon diff --git a/packages/google-compute-engine/src/etc/init/google-shutdown-scripts.conf b/packages/google-compute-engine/src/etc/init/google-shutdown-scripts.conf deleted file mode 100644 index b9323a5..0000000 --- a/packages/google-compute-engine/src/etc/init/google-shutdown-scripts.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Runs a shutdown script from metadata. -start on starting rc RUNLEVEL=[06] -task - -exec /usr/bin/google_metadata_script_runner --script-type shutdown diff --git a/packages/google-compute-engine/src/etc/init/google-startup-scripts.conf b/packages/google-compute-engine/src/etc/init/google-startup-scripts.conf deleted file mode 100644 index 664297c..0000000 --- a/packages/google-compute-engine/src/etc/init/google-startup-scripts.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Runs a startup script from metadata. -start on started google-network-daemon and startup - -exec /usr/bin/google_metadata_script_runner --script-type startup diff --git a/packages/google-compute-engine/src/lib/systemd/system-preset/90-google-compute-engine.preset b/packages/google-compute-engine/src/lib/systemd/system-preset/90-google-compute-engine.preset deleted file mode 100644 index b903cb7..0000000 --- a/packages/google-compute-engine/src/lib/systemd/system-preset/90-google-compute-engine.preset +++ /dev/null @@ -1,6 +0,0 @@ -enable google-accounts-daemon.service -enable google-clock-skew-daemon.service -enable google-instance-setup.service -enable google-network-daemon.service -enable google-shutdown-scripts.service -enable google-startup-scripts.service diff --git a/packages/google-compute-engine/src/lib/systemd/system/google-accounts-daemon.service b/packages/google-compute-engine/src/lib/systemd/system/google-accounts-daemon.service deleted file mode 100644 index db627aa..0000000 --- a/packages/google-compute-engine/src/lib/systemd/system/google-accounts-daemon.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Google Compute Engine Accounts Daemon -After=network.target google-instance-setup.service google-network-daemon.service - -[Service] -Type=simple -ExecStart=/usr/bin/google_accounts_daemon -OOMScoreAdjust=-999 -Restart=always -StandardOutput=journal+console - -[Install] -WantedBy=multi-user.target diff --git a/packages/google-compute-engine/src/lib/systemd/system/google-clock-skew-daemon.service b/packages/google-compute-engine/src/lib/systemd/system/google-clock-skew-daemon.service deleted file mode 100644 index 9339116..0000000 --- a/packages/google-compute-engine/src/lib/systemd/system/google-clock-skew-daemon.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Google Compute Engine Clock Skew Daemon -After=network.target google-instance-setup.service google-network-daemon.service - -[Service] -Type=simple -ExecStart=/usr/bin/google_clock_skew_daemon -StandardOutput=journal+console - -[Install] -WantedBy=multi-user.target diff --git a/packages/google-compute-engine/src/lib/systemd/system/google-instance-setup.service b/packages/google-compute-engine/src/lib/systemd/system/google-instance-setup.service deleted file mode 100644 index ee987b2..0000000 --- a/packages/google-compute-engine/src/lib/systemd/system/google-instance-setup.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Google Compute Engine Instance Setup -After=network-online.target network.target rsyslog.service -Before=sshd.service - -[Service] -Type=oneshot -ExecStart=/usr/bin/google_instance_setup -StandardOutput=journal+console - -[Install] -WantedBy=sshd.service -WantedBy=multi-user.target diff --git a/packages/google-compute-engine/src/lib/systemd/system/google-network-daemon.service b/packages/google-compute-engine/src/lib/systemd/system/google-network-daemon.service deleted file mode 100644 index 71745d4..0000000 --- a/packages/google-compute-engine/src/lib/systemd/system/google-network-daemon.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Google Compute Engine Network Daemon -After=network-online.target network.target -After=google-instance-setup.service -PartOf=network.service - -[Service] -Type=simple -ExecStart=/usr/bin/google_network_daemon -StandardOutput=journal+console - -[Install] -WantedBy=multi-user.target diff --git a/packages/google-compute-engine/src/lib/systemd/system/google-shutdown-scripts.service b/packages/google-compute-engine/src/lib/systemd/system/google-shutdown-scripts.service deleted file mode 100644 index ae23d76..0000000 --- a/packages/google-compute-engine/src/lib/systemd/system/google-shutdown-scripts.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=Google Compute Engine Shutdown Scripts -After=network-online.target network.target rsyslog.service -After=google-instance-setup.service google-network-daemon.service - -[Service] -ExecStart=/bin/true -ExecStop=/usr/bin/google_metadata_script_runner --script-type shutdown -Type=oneshot -RemainAfterExit=true -TimeoutStopSec=0 -StandardOutput=journal+console - -[Install] -WantedBy=multi-user.target diff --git a/packages/google-compute-engine/src/lib/systemd/system/google-startup-scripts.service b/packages/google-compute-engine/src/lib/systemd/system/google-startup-scripts.service deleted file mode 100644 index c150693..0000000 --- a/packages/google-compute-engine/src/lib/systemd/system/google-startup-scripts.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Google Compute Engine Startup Scripts -After=network-online.target network.target rsyslog.service -After=google-instance-setup.service google-network-daemon.service -Before=apt-daily.service - -[Service] -ExecStart=/usr/bin/google_metadata_script_runner --script-type startup -KillMode=process -Type=oneshot -StandardOutput=journal+console - -[Install] -WantedBy=multi-user.target diff --git a/packages/python-google-compute-engine/packaging/debian/changelog b/packages/python-google-compute-engine/packaging/debian/changelog deleted file mode 100644 index b4261c2..0000000 --- a/packages/python-google-compute-engine/packaging/debian/changelog +++ /dev/null @@ -1,278 +0,0 @@ -python-google-compute-engine (1:20191210.00-g1) stable; urgency=medium - - * Enable sysctl change for E2 platform. - * Support retry limits in metadata retrieval. - - -- Google Cloud Team Tue, 10 Dec 2019 15:02:59 -0800 - -python-google-compute-engine (1:20191120.00-g1) stable; urgency=medium - - * REVERT: Retry metadata lookups in agent. - - -- Google Cloud Team Wed, 20 Sep 2019 15:28:54 -0700 - -python-google-compute-engine (1:20191115.00-g1) stable; urgency=medium - - * REVERT: Enable sysctl change for E2 platform. - - -- Google Cloud Team Fri, 15 Sep 2019 10:08:24 -0700 - -python-google-compute-engine (1:20191112.00-g1) stable; urgency=medium - - * Enable sysctl change for E2 platform. - * Retry metadata lookups in agent. - * Wait for link-local IPv6 addresses to resolve. - - -- Google Cloud Team Mon, 11 Nov 2019 15:52:24 -0700 - -python-google-compute-engine (1:20190916.00-g1) stable; urgency=medium - - * Revert VM rename feature. - - -- Google Cloud Team Mon, 16 Sep 2019 15:52:24 -0700 - -python-google-compute-engine (1:20190905.00-g1) stable; urgency=medium - - * Fix setup.py version to be compliant with legacy builds. - * Detect hostname changes. - * Use non-numeric project ID in generated boto.cfg for GSUtil. - - -- Google Cloud Team Thu, 05 Sep 2019 11:08:18 -0700 - -python-google-compute-engine (1:20190801.00-g1) stable; urgency=medium - - * Re-enable boto config and drop writing plugin directory. - * Fix metadata script retrieval. - - -- Google Cloud Team Thu, 01 Aug 2019 13:55:46 -0700 - -python-google-compute-engine (1:20190729.00-g1) stable; urgency=medium - - * Support for Google Private Access over IPv6. - - -- Google Cloud Team Mon, 29 Jul 2019 10:09:24 -0700 - -python-google-compute-engine (1:20190708.00-g1) stable; urgency=medium - - * Move Debian entry point scripts to python3. - * Update Debian build dependencies. - * Drop unnecessary build and package dependencies. - - -- Google Cloud Team Mon, 08 Jul 2019 10:20:44 -0700 - -python-google-compute-engine (2.8.16-1) stable; urgency=low - - * Fix guest attributes flow in Python 3. - - -- Google Cloud Team Wed, 22 May 2019 12:00:00 -0700 - -python-google-compute-engine (2.8.15-1) stable; urgency=low - - * Retry download for metadata scripts. - * Fix script retrieval in python3. - * Disable boto config in python3. - * Update SSH host keys in guest attributes. - - -- Google Cloud Team Tue, 21 May 2019 12:00:00 -0700 - -python-google-compute-engine (2.8.14-1) stable; urgency=low - - * FreeBSD fixes: syslog socket location and OS detection. - - -- Google Cloud Team Tue, 16 Apr 2019 12:00:00 -0700 - -python-google-compute-engine (2.8.13-1) stable; urgency=low - - * Fix metadata script retrieval to support Python 3. - - -- Google Cloud Team Thu, 24 Jan 2019 12:00:00 -0700 - -python-google-compute-engine (2.8.12-1) stable; urgency=low - - * Fix two factor enablement on change. - - -- Google Cloud Team Wed, 05 Dec 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.11-1) stable; urgency=low - - * Split up the gpasswd command into two commands. - * Update two factor enablement on change. - - -- Google Cloud Team Tue, 04 Dec 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.10-1) stable; urgency=low - - * Fix the gpasswd command default. - - -- Google Cloud Team Fri, 30 Nov 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.9-1) stable; urgency=low - - * Support enabling OS Login two factor authentication. - * Improve accounts support for FreeBSD. - * Improve SELinux support. - - -- Google Cloud Team Wed, 28 Nov 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.8-1) stable; urgency=low - - * Update sudoer group membership without overriding local groups. - - -- Google Cloud Team Tue, 23 Oct 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.7-1) stable; urgency=low - - * Remove users from sudoers group on removal (fixed). - - -- Google Cloud Team Thu, 18 Oct 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.6-1) stable; urgency=low - - * Revert PR: Remove users from sudoers group on removal. - - -- Google Cloud Team Thu, 11 Oct 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.5-1) stable; urgency=low - - * Remove users from sudoers group on removal. - * Remove gsutil dependency for metadata scripts. - - -- Google Cloud Team Thu, 05 Oct 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.4-1) stable; urgency=low - - * Remove ntp dependency. - * Support Debian 10 Buster. - * Restart the network daemon if networking is restarted. - * Prevent setup of the default ethernet interface. - * Accounts daemon can now verify username is 32 characters or less. - - -- Google Cloud Team Wed, 05 Sep 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.3-1) stable; urgency=low - - * Prevent IP forwarding daemon log spam. - * Make default shell configurable when executing metadata scripts. - * Rename distro directory to distro_lib. - - -- Google Cloud Team Mon, 11 June 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.2-1) stable; urgency=low - - * Prevent delay in configuring IP forwarding routes. - * Improve instance setup support for FreeBSD. - - -- Google Cloud Team Thu, 10 May 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.1-1) stable; urgency=low - - * Improve OS Login disablement. - - -- Google Cloud Team Fri, 04 May 2018 12:00:00 -0700 - -google-compute-image-packages (2.8.0-1) stable; urgency=low - - * Create a new network daemon. - * Refactor the IP forwarding daemon and network setup. - * Improvements for using NSS cache in the accounts daemon. - - -- Google Cloud Team Tue, 01 May 2018 12:00:00 -0700 - -google-compute-image-packages (2.7.7-1) stable; urgency=low - - * Add support for NSS cache in OS Login. - - -- Google Cloud Team Thu, 08 Mar 2018 12:00:00 -0700 - -google-compute-image-packages (2.7.6-1) stable; urgency=low - - * Add distro specific logic. - - -- Google Cloud Team Wed, 21 Feb 2018 12:00:00 -0700 - -google-compute-image-packages (2.7.5-2) stable; urgency=low - - * Fix dependencies for syslog. - - -- Google Cloud Team Tue, 06 Feb 2018 12:00:00 -0700 - -google-compute-image-packages (2.7.5-1) stable; urgency=low - - * Revert hostname setting change in Debian. - - -- Google Cloud Team Mon, 29 Jan 2018 12:00:00 -0700 - -google-compute-image-packages (2.7.4-1) stable; urgency=low - - * Fix hostname setting in Debian. - - -- Google Cloud Team Mon, 29 Jan 2018 12:00:00 -0700 - -google-compute-image-packages (2.7.3-1) stable; urgency=low - - * Improve hostname setting and correctly restart rsyslog. - - -- Google Cloud Team Thu, 25 Jan 2018 12:00:00 -0700 - -google-compute-image-packages (2.7.2-2) stable; urgency=low - - * Force IPv4 for apt. - - -- Google Cloud Team Wed, 13 Dec 2017 12:00:00 -0700 - -google-compute-image-packages (2.7.2-1) stable; urgency=low - - * Generate SSH host keys when none are present. - * Improve logging when activating OS Login. - - -- Google Cloud Team Wed, 29 Nov 2017 12:00:00 -0700 - -google-compute-image-packages (2.7.1-1) stable; urgency=low - - * Update set_hostname file name to prevent conflict. - * Add apt config to prevent auto-removal of google-compute-engine. - - -- Google Cloud Team Wed, 25 Oct 2017 12:00:00 -0700 - -google-compute-image-packages (2.7.0-6) stable; urgency=low - - * Linux guest environment support for OS Login. - - -- Google Cloud Team Tue, 17 Oct 2017 12:00:00 -0700 - -google-compute-image-packages (2.6.2-1) stable; urgency=low - - * Fix system hang during VM shutdown. - - -- Google Cloud Team Fri, 06 Oct 2017 12:00:00 -0700 - -google-compute-image-packages (2.6.1-1) stable; urgency=low - - * Use curl to download metadata script files for SSL certificate validation. - * Use netifaces for retrieving MAC address names if the import exists. - - -- Google Cloud Team Thurs, 14 Sep 2017 12:00:00 -0700 - -google-compute-image-packages (2.6.0-4) stable; urgency=low - - * Fix DHCP exit hook install. - - -- Google Cloud Team Mon, 28 Aug 2017 12:00:00 -0700 - -google-compute-image-packages (2.6.0-3) stable; urgency=low - - * Add systemd preset. - - -- Google Cloud Team Fri, 25 Aug 2017 14:00:00 -0700 - -google-compute-image-packages (2.6.0-2) stable; urgency=low - - * Add DHCP exit hook script back into package. - - -- Google Cloud Team Fri, 25 Aug 2017 12:00:00 -0700 - -google-compute-image-packages (2.6.0-1) stable; urgency=low - - * New packaging. - - -- Google Cloud Team Mon, 27 Jun 2017 12:00:00 -0700 diff --git a/packages/python-google-compute-engine/packaging/debian/compat b/packages/python-google-compute-engine/packaging/debian/compat deleted file mode 100644 index f599e28..0000000 --- a/packages/python-google-compute-engine/packaging/debian/compat +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/packages/python-google-compute-engine/packaging/debian/control b/packages/python-google-compute-engine/packaging/debian/control deleted file mode 100644 index d6491d0..0000000 --- a/packages/python-google-compute-engine/packaging/debian/control +++ /dev/null @@ -1,38 +0,0 @@ -Source: python-google-compute-engine -Section: admin -Priority: optional -Maintainer: Google Cloud Team -Build-Depends: debhelper (>= 10), - dh-python, - python-all, - python-boto, - python-mock, - python-pytest, - python-setuptools, - python3-all, - python3-distro, - python3-pytest, - python3-setuptools -Standards-Version: 3.9.8 -Homepage: https://github.com/GoogleCloudPlatform/compute-image-packages - -Package: python-google-compute-engine -Section: python -Architecture: all -Depends: ${python:Depends}, ${misc:Depends} -Conflicts: google-compute-engine-jessie, - google-compute-engine-stretch, - google-compute-daemon, - google-startup-scripts -Description: Google Compute Engine python library for Python 2.x. - Python libraries used for interacting with Google Compute Engine instance - metadata to provide platform integration. - -Package: python3-google-compute-engine -Section: python -Architecture: all -Depends: ${python3:Depends}, ${misc:Depends}, - python3-distro, python3-pkg-resources, python3:any -Description: Google Compute Engine python library for Python 3.x. - Python libraries used for interacting with Google Compute Engine instance - metadata to provide platform integration. diff --git a/packages/python-google-compute-engine/packaging/debian/copyright b/packages/python-google-compute-engine/packaging/debian/copyright deleted file mode 100644 index 034c729..0000000 --- a/packages/python-google-compute-engine/packaging/debian/copyright +++ /dev/null @@ -1,27 +0,0 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: python-google-compute-engine -Upstream-Contact: gc-team@google.com - -Files: * -Copyright: Copyright 2017 Google Inc. -License: Apache-2.0 - -Files: debian/* -Copyright: Copyright 2017 Google Inc. -License: Apache-2.0 - -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - . - http://www.apache.org/licenses/LICENSE-2.0 - . - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - . - On Debian systems, the complete text of the Apache version 2.0 license - can be found in "/usr/share/common-licenses/Apache-2.0". diff --git a/packages/python-google-compute-engine/packaging/debian/rules b/packages/python-google-compute-engine/packaging/debian/rules deleted file mode 100755 index b7999dd..0000000 --- a/packages/python-google-compute-engine/packaging/debian/rules +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/make -f - -export PYBUILD_NAME=google-compute-engine -export PYBUILD_TEST_PYTEST=1 -export PYBUILD_TEST_ARGS={dir}/google_compute_engine/ -export PYBUILD_SYSTEM=distutils - -%: - dh $@ --with python2,python3 --buildsystem=pybuild - -override_dh_clean: - rm -rf google_compute_engine.egg-info - dh_clean - -override_dh_auto_install: - dh_auto_install - # Remove python2.7 entry points. - rm -Rf debian/python-google-compute-engine/usr/bin diff --git a/packages/python-google-compute-engine/packaging/python-google-compute-engine.spec b/packages/python-google-compute-engine/packaging/python-google-compute-engine.spec deleted file mode 100644 index 1984cec..0000000 --- a/packages/python-google-compute-engine/packaging/python-google-compute-engine.spec +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2017 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Force the dist to be el7 to avoid el7.centos. -%if 0%{?rhel} == 7 - %define dist .el7 -%endif - -Name: python-google-compute-engine -Epoch: 1 -Version: %{_version} -Release: g1%{?dist} -Summary: Google Compute Engine python library -License: ASL 2.0 -Url: https://github.com/GoogleCloudPlatform/compute-image-packages -Source0: %{name}_%{version}.orig.tar.gz - -BuildArch: noarch -BuildRequires: python2-devel python-setuptools python-boto - -Requires: python-boto python-setuptools - -Provides: python2-google-compute-engine - -Obsoletes: google-compute-daemon -Obsoletes: google-startup-scripts -Conflicts: google-compute-daemon -Conflicts: google-startup-scripts - -%description -Google Compute Engine python library for Python 2.x. - -%prep -%autosetup - -%build -python setup.py build - -%install -python setup.py install --prefix=%{_prefix} --root %{buildroot} - -%files -%{python_sitelib}/* -%attr(0755,-,-) %{_bindir}/* diff --git a/packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec b/packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec deleted file mode 100644 index 69257d9..0000000 --- a/packages/python-google-compute-engine/packaging/python3-google-compute-engine.spec +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2019 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Name: python3-google-compute-engine -Epoch: 1 -Version: %{_version} -Release: g1%{?dist} -Summary: Google Compute Engine python3 library -License: ASL 2.0 -Url: https://github.com/GoogleCloudPlatform/compute-image-packages -Source0: %{name}_%{version}.orig.tar.gz - -BuildArch: noarch -BuildRequires: python36-devel python3-setuptools - -Requires: python3-setuptools - -%description -Google Compute Engine python library for Python 3.x. - -%prep -%autosetup - -%build -%py3_build - -%install -%py3_install - -%files -%{python3_sitelib}/google_compute_engine/ -%{python3_sitelib}/google_compute_engine*.egg-info/ -%{_bindir}/google_accounts_daemon -%{_bindir}/google_clock_skew_daemon -%{_bindir}/google_instance_setup -%{_bindir}/google_metadata_script_runner -%{_bindir}/google_network_daemon diff --git a/packages/python-google-compute-engine/packaging/setup_deb.sh b/packages/python-google-compute-engine/packaging/setup_deb.sh deleted file mode 100755 index 764017e..0000000 --- a/packages/python-google-compute-engine/packaging/setup_deb.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -NAME="python-google-compute-engine" -VERSION="20191210.00" - -working_dir=${PWD} -if [[ $(basename "$working_dir") != $NAME ]]; then - echo "Packaging scripts must be run from top of package dir." - exit 1 -fi - -# Build dependencies. -sudo apt-get -y install python-all python-setuptools python3-all \ - python3-setuptools python-pytest python3-pytest python-mock python-boto - -# DEB creation tools. -sudo apt-get -y install debhelper devscripts build-essential - -rm -rf /tmp/debpackage -mkdir /tmp/debpackage -tar czvf /tmp/debpackage/${NAME}_${VERSION}.orig.tar.gz --exclude .git \ - --exclude packaging --transform "s/^\./${NAME}-${VERSION}/" . - -pushd /tmp/debpackage -tar xzvf ${NAME}_${VERSION}.orig.tar.gz - -cd ${NAME}-${VERSION} - -cp -r ${working_dir}/packaging/debian ./ - -debuild -us -uc diff --git a/packages/python-google-compute-engine/packaging/setup_rpm.sh b/packages/python-google-compute-engine/packaging/setup_rpm.sh deleted file mode 100755 index 7c97455..0000000 --- a/packages/python-google-compute-engine/packaging/setup_rpm.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -NAME="python-google-compute-engine" -VERSION="20191210.00" - -rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION} -working_dir=${PWD} -if [[ $(basename "$working_dir") != $NAME ]]; then - echo "Packaging scripts must be run from top of package dir." - exit 1 -fi - -sudo yum -y install rpmdevtools - -# RHEL/CentOS 8 uses python3. -if grep -q '^\(CentOS\|Red Hat\)[^0-9]*8\..' /etc/redhat-release; then - NAME="python3-google-compute-engine" - rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION} - sudo yum -y install python36-devel python3-setuptools python36-rpm-macros -else - sudo yum -y install python2-devel python-setuptools python-boto -fi - -rm -rf /tmp/rpmpackage -mkdir -p ${rpm_working_dir}/{SOURCES,SPECS} - -cp packaging/${NAME}.spec ${rpm_working_dir}/SPECS/ - -tar czvf ${rpm_working_dir}/SOURCES/${NAME}_${VERSION}.orig.tar.gz \ - --exclude .git --exclude packaging --transform "s/^\./${NAME}-${VERSION}/" . - -rpmbuild --define "_topdir ${rpm_working_dir}/" --define "_version ${VERSION}" \ - -ba ${rpm_working_dir}/SPECS/${NAME}.spec diff --git a/packages/python-google-compute-engine/setup.py b/packages/python-google-compute-engine/setup.py index de05b12..c30febd 100755 --- a/packages/python-google-compute-engine/setup.py +++ b/packages/python-google-compute-engine/setup.py @@ -15,7 +15,6 @@ """Create a Python package of the Linux guest environment.""" -import glob import sys import setuptools @@ -37,22 +36,10 @@ setuptools.setup( name='google-compute-engine', packages=setuptools.find_packages(), url='https://github.com/GoogleCloudPlatform/compute-image-packages', - version='20191210.0', - # Entry points create scripts in /usr/bin that call a function. - entry_points={ - 'console_scripts': [ - 'google_accounts_daemon=google_compute_engine.accounts.accounts_daemon:main', - 'google_clock_skew_daemon=google_compute_engine.clock_skew.clock_skew_daemon:main', - 'google_instance_setup=google_compute_engine.instance_setup.instance_setup:main', - 'google_network_daemon=google_compute_engine.networking.network_daemon:main', - 'google_metadata_script_runner=google_compute_engine.metadata_scripts.script_manager:main', - ], - }, + version='20200113.0', classifiers=[ 'Development Status :: 5 - Production/Stable', - 'Environment :: No Input/Output (Daemon)', 'Intended Audience :: Developers', - 'Intended Audience :: System Administrators', 'License :: OSI Approved :: Apache Software License', 'Operating System :: POSIX :: Linux', 'Programming Language :: Python', @@ -68,7 +55,5 @@ setuptools.setup( 'Programming Language :: Python :: 3.7', 'Topic :: Internet', 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: System :: Installation/Setup', - 'Topic :: System :: Systems Administration', ], ) -- cgit v1.2.1 From eff97a73ff7e8a8f06ba77175e91f4b1dfc6d05e Mon Sep 17 00:00:00 2001 From: Adi Suresh Date: Thu, 23 Jan 2020 12:06:37 -0600 Subject: Set smp affinity from affinity hint for gvnic queues (#882) --- .../src/usr/bin/google_set_multiqueue | 25 +++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/packages/google-compute-engine/src/usr/bin/google_set_multiqueue b/packages/google-compute-engine/src/usr/bin/google_set_multiqueue index 7064a6b..1cc4da0 100755 --- a/packages/google-compute-engine/src/usr/bin/google_set_multiqueue +++ b/packages/google-compute-engine/src/usr/bin/google_set_multiqueue @@ -26,6 +26,14 @@ # configuration allows network traffic to be spread across the CPUs, giving # each CPU a dedicated TX and RX network queue, while ensuring that all packets # from a single flow are delivered to the same CPU. +# +# For a gvnic device, set the IRQ affinities to the per-IRQ affinity hint. +# The google virtual ethernet driver maps each queue MSI-X interrupt to a +# unique single CPU, which is stored in the affinity_hint for each MSI-X +# vector. In older versions of the kernel, irqblanace is expected to copy the +# affinity_hint to smp_affinity; however, GCE instances disable irqbalance by +# default. This script copies over the affinity_hint to smp_affinity on boot to +# replicate the behavior of irqbalance. function is_decimal_int() { [ "${1}" -eq "${1}" ] > /dev/null 2>&1 @@ -36,11 +44,11 @@ function set_channels() { } echo "Running $(basename $0)." -NET_DEVS=/sys/bus/virtio/drivers/virtio_net/virtio* +VIRTIO_NET_DEVS=/sys/bus/virtio/drivers/virtio_net/virtio* # Loop through all the virtionet devices and enable multi-queue if [ -x "$(command -v ethtool)" ]; then - for dev in $NET_DEVS; do + for dev in $VIRTIO_NET_DEVS; do ETH_DEVS=${dev}/net/* for eth_dev in $ETH_DEVS; do eth_dev=$(basename "$eth_dev") @@ -62,7 +70,7 @@ else echo "ethtool not found: cannot configure virtionet multiqueue." fi -for dev in $NET_DEVS +for dev in $VIRTIO_NET_DEVS do dev=$(basename "$dev") irq_dir=/proc/irq/* @@ -104,6 +112,17 @@ do done done +# Set smp_affinity properly for gvnic queues. '-ntfy-block.' is unique to gve +# and will not affect virtio queues. +for i in /proc/irq/*; do + if ls ${i}/*-ntfy-block.* 1> /dev/null 2>&1; then + if [ -f ${i}/affinity_hint ]; then + echo Setting smp_affinity on ${i} to $(cat ${i}/affinity_hint) + cp ${i}/affinity_hint ${i}/smp_affinity + fi + fi +done + XPS=/sys/class/net/e*/queues/tx*/xps_cpus num_cpus=$(nproc) -- cgit v1.2.1 From dad8239611d85fc697ff0905d60f00cc66ad747d Mon Sep 17 00:00:00 2001 From: Liam Hopkins Date: Wed, 25 Mar 2020 10:17:50 -0700 Subject: fix bugs in disk-expand (#879) --- packages/gce-disk-expand/packaging/debian/control | 1 + .../gce-disk-expand/packaging/gce-disk-expand.spec | 4 ++- packages/gce-disk-expand/src/expandfs-lib.sh | 42 +++++++++++----------- .../modules.d/50expand_rootfs/expand_rootfs.sh | 19 ++++++---- .../share/dracut/modules.d/50expand_rootfs/install | 1 + .../usr/share/initramfs-tools/hooks/expand-rootfs | 2 ++ .../scripts/local-premount/expand_rootfs | 16 ++++----- 7 files changed, 50 insertions(+), 35 deletions(-) diff --git a/packages/gce-disk-expand/packaging/debian/control b/packages/gce-disk-expand/packaging/debian/control index ac38b5d..92f2e1b 100644 --- a/packages/gce-disk-expand/packaging/debian/control +++ b/packages/gce-disk-expand/packaging/debian/control @@ -9,6 +9,7 @@ Homepage: https://github.com/GoogleCloudPlatform/compute-image-packages Package: gce-disk-expand Architecture: all Depends: parted, + gdisk, ${misc:Depends} Description: Automatically resize the root partition on first boot. This package resizes the root partition on first boot using parted. diff --git a/packages/gce-disk-expand/packaging/gce-disk-expand.spec b/packages/gce-disk-expand/packaging/gce-disk-expand.spec index 409d898..3f6c0dc 100644 --- a/packages/gce-disk-expand/packaging/gce-disk-expand.spec +++ b/packages/gce-disk-expand/packaging/gce-disk-expand.spec @@ -20,9 +20,11 @@ License: Apache Software License Group: System Environment/Base URL: https://github.com/GoogleCloudPlatform/compute-image-packages Source0: %{name}_%{version}.orig.tar.gz -Requires: e2fsprogs, dracut, grep, util-linux, parted +Requires: e2fsprogs, dracut, grep, util-linux, parted, gdisk Conflicts: dracut-modules-growroot +BuildRequires: rsync + # Allow other files in the source that don't end up in the package. %define _unpackaged_files_terminate_build 0 diff --git a/packages/gce-disk-expand/src/expandfs-lib.sh b/packages/gce-disk-expand/src/expandfs-lib.sh index 69f67ed..4a02b9f 100755 --- a/packages/gce-disk-expand/src/expandfs-lib.sh +++ b/packages/gce-disk-expand/src/expandfs-lib.sh @@ -29,8 +29,8 @@ resize_filesystem() { ;; ext*) if ! out=$(e2fsck -pf "$disk"); then - echo "Calling e2fsck \"${disk}\" failed: ${out}" - return 1 + local ret=$? + echo "Calling e2fsck \"${disk}\" failed: ${out} exit code ${ret}" fi if ! out=$(resize2fs "$disk"); then echo "Calling resize2fs \"${disk}\" failed: ${out}" @@ -60,32 +60,31 @@ blkid_get_fstype() ( echo $ID_FS_TYPE ) +sgdisk_get_label() { + local root="$1" + [ -z "$root" ] && return 0 + + if sgdisk -p "$root" | grep -q "Found invalid GPT and valid MBR"; then + echo "mbr" + else + echo "gpt" + fi +} -# Checks for and corrects the end-of-disk GPT backup block in case of expanded -# disk. -parted_fix_gpt() { +sgdisk_fix_gpt() { local disk="$1" [ -z "$disk" ] && return - if parted -sm "$disk" print 2>&1 | grep -q "fix the GPT"; then - # Running parted prompts the user to fix this condition, but only does so in - # the interactive exception handler. In order to pass input we must use the - # hidden triple-dash flag and pass both print and Fix arguments. `print` - # alone will not perform the fix, but `Fix` alone will fail the argument - # parser. - parted -m ---pretend-input-tty "$disk" print Fix >/dev/null 2>&1 /dev/null 2>&1 &1 | grep -q "fix the GPT"; then - echo "Failed to fix the GPT." - return 1 - fi - fi + local label=$(sgdisk_get_label "$disk") + [ "$label" != "gpt" ] && return + + sgdisk --move-second-header "$disk" } # Returns "disk:partition", supporting multiple block types. split_partition() { local root="$1" disk="" partnum="" - [ -z "$root" ] && return + [ -z "$root" ] && return 0 if [ -e /sys/block/${root##*/} ]; then echo "Root is not a partition, skipping partition resize." @@ -104,7 +103,10 @@ split_partition() { # Checks if partition needs resizing. parted_needresize() { local disk="$1" partnum="$2" disksize="" partend="" - [ -z "$root" ] && return + if [ -z "$disk" ] || [ -z "$partnum" ]; then + echo "invalid args to parted_needresize" + return 1 + fi if ! out=$(parted -sm "$disk" unit b print 2>&1); then echo "Failed to get disk details: ${out}" diff --git a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs.sh b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs.sh index 3d12b35..62d7171 100755 --- a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs.sh +++ b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/expand_rootfs.sh @@ -16,6 +16,12 @@ # Contains dracut-specific logic for detecting disk, then calls appropriate # library functions. +# Notes for developing dracut modules: this module must never exit with anything +# other than a 0 exit code. That means no use of set -e or traps on err, and +# every command must be defensively written so that errors are caught and +# logged, rather than causing end of execution. Note that error handling in the +# main() function always calls return 0 + kmsg() { echo "expand_rootfs: $@" > /dev/kmsg } @@ -49,13 +55,14 @@ main() { kmsg "Resizing disk ${rootdev}" + # First, move the secondary GPT to the end. + if ! out=$(sgdisk_fix_gpt "$disk"); then + kmsg "Failed to fix GPT: ${out}" + fi + if ! out=$(parted_resizepart "$disk" "$partnum"); then - # Try fixing the GPT and try resizing again. - parted_fix_gpt "$disk" - if ! out=$(parted_resizepart "$disk" "$partnum"); then - kmsg "Failed to resize partition: ${out}" - return - fi + kmsg "Failed to resize partition: ${out}" + return fi if ! out=$(resize_filesystem "$rootdev"); then diff --git a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/install b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/install index cdd021d..4fa6a5b 100755 --- a/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/install +++ b/packages/gce-disk-expand/src/usr/share/dracut/modules.d/50expand_rootfs/install @@ -21,6 +21,7 @@ inst_hook pre-mount 50 "$moddir/expand_rootfs.sh" inst_hook pre-pivot 99 "$moddir/xfs_growfs.sh" dracut_install parted +dracut_install sgdisk dracut_install cut dracut_install sed dracut_install grep diff --git a/packages/gce-disk-expand/src/usr/share/initramfs-tools/hooks/expand-rootfs b/packages/gce-disk-expand/src/usr/share/initramfs-tools/hooks/expand-rootfs index dae461a..a463ea5 100755 --- a/packages/gce-disk-expand/src/usr/share/initramfs-tools/hooks/expand-rootfs +++ b/packages/gce-disk-expand/src/usr/share/initramfs-tools/hooks/expand-rootfs @@ -36,3 +36,5 @@ copy_exec /sbin/e2fsck /bin copy_exec /sbin/blkid /bin copy_exec /sbin/resize2fs /bin copy_exec /bin/udevadm /bin +copy_exec /usr/sbin/dmidecode /bin +copy_exec /sbin/sgdisk /bin diff --git a/packages/gce-disk-expand/src/usr/share/initramfs-tools/scripts/local-premount/expand_rootfs b/packages/gce-disk-expand/src/usr/share/initramfs-tools/scripts/local-premount/expand_rootfs index a380bc2..9b59b20 100755 --- a/packages/gce-disk-expand/src/usr/share/initramfs-tools/scripts/local-premount/expand_rootfs +++ b/packages/gce-disk-expand/src/usr/share/initramfs-tools/scripts/local-premount/expand_rootfs @@ -29,15 +29,15 @@ esac . /scripts/expandfs-lib.sh if ! rootdev=$(resolve_device "${ROOT}"); then - log_failure_message "Failed to resolve root device for \"${ROOT}\"" + log_failure_msg "Failed to resolve root device for \"${ROOT}\"" fi if ! fs_type=$(get_fstype "${rootdev}"); then - log_failure_message "Failed to determine fstype for \"${rootdev}\"" + log_failure_msg "Failed to determine fstype for \"${rootdev}\"" fi if ! out=$(split_partition "$rootdev"); then - log_failure_message "Failed to detect disk and partition info: ${out}" + log_failure_msg "Failed to detect disk and partition info: ${out}" exit 0 fi @@ -45,23 +45,23 @@ disk=${out%:*} partnum=${out#*:} if ! parted_needresize "${disk}" "${partnum}"; then - log_success_message "Disk ${rootdev} doesn't need resizing." + log_success_msg "Disk ${rootdev} doesn't need resizing." exit 0 fi -if ! out=$(parted_fix_gpt "$disk"); then - log_failure_message "Failed to fix GPT: ${out}" +if ! out=$(sgdisk_fix_gpt "$disk"); then + log_failure_msg "Failed to fix GPT: ${out}" exit 0 fi echo "Resizing partition on ${rootdev}" if ! out=$(parted_resizepart "${disk}" "${partnum}"); then - log_failure_message "Failed to resize partition: ${out}" + log_failure_msg "Failed to resize partition: ${out}" exit 0 fi echo "Resizing filesystem on ${rootdev}" if ! out=$(resize_filesystem "${rootdev}"); then - log_failure_message "Failed to resize filesystem: ${out}" + log_failure_msg "Failed to resize filesystem: ${out}" exit 0 fi -- cgit v1.2.1