Skip to content

Commit

Permalink
agent: no need to wait for detach events if nobody is attached
Browse files Browse the repository at this point in the history
Change-Id: I1eca3ac8d009fc468568be77ac81d8a7cecc3c13
  • Loading branch information
fdiakh committed Apr 11, 2019
1 parent 645d8b5 commit 067461a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
1 change: 1 addition & 0 deletions agent/Makefile
Expand Up @@ -6,6 +6,7 @@ all : pcocc-agent
pcocc-agent : $(FILES)
GOPATH=$(PWD) go get github.com/sirupsen/logrus
GOPATH=$(PWD) go get github.com/onrik/logrus/filename
GOPATH=$(PWD) go get github.com/golang/protobuf/proto
GOPATH=$(PWD) go build ./src/pcocc-agent.go

install:
Expand Down
54 changes: 54 additions & 0 deletions agent/pcocc-agent.spec
@@ -0,0 +1,54 @@
%define __spec_install_post %{nil}
%define debug_package %{nil}
%define __os_install_post %{_dbpath}/brp-compress

%{?systemd_requires}
BuildRequires: systemd

Summary: The pcocc guest agent
Name: pcocc-agent
Version: 0.1
Release: 1
License: GPL
Group: Development/Tools
SOURCE0 : %{name}-%{version}.tar.gz
URL: https://github.com/cea-hpc/pcocc-agent

BuildRequires: make

BuildRoot: %{_tmppath}/%{name}-%{version}

%description
%{summary}

%prep
%setup -q

%build
make %{?_smp_mflags}

%install
%make_install

%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
/sbin/*
/etc/systemd/system/*

%changelog


%post
%systemd_post pcocc-agent.service

%preun
%systemd_preun pcocc-agent.service

%postun
%systemd_postun_with_restart pcocc-agent.service


2 changes: 1 addition & 1 deletion agent/src/command/command.go
Expand Up @@ -522,7 +522,7 @@ func (em *ExecManager) detachAllExecs() (error) {
em.Lock.Lock()
defer em.Lock.Unlock()

if !em.isDetaching {
if !em.isDetaching && em.attachCount > 0 {
em.isDetaching = true
for _, ex := range em.Execs {
// We cant hold the lock here because it's
Expand Down

0 comments on commit 067461a

Please sign in to comment.