cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anim...@apache.org
Subject [2/3] git commit: updated refs/heads/4.2 to 13a9310
Date Fri, 13 Sep 2013 20:06:14 GMT
Add Baremetal agent package back to RPM spec file
(cherry picked from commit d58044ccbaa49d011d4e5b72f8e96a8619b224fd)

Signed-off-by: animesh <animesh@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/097ad0b5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/097ad0b5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/097ad0b5

Branch: refs/heads/4.2
Commit: 097ad0b5fe82a653ff860c35a4250bacdc1297c8
Parents: 10a2578
Author: frank <frank.zhang@citrix.com>
Authored: Thu Sep 12 14:14:23 2013 -0700
Committer: animesh <animesh@apache.org>
Committed: Fri Sep 13 11:26:27 2013 -0700

----------------------------------------------------------------------
 packaging/centos63/cloud.spec                   |  16 ++
 .../networkservice/BaremetalDhcpElement.java    |  11 +-
 .../BaremetalDhcpManagerImpl.java               |   7 +-
 python/bindir/cloud-setup-baremetal             | 217 -------------------
 4 files changed, 23 insertions(+), 228 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/097ad0b5/packaging/centos63/cloud.spec
----------------------------------------------------------------------
diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec
index 2b814f8..5f8a2a5 100644
--- a/packaging/centos63/cloud.spec
+++ b/packaging/centos63/cloud.spec
@@ -162,6 +162,19 @@ Group: System Environment/Libraries
 %description awsapi
 Apache Cloudstack AWS API compatibility wrapper
 
+
+%package baremetal-agent
+Summary: CloudStack baremetal agent
+Requires: tftp-server
+Requires: xinetd
+Requires: syslinux
+Requires: chkconfig
+Requires: dhcp
+Requires: httpd
+Group:     System Environment/Libraries
+%description baremetal-agent
+The CloudStack baremetal agent
+
 %prep
 echo Doing CloudStack build
 
@@ -236,6 +249,7 @@ install -D client/target/utilities/bin/cloud-set-guest-sshkey ${RPM_BUILD_ROOT}%
 install -D client/target/utilities/bin/cloud-setup-databases ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-databases
 install -D client/target/utilities/bin/cloud-setup-encryption ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-encryption
 install -D client/target/utilities/bin/cloud-setup-management ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-management
+install -D client/target/utilities/bin/cloud-setup-baremetal ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-baremetal
 install -D client/target/utilities/bin/cloud-sysvmadm ${RPM_BUILD_ROOT}%{_bindir}/%{name}-sysvmadm
 install -D client/target/utilities/bin/cloud-update-xenserver-licenses ${RPM_BUILD_ROOT}%{_bindir}/%{name}-update-xenserver-licenses
 
@@ -603,6 +617,8 @@ fi
 %{_defaultdocdir}/%{name}-awsapi-%{version}/LICENSE
 %{_defaultdocdir}/%{name}-awsapi-%{version}/NOTICE
 
+%files baremetal-agent
+%attr(0755,root,root) %{_bindir}/cloudstack-setup-baremetal
 
 %changelog
 * Fri Oct 03 2012 Hugo Trippaers <hugo@apache.org> 4.1.0

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/097ad0b5/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
index 34e8302..f01deb7 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
@@ -65,8 +65,8 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
     static {
         Capability cap = new Capability(BaremetalDhcpManager.BAREMETAL_DHCP_SERVICE_CAPABITLITY);
         Map<Capability, String> baremetalCaps = new HashMap<Capability, String>();
-        baremetalCaps.put(cap, null);
-        baremetalCaps.put(Capability.DhcpAccrossMultipleSubnets, Boolean.TRUE.toString());
+        baremetalCaps.put(cap, null);
+        baremetalCaps.put(Capability.DhcpAccrossMultipleSubnets, Boolean.TRUE.toString());
         capabilities = new HashMap<Service, Map<Capability, String>>();
         capabilities.put(Service.Dhcp, baremetalCaps);
     }
@@ -82,11 +82,8 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
     }
 
     private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType
