You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2015/05/26 17:42:59 UTC
[1/2] git commit: updated refs/heads/4.4 to 3b5e5a3
Repository: cloudstack
Updated Branches:
refs/heads/4.4 fdf47a221 -> 3b5e5a343
kvm: Check the return value of the cloudstack-setup-agent command
Bug-Url: https://issues.apache.org/jira/browse/CLOUDSTACK-8016
Signed-off-by: Laszlo Hornyak <la...@gmail.com>
Signed-off-by: Rajani Karuturi <ra...@gmail.com>
This closes #93
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/312d531a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/312d531a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/312d531a
Branch: refs/heads/4.4
Commit: 312d531a7cfa09d83972748d7cd8df2e71feb2bf
Parents: fdf47a2
Author: Laszlo Hornyak <la...@gmail.com>
Authored: Sat Jan 17 22:09:16 2015 +0100
Committer: Daan Hoogland <da...@gmail.com>
Committed: Tue May 26 17:42:20 2015 +0200
----------------------------------------------------------------------
.../hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/312d531a/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java b/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java
index d475f4d..350b9a7 100644
--- a/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java
+++ b/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java
@@ -205,7 +205,12 @@ public abstract class LibvirtServerDiscoverer extends DiscovererBase implements
parameters += " --guestNic=" + kvmGuestNic;
parameters += " --hypervisor=" + cluster.getHypervisorType().toString().toLowerCase();
- SSHCmdHelper.sshExecuteCmd(sshConnection, "cloudstack-setup-agent " + parameters, 3);
+ if (!SSHCmdHelper.sshExecuteCmd(sshConnection,
+ "cloudstack-setup-agent " + parameters, 3)) {
+ s_logger.info("cloudstack agent setup command failed: "
+ + "cloudstack-setup-agent " + parameters);
+ return null;
+ }
KvmDummyResourceBase kvmResource = new KvmDummyResourceBase();
Map<String, Object> params = new HashMap<String, Object>();
[2/2] git commit: updated refs/heads/4.4 to 3b5e5a3
Posted by da...@apache.org.
CLOUDSTACK-8339: Allow non-root users to add KVM host
This allows non-root users to add KVM hosts, the user should be an admin or
added to sudoers to execute sudo cloudstack-setup-agent.
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
Signed-off-by: Remi Bergsma <ap...@remi.nl>
This closes #288
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3b5e5a34
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3b5e5a34
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3b5e5a34
Branch: refs/heads/4.4
Commit: 3b5e5a3431f084fd76ee9435aa278f7797b764cf
Parents: 312d531
Author: Rohit Yadav <ro...@shapeblue.com>
Authored: Fri May 22 14:36:16 2015 +0100
Committer: Daan Hoogland <da...@gmail.com>
Committed: Tue May 26 17:42:26 2015 +0200
----------------------------------------------------------------------
agent/bindir/cloudstack-agent-profile.sh.in | 20 ++++++++++++++++++++
debian/cloudstack-agent.install | 1 +
debian/rules | 2 ++
packaging/centos63/cloud.spec | 3 +++
.../kvm/discoverer/LibvirtServerDiscoverer.java | 8 ++++++--
5 files changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b5e5a34/agent/bindir/cloudstack-agent-profile.sh.in
----------------------------------------------------------------------
diff --git a/agent/bindir/cloudstack-agent-profile.sh.in b/agent/bindir/cloudstack-agent-profile.sh.in
new file mode 100644
index 0000000..93b10b3
--- /dev/null
+++ b/agent/bindir/cloudstack-agent-profile.sh.in
@@ -0,0 +1,20 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+
+# need access to lsmod for adding host as non-root
+PATH=$PATH:/sbin
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b5e5a34/debian/cloudstack-agent.install
----------------------------------------------------------------------
diff --git a/debian/cloudstack-agent.install b/debian/cloudstack-agent.install
index d708514..94dd30d 100644
--- a/debian/cloudstack-agent.install
+++ b/debian/cloudstack-agent.install
@@ -18,6 +18,7 @@
/etc/cloudstack/agent/agent.properties
/etc/cloudstack/agent/environment.properties
/etc/cloudstack/agent/log4j-cloud.xml
+/etc/profile.d/cloudstack-agent-profile.sh
/etc/init.d/cloudstack-agent
/usr/bin/cloudstack-setup-agent
/usr/bin/cloudstack-ssh
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b5e5a34/debian/rules
----------------------------------------------------------------------
diff --git a/debian/rules b/debian/rules
index 774670f..3801ae2 100755
--- a/debian/rules
+++ b/debian/rules
@@ -63,6 +63,7 @@ install:
# cloudstack-agent
mkdir $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/agent
+ mkdir $(DESTDIR)/$(SYSCONFDIR)/profile.d
mkdir $(DESTDIR)/var/log/$(PACKAGE)/agent
mkdir $(DESTDIR)/usr/share/$(PACKAGE)-agent
mkdir $(DESTDIR)/usr/share/$(PACKAGE)-agent/plugins
@@ -72,6 +73,7 @@ install:
install -D packaging/debian/init/cloud-agent $(DESTDIR)/$(SYSCONFDIR)/init.d/$(PACKAGE)-agent
install -D agent/target/transformed/cloud-setup-agent $(DESTDIR)/usr/bin/cloudstack-setup-agent
install -D agent/target/transformed/cloud-ssh $(DESTDIR)/usr/bin/cloudstack-ssh
+ install -D agent/target/transformed/cloudstack-agent-profile.sh $(DESTDIR)/$(SYSCONFDIR)/profile.d/cloudstack-agent-profile.sh
install -D agent/target/transformed/cloudstack-agent-upgrade $(DESTDIR)/usr/bin/cloudstack-agent-upgrade
install -D agent/target/transformed/libvirtqemuhook $(DESTDIR)/usr/share/$(PACKAGE)-agent/lib/
install -D agent/target/transformed/* $(DESTDIR)/$(SYSCONFDIR)/$(PACKAGE)/agent
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b5e5a34/packaging/centos63/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec
index 82bf487..ca138eb 100644
--- a/packaging/centos63/cloud.spec
+++ b/packaging/centos63/cloud.spec
@@ -223,6 +223,7 @@ mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/mnt
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/management
mkdir -p ${RPM_BUILD_ROOT}%{_initrddir}
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
+mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/profile.d
# Common
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/scripts
@@ -320,6 +321,7 @@ install -D agent/target/transformed/cloud-setup-agent ${RPM_BUILD_ROOT}%{_bindir
install -D agent/target/transformed/cloudstack-agent-upgrade ${RPM_BUILD_ROOT}%{_bindir}/%{name}-agent-upgrade
install -D agent/target/transformed/libvirtqemuhook ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib/libvirtqemuhook
install -D agent/target/transformed/cloud-ssh ${RPM_BUILD_ROOT}%{_bindir}/%{name}-ssh
+install -D agent/target/transformed/cloudstack-agent-profile.sh ${RPM_BUILD_ROOT}%{_sysconfdir}/profile.d/%{name}-agent-profile.sh
install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%name-agent/lib/cloud-plugin-hypervisor-kvm-%{_maventag}.jar
cp plugins/hypervisors/kvm/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib
@@ -615,6 +617,7 @@ fi
%attr(0755,root,root) %{_bindir}/%{name}-agent-upgrade
%attr(0755,root,root) %{_bindir}/%{name}-ssh
%attr(0755,root,root) %{_sysconfdir}/init.d/%{name}-agent
+%attr(0644,root,root) %{_sysconfdir}/profile.d/%{name}-agent-profile.sh
%attr(0755,root,root) %{_datadir}/%{name}-common/scripts/network/cisco
%config(noreplace) %{_sysconfdir}/%{name}/agent
%dir %{_localstatedir}/log/%{name}/agent
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b5e5a34/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java b/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java
index 350b9a7..d266938 100644
--- a/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java
+++ b/server/src/com/cloud/hypervisor/kvm/discoverer/LibvirtServerDiscoverer.java
@@ -205,10 +205,14 @@ public abstract class LibvirtServerDiscoverer extends DiscovererBase implements
parameters += " --guestNic=" + kvmGuestNic;
parameters += " --hypervisor=" + cluster.getHypervisorType().toString().toLowerCase();
+ String setupAgentCommand = "cloudstack-setup-agent ";
+ if (!username.equals("root")) {
+ setupAgentCommand = "sudo cloudstack-setup-agent ";
+ }
if (!SSHCmdHelper.sshExecuteCmd(sshConnection,
- "cloudstack-setup-agent " + parameters, 3)) {
+ setupAgentCommand + parameters, 3)) {
s_logger.info("cloudstack agent setup command failed: "
- + "cloudstack-setup-agent " + parameters);
+ + setupAgentCommand + parameters);
return null;
}