Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #98 from xianghuzhao/update-zhaoxh-20160524
Browse files Browse the repository at this point in the history
Several bug fixes
  • Loading branch information
Andrei Tsaregorodtsev committed May 30, 2016
2 parents 72cbf18 + 8bbb8d7 commit 0780289
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions VMDIRAC/Resources/Cloud/CloudEndpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ def createInstances( self, vmsToSubmit ):

for nvm in xrange( vmsToSubmit ):
instanceID = makeGuid()[:8]
result = self.createInstance( instanceID )
createPublicIP = 'ipPool' in self.parameters
result = self.createInstance( instanceID, createPublicIP )
if result['OK']:
node, publicIP = result['Value']
self.log.debug( 'Created VM instance %s/%s with publicIP %s' % ( node.id, instanceID, publicIP ) )
Expand Down Expand Up @@ -423,6 +424,7 @@ def createInstance( self, instanceID = '', createPublicIP = True ):
if result['OK']:
publicIP = result['Value']
else:
vmNode.destroy()
return result
except Exception as exc:
self.log.debug( 'Failed to wait node running %s' % str(exc) )
Expand Down Expand Up @@ -565,7 +567,6 @@ def stopVM( self, nodeID, publicIP = '' ):
result = self.deleteFloatingIP( publicIP, node )
if not result['OK']:
self.log.error( 'Failed in deleteFloatingIP:', result[ 'Message' ] )
return result

# Destroy the VM instance
if node is not None:
Expand Down
6 changes: 3 additions & 3 deletions VMDIRAC/WorkloadManagementSystem/Agent/CloudDirector.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ def getImages( self, resourceDict ):
self.imageDict[imageName]['Platform'] = platform
self.imageDict[imageName]['MaxInstances'] = ceDict['MaxInstances']
if not self.imageDict[imageName]['CE'].isValid():
self.log.fatal( 'Failed to instantiate CloudEndpoint for %s' % imageName )
return result
self.log.error( 'Failed to instantiate CloudEndpoint for %s' % imageName )
continue

if site not in self.sites:
self.sites.append( site )
Expand Down Expand Up @@ -538,4 +538,4 @@ def getVMInstances( self, endpoint, maxInstances ):
if status in [ 'New', 'Submitted', 'Running']:
count += int( result['Value'][status] )

return max( 0, maxInstances - count )
return max( 0, maxInstances - count )
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ vm_dirac_install() {

dirac-configure -ddd -S $setup -C $config_server \
-o /DIRAC/Extensions=VMDIRAC \
-o /DIRAC/VirtualOrganization=vo \
-o /DIRAC/VirtualOrganization=$vo \
-o /LocalSite/ReleaseProject=$release_project \
-o /LocalSite/ReleaseVersion=$release_version \
-o /LocalSite/VMID=$VM_UUID \
Expand All @@ -142,4 +142,4 @@ vm_dirac_install() {
-o /DIRAC/Security/CertFile=/opt/dirac/etc/grid-security/hostcert.pem \
-o /DIRAC/Security/KeyFile=/opt/dirac/etc/grid-security/hostkey.pem
cd $cwd
}
}
2 changes: 1 addition & 1 deletion VMDIRAC/WorkloadManagementSystem/Bootstrap/vm-pilot
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ cp $CONTEXTDIR/*.py .
# Run the Pilot 2.0 script
python dirac-pilot.py \
--debug \
--setup Dirac-Production \
--setup $SETUP \
-r $VERSION \
-l $PROJECT \
-e VMDIRAC \
Expand Down
4 changes: 2 additions & 2 deletions VMDIRAC/WorkloadManagementSystem/DB/VirtualMachineDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class VirtualMachineDB( DB ):
tablesDesc[ 'vm_Instances' ] = { 'Fields' : { 'InstanceID' : 'BIGINT UNSIGNED AUTO_INCREMENT NOT NULL',
'RunningPod' : 'VARCHAR(255) NOT NULL',
'Name' : 'VARCHAR(255) NOT NULL',
'Endpoint' : 'VARCHAR(32) NOT NULL',
'Endpoint' : 'VARCHAR(255) NOT NULL',
'UniqueID' : 'VARCHAR(255) NOT NULL DEFAULT ""',
'VMImageID' : 'INTEGER UNSIGNED NOT NULL',
'Status' : 'VARCHAR(32) NOT NULL',
Expand Down Expand Up @@ -1111,7 +1111,7 @@ def __insertInstance( self, uniqueID, imageName, instanceName, endpoint, running
return instance

if 'lastRowId' in instance:
self.__addInstanceHistory( instance[ 'lastRowId' ], validStates[ 0 ] )
self.__addInstanceHistory( instance[ 'lastRowId' ], status )
return S_OK( instance[ 'lastRowId' ] )

return S_ERROR( 'Failed to insert new Instance' )
Expand Down

0 comments on commit 0780289

Please sign in to comment.