networkType) {
-        Pod pod = dest.getPod();
-        if (pod != null && dest.getDataCenter().getNetworkType() == NetworkType.Basic
&& trafficType == TrafficType.Guest) {
-            SearchCriteriaService<BaremetalDhcpVO, BaremetalDhcpVO> sc = SearchCriteria2.create(BaremetalDhcpVO.class);
-            sc.addAnd(sc.getEntity().getPodId(), Op.EQ, pod.getId());
-            return sc.find() != null;
+        if (dest.getDataCenter().getNetworkType() == NetworkType.Basic && trafficType
== TrafficType.Guest) {
+            return true;
         }
         
         return false;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/097ad0b5/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
index 9d18478..2f4ffcb 100755
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
@@ -136,14 +136,13 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements
BaremetalDh
     public boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile<?
extends VirtualMachine> profile,
             DeployDestination dest, ReservationContext context) throws ResourceUnavailableException
{
         Long zoneId = profile.getVirtualMachine().getDataCenterId();
-        Long podId = profile.getVirtualMachine().getPodIdToDeployIn();
-        List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHosts(Type.BaremetalDhcp,
null, podId, zoneId);
+        List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHosts(Type.BaremetalDhcp,
null, null, zoneId);
         if (hosts.size() == 0) {
-            throw new CloudRuntimeException("No external Dhcp found in zone " + zoneId +
" pod " + podId);
+            throw new CloudRuntimeException("No external Dhcp found in zone " + zoneId);
         }
 
         if (hosts.size() > 1) {
-            throw new CloudRuntimeException("Something wrong, more than 1 external Dhcp found
in zone " + zoneId + " pod " + podId);
+            throw new CloudRuntimeException("Something wrong, more than 1 external Dhcp found
in zone " + zoneId);
         }
 
         HostVO h = hosts.get(0);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/097ad0b5/python/bindir/cloud-setup-baremetal
----------------------------------------------------------------------
diff --git a/python/bindir/cloud-setup-baremetal b/python/bindir/cloud-setup-baremetal
deleted file mode 100755
index 03ea086..0000000
--- a/python/bindir/cloud-setup-baremetal
+++ /dev/null
@@ -1,217 +0,0 @@
-#!/usr/bin/python
-# 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.
-
-import sys, os
-from subprocess import PIPE, Popen
-import logging
-import traceback
-from os.path import exists, join
-from signal import alarm, signal, SIGALRM, SIGKILL
-
-class CloudRuntimeException(Exception):
-    def __init__(self, errMsg):
-        self.errMsg = errMsg
-    def __str__(self):
-        return self.errMsg
-def formatExceptionInfo(maxTBlevel=5):
-    cla, exc, trbk = sys.exc_info()
-    excTb = traceback.format_tb(trbk, maxTBlevel)
-    msg = str(exc) + "\n"
-    for tb in excTb:
-        msg += tb
-    return msg
-
-class bash:
-    def __init__(self, args, timeout=600):
-        self.args = args
-        logging.debug("execute:%s"%args)
-        self.timeout = timeout
-        self.process = None
-        self.success = False
-        self.run()
-
-    def run(self):
-        class Alarm(Exception):
-            pass
-        def alarm_handler(signum, frame):
-            raise Alarm
-
-        try:
-            self.process = Popen(self.args, shell=True, stdout=PIPE, stderr=PIPE)
-            if self.timeout != -1:
-                signal(SIGALRM, alarm_handler)
-                alarm(self.timeout)
-
-            try:
-                self.stdout, self.stderr = self.process.communicate()
-                if self.timeout != -1:
-                    alarm(0)
-            except Alarm:
-                os.kill(self.process.pid, SIGKILL)
-                raise  CloudRuntimeException("Timeout during command execution")
-
-            self.success = self.process.returncode == 0
-        except:
-            raise  CloudRuntimeException(formatExceptionInfo())
-
-#        if not self.success: 
-#            raise  CloudRuntimeException(self.getStderr())
-
-    def isSuccess(self):
-        return self.success
-    
-    def getStdout(self):
-        return self.stdout.strip("\n")
-    
-    def getLines(self):
-        return self.stdout.split("\n")
-
-    def getStderr(self):
-        return self.stderr.strip("\n")
-
-
-def initLoging(logFile=None):
-    try:
-        if logFile is None:
-            logging.basicConfig(level=logging.DEBUG) 
-        else: 
-            logging.basicConfig(filename=logFile, level=logging.DEBUG) 
-    except:
-        logging.basicConfig(level=logging.DEBUG) 
-
-def writeProgressBar(msg, result=None):    
-    if msg is not None:
-        output = "%-80s"%msg
-    elif result is True:
-        output = "[ \033[92m%-2s\033[0m ]\n"%"OK"
-    elif result is False:
-        output = "[ \033[91m%-6s\033[0m ]\n"%"FAILED"
-    sys.stdout.write(output)
-    sys.stdout.flush()
-    
-def printError(msg):
-    sys.stderr.write(msg)
-    sys.stderr.write("\n")
-    sys.stderr.flush()
-
-def printMsg(msg):
-    sys.stdout.write(msg+"\n")
-    sys.stdout.flush()
-
-def checkRpm(pkgName):
-    chkPkg = bash("rpm -q %s"%pkgName)
-    writeProgressBar("Checking %s"%pkgName, None)
-    if not chkPkg.isSuccess():
-        writeProgressBar(None, False)
-        printError("%s is not found, please make sure it is installed. You may try 'yum install
%s'\n"%(pkgName, pkgName))
-        return False
-    else:
-        writeProgressBar(None, True)
-        return True
-      
-def checkEnv():
-   writeProgressBar("Checking is root")
-   ret = bash("whoami")
-   if ret.getStdout() != "root":
-       writeProgressBar(None, False)
-       printError("This script must run as root")
-       return False
-   else:
-       writeProgressBar(None, True)
-       
-   pkgList = ['tftp-server', 'syslinux', 'xinetd', 'chkconfig', 'dhcp']
-   for pkg in pkgList:
-       if not checkRpm(pkg):
-           return False
-   return True
-
-def exitIfFail(ret):
-    if not ret: sys.exit(1) 
-    
-def bashWithResult(cmd):
-    writeProgressBar("Executing '%s'"%cmd)
-    ret = bash(cmd)
-    if not ret.isSuccess():
-        writeProgressBar(None, False)
-        writeProgressBar(ret.getStderr() + '\n')
-        return False
-    else:
-        writeProgressBar(None, True)
-        return True
-    
-def configurePxeStuff(): 
-    stuff = ['tftp', 'xinetd', 'dhcpd']
-    cmds = ['chkconfig --level 345 %s on' % i for i in stuff]
-    cmds.append('/etc/init.d/xinetd restart')
-    
-    for cmd in cmds:
-        if not bashWithResult(cmd): return False
-        
-    chkIptable = bash('chkconfig --list iptables')
-    if 'on' in chkIptable.getStdout():
-        printMsg("Detected iptables is running, need to open tftp port 69")
-        if not bashWithResult('iptables -I INPUT 1 -p udp --dport 69 -j ACCEPT'): return
False
-        if not bashWithResult('/etc/init.d/iptables save'): return False
-        
-    return True  
-    
-def getTftpRootDir(tftpRootDirList):
-    tftpRoot = bash("cat /etc/xinetd.d/tftp | grep server_args")
-    if not tftpRoot.isSuccess():
-        printError("Cannot get tftp root directory from /etc/xinetd.d/tftp, here may be something
wrong with your tftp-server, try reinstall it\n")
-        return False
-    tftpRootDir = tftpRoot.getStdout()
-    index = tftpRootDir.find("/")
-    if index == -1:
-        printError("Wrong server_arg in /etc/xinetd.d/tftp (%s)"%tftpRootDir)
-        return False
-    tftpRootDir = tftpRootDir[index:]
-    tftpRootDirList.append(tftpRootDir)
-    return True
-
-def preparePING(tftpRootDir):
-    pingFiles = ['boot.msg', 'initrd.gz', 'kernel', 'pxelinux.0']
-    pingDir = "/usr/share/PING"
-    
-    for f in pingFiles:
-        path = join(pingDir, f)
-        if not exists(path):
-            printError("Cannot find %s, please make sure PING-3.01 is installed"%path)
-            return False
-        if not bashWithResult("cp -f %s %s"%(path, tftpRootDir)): return False
-     
-    if not bashWithResult("mkdir -p %s/pxelinux.cfg"%tftpRootDir): return False
-    
-    return True
-            
-        
-if __name__ == "__main__":
-    initLoging("/tmp/cloud-setup-baremetal.log")
-    tftpRootDirList = []
-    
-    exitIfFail(checkEnv())
-    exitIfFail(configurePxeStuff())
-    exitIfFail(getTftpRootDir(tftpRootDirList))
-    
-    tftpRootDir = tftpRootDirList[0].strip()
-    exitIfFail(preparePING(tftpRootDir))
-    printMsg("")
-    printMsg("Setup BareMetal PXE server successfully")
-    printMsg("TFTP root directory is: %s\n"%tftpRootDir)
-    sys.exit(0)
-    


Mime
View raw message