mirror of https://github.com/apache/cloudstack.git
Merge branch '2.2.y' of ssh://git.cloud.com/var/lib/git/cloudstack-oss into 2.2.y
This commit is contained in:
commit
b607e4aa1c
|
|
@ -67,6 +67,33 @@ sed -i /"$2 "/d /etc/hosts
|
|||
sed -i /"$3"/d /etc/hosts
|
||||
echo "$2 $3" >> /etc/hosts
|
||||
|
||||
locked=0
|
||||
if [ $no_redundant -eq 0 ]
|
||||
then
|
||||
#for redundant router, grap the lock to prevent racy with keepalived process
|
||||
LOCK=/tmp/rrouter.lock
|
||||
|
||||
# Wait the lock
|
||||
for i in `seq 1 5`
|
||||
do
|
||||
if [ ! -e $LOCK ]
|
||||
then
|
||||
touch $LOCK
|
||||
locked=1
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
logger -t cloud "edithosts: sleep 1 second wait for the redundant router lock"
|
||||
done
|
||||
|
||||
if [ $locked -eq 0 ]
|
||||
then
|
||||
logger -t cloud "edithosts: fail to get the redundant router lock"
|
||||
logger -t cloud "edithosts: keepalived should able to handle the dnsmasq restart"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# make dnsmasq re-read files
|
||||
pid=$(pidof dnsmasq)
|
||||
if [ "$pid" != "" ]
|
||||
|
|
@ -81,4 +108,10 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
exit $?
|
||||
ret=$?
|
||||
if [ $locked -eq 1 ]
|
||||
then
|
||||
rm $LOCK
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
|
|
|
|||
|
|
@ -486,7 +486,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
}
|
||||
|
||||
// Check that the volume is stored on shared storage
|
||||
if (!_storageMgr.volumeOnSharedStoragePool(volume)) {
|
||||
if (!(Volume.State.Allocated.equals(volume.getState())) && !_storageMgr.volumeOnSharedStoragePool(volume)) {
|
||||
throw new InvalidParameterValueException("Please specify a volume that has been created on a shared storage pool.");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
from cloudstackAPI import *
|
||||
import unittest
|
||||
import cloudstackTestClient
|
||||
class cloudstackTestCase(unittest.case.TestCase):
|
||||
def __init__(self, args):
|
||||
unittest.case.TestCase.__init__(self, args)
|
||||
self.testClient = cloudstackTestClient.cloudstackTestClient()
|
||||
|
|
@ -4,7 +4,7 @@ import dbConnection
|
|||
from cloudstackAPI import *
|
||||
|
||||
class cloudstackTestClient(object):
|
||||
def __init__(self, mgtSvr, port=8096, apiKey = None, securityKey = None, asyncTimeout=3600, defaultWorkerThreads=10, logging=None):
|
||||
def __init__(self, mgtSvr=None, port=8096, apiKey = None, securityKey = None, asyncTimeout=3600, defaultWorkerThreads=10, logging=None):
|
||||
self.connection = cloudstackConnection.cloudConnection(mgtSvr, port, apiKey, securityKey, asyncTimeout, logging)
|
||||
self.apiClient = cloudstackAPIClient.CloudStackAPIClient(self.connection)
|
||||
self.dbConnection = None
|
||||
|
|
@ -15,7 +15,7 @@ class cloudstackTestClient(object):
|
|||
|
||||
def dbConfigure(self, host="localhost", port=3306, user='cloud', passwd='cloud', db='cloud'):
|
||||
self.dbConnection = dbConnection.dbConnection(host, port, user, passwd, db)
|
||||
self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient, self.dbConnection)
|
||||
|
||||
|
||||
def getDbConnection(self):
|
||||
return self.dbConnection
|
||||
|
|
@ -36,10 +36,10 @@ class cloudstackTestClient(object):
|
|||
|
||||
def submitCmdsAndWait(self, cmds):
|
||||
if self.asyncJobMgr is None:
|
||||
return None
|
||||
self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient, self.dbConnection)
|
||||
return self.asyncJobMgr.submitCmdsAndWait(cmds)
|
||||
|
||||
def submitJobs(self, job, ntimes=1, nums_threads=10, interval=1):
|
||||
if self.asyncJobMgr is None:
|
||||
return None
|
||||
self.asyncJobMgr = asyncJobMgr.asyncJobMgr(self.apiClient, self.dbConnection)
|
||||
self.asyncJobMgr.submitJobs(job, ntimes, nums_threads, interval)
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
import unittest
|
||||
import random
|
||||
from cloudstackAPI import *
|
||||
from cloudstackTestCase import *
|
||||
|
||||
class TestCase1(unittest.case.TestCase):
|
||||
class TestCase1(cloudstackTestCase):
|
||||
|
||||
def test_cloudstackapi(self):
|
||||
apiClient = self.testClient.getApiClient()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import unittest
|
||||
import random
|
||||
from cloudstackAPI import *
|
||||
class TestCase2(unittest.case.TestCase):
|
||||
from cloudstackTestCase import *
|
||||
class TestCase2(cloudstackTestCase):
|
||||
|
||||
def test_cloudstackapi1(self):
|
||||
apiClient = self.testClient.getApiClient()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
from cloudstackTestCase import *
|
||||
import uuid
|
||||
class TestCase1(cloudstackTestCase):
|
||||
def setUp(self):
|
||||
'''get a small service offering id'''
|
||||
listsocmd = listServiceOfferings.listServiceOfferingsCmd()
|
||||
listsocmd.name = "Small Instance"
|
||||
listsocmd.issystem = "false"
|
||||
sos = self.testClient.getApiClient().listServiceOfferings(listsocmd)
|
||||
if sos is not None and len(sos) > 0:
|
||||
self.svid = sos[0].id
|
||||
listdiskovcmd = listDiskOfferings.listDiskOfferingsCmd()
|
||||
listdiskovcmd.name = "Small"
|
||||
disoov = self.testClient.getApiClient().listDiskOfferings(listdiskovcmd)
|
||||
if disoov is not None and len(disoov) > 0:
|
||||
self.diskov = disoov[0].id
|
||||
|
||||
'''get user vm template id'''
|
||||
listtmplcmd = listTemplates.listTemplatesCmd()
|
||||
listtmplcmd.templatefilter = "featured"
|
||||
tmpls = self.testClient.getApiClient().listTemplates(listtmplcmd)
|
||||
if tmpls is not None:
|
||||
for tmpl in tmpls:
|
||||
if tmpl.isready == "true":
|
||||
self.templateId = tmpl.id
|
||||
self.zoneId = tmpl.zoneid
|
||||
break
|
||||
|
||||
def test_cloudstackapi(self):
|
||||
apiClient = self.testClient.getApiClient()
|
||||
|
||||
createvm = deployVirtualMachine.deployVirtualMachineCmd()
|
||||
createvm.serviceofferingid = self.svid
|
||||
createvm.templateid = self.templateId
|
||||
createvm.zoneid = self.zoneId
|
||||
vm = apiClient.deployVirtualMachine(createvm)
|
||||
vmId = vm.id
|
||||
|
||||
creatvolume = createVolume.createVolumeCmd()
|
||||
creatvolume.name = "tetst" + str(uuid.uuid4())
|
||||
creatvolume.diskofferingid = self.diskov
|
||||
creatvolume.zoneid = self.zoneId
|
||||
createvolumeresponse = apiClient.createVolume(creatvolume)
|
||||
volumeId = createvolumeresponse.id
|
||||
attach = attachVolume.attachVolumeCmd()
|
||||
|
||||
attach.id = volumeId
|
||||
attach.virtualmachineid = vmId
|
||||
apiClient.attachVolume(attach)
|
||||
|
|
@ -433,7 +433,7 @@ function volumeJsonToDetailsTab(){
|
|||
$thisTab.find("#vm_name").text(getVmName(jsonObj.vmname, jsonObj.vmdisplayname) + " (" + fromdb(jsonObj.vmstate) + ")");
|
||||
setDateField(jsonObj.created, $thisTab.find("#created"));
|
||||
|
||||
if(isAdmin() || isDomainAdmin()) {
|
||||
if(isAdmin()) {
|
||||
$thisTab.find("#storage").text(fromdb(jsonObj.storage));
|
||||
$thisTab.find("#storage_container").show();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue