Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss

This commit is contained in:
Sanjay Tripathi 2012-05-08 10:35:53 +05:30
commit 683b88d449
23 changed files with 179 additions and 132 deletions

View File

@ -33,7 +33,7 @@ public interface Volume extends ControlledEntity, BasedOn, StateObject<Volume.St
Expunging("The volume is being expunging"),
Destroy("The volume is destroyed, and can't be recovered."),
Uploading ("The volume upload is in progress"),
Uploaded ("The volume is uploaded"),
Uploaded ("The volume is uploaded and present on secondary storage"),
UploadError ("The volume couldnt be uploaded");
String _description;

View File

@ -10,6 +10,8 @@ label.number.of.system.vms=Number of System VMs
label.number.of.virtual.routers=Number of Virtual Routers
label.action.register.iso=Register ISO
label.isolation.method=Isolation method
label.action.register.template=Register template
label.checksum=MD5 checksum
#new labels (end) ************************************************************************************************

View File

@ -23,7 +23,8 @@ public class FrameBufferSizeChangeRequest extends AbstractRect {
public FrameBufferSizeChangeRequest(BufferedImageCanvas canvas, int width, int height) {
super(0, 0, width, height);
this.canvas=canvas;
this.canvas = canvas;
canvas.setCanvasSize(width, height);
}
@Override

View File

@ -71,6 +71,8 @@ public class FramebufferUpdatePacket {
case RfbConstants.ENCODING_DESKTOP_SIZE: {
rect = new FrameBufferSizeChangeRequest(canvas, width, height);
if(this.clientListener != null)
this.clientListener.onFramebufferSizeChange(width, height);
break;
}

View File

@ -208,13 +208,15 @@ add_routing() {
return 0;
}
add_snat() {
local pubIp=$1
local ipNoMask=$(echo $1 | awk -F'/' '{print $1}')
if [ "$sflag" == "0" ]
then
logger -t cloud "$(basename $0):Remove SourceNAT $pubIp on interface $ethDev if it is present"
sudo iptables -t nat -D POSTROUTING -j SNAT -o $ethDev --to-source $ipNoMask ;
return 0;
fi
local pubIp=$1
local ipNoMask=$(echo $1 | awk -F'/' '{print $1}')
logger -t cloud "$(basename $0):Added SourceNAT $pubIp on interface $ethDev"
sudo iptables -t nat -D POSTROUTING -j SNAT -o $ethDev --to-source $ipNoMask ;
sudo iptables -t nat -A POSTROUTING -j SNAT -o $ethDev --to-source $ipNoMask ;

View File

@ -726,7 +726,7 @@ def addFWFramework(brname):
execute("iptables -I FORWARD -o " + brname + " -j DROP")
execute("iptables -I FORWARD -i " + brname + " -m physdev --physdev-is-bridged -j " + brfw)
execute("iptables -I FORWARD -o " + brname + " -m physdev --physdev-is-bridged -j " + brfw)
phydev = execute("brctl show |grep " + brname + " | awk '{print $4}'").strip()
phydev = execute("brctl show |grep -w " + brname + " | awk '{print $4}'").strip()
execute("iptables -A " + brfw + " -m state --state RELATED,ESTABLISHED -j ACCEPT")
execute("iptables -A " + brfw + " -m physdev --physdev-is-bridged --physdev-is-in -j " + brfwin)
execute("iptables -A " + brfw + " -m physdev --physdev-is-bridged --physdev-is-out -j " + brfwout)

View File

@ -2335,6 +2335,10 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
boolean add = (ipAddr.getState() == IpAddress.State.Releasing ? false : true);
boolean sourceNat = ipAddr.isSourceNat();
/* enable sourceNAT for the first ip of the public interface */
if (firstIP) {
sourceNat = true;
}
String vlanId = ipAddr.getVlanTag();
String vlanGateway = ipAddr.getGateway();
String vlanNetmask = ipAddr.getNetmask();

View File

@ -226,4 +226,6 @@ public interface StorageManager extends StorageService, Manager {
Long clusterId, ServiceOfferingVO offering,
DiskOfferingVO diskOffering, List<StoragePoolVO> avoids, long size,
HypervisorType hyperType) throws NoTransitionException;
String getSupportedImageFormatForCluster(Long clusterId);
}

View File

@ -3802,4 +3802,21 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
return _volumeDao.search(sc, searchFilter);
}
@Override
public String getSupportedImageFormatForCluster(Long clusterId) {
ClusterVO cluster = ApiDBUtils.findClusterById(clusterId);
if (cluster.getHypervisorType() == HypervisorType.XenServer) {
return "vhd";
} else if (cluster.getHypervisorType() == HypervisorType.KVM) {
return "qcow2";
} else if (cluster.getHypervisorType() == HypervisorType.VMware) {
return "ova";
} else if (cluster.getHypervisorType() == HypervisorType.Ovm) {
return "raw";
} else {
return null;
}
}
}

View File

@ -109,7 +109,7 @@ public class PremiumDatabaseUpgradeChecker extends DatabaseUpgradeChecker {
_upgradeMap.put("2.2.10", new DbUpgrade[] { new Upgrade2210to2211(), new Upgrade2211to2212Premium(),
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade302to303() });
new Upgrade301to302(), new Upgrade302to303() });
_upgradeMap.put("2.2.11", new DbUpgrade[] { new Upgrade2211to2212Premium(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),

View File

@ -590,6 +590,11 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
volume = _storageMgr.createVolume(volume, vm, rootDiskTmplt, dcVO, pod, rootDiskPool.getClusterId(), svo, diskVO, new ArrayList<StoragePoolVO>(), volume.getSize(), rootDiskHyperType);
}else {
try {
// Format of data disk should be the same as root disk
if(_storageMgr.getSupportedImageFormatForCluster(rootDiskPool.getClusterId()) != volHostVO.getFormat().getFileExtension()){
throw new InvalidParameterValueException("Failed to attach volume to VM since volumes format " +volHostVO.getFormat().getFileExtension()+
" is not compatible with the vm hypervisor type" );
}
volume = _storageMgr.copyVolumeFromSecToPrimary(volume, vm, rootDiskTmplt, dcVO, pod, rootDiskPool.getClusterId(), svo, diskVO, new ArrayList<StoragePoolVO>(), volume.getSize(), rootDiskHyperType);
} catch (NoTransitionException e) {
e.printStackTrace();

View File

@ -1,5 +1,4 @@
/*[fmt]1C20-1C0D-E*/
/*dmin*/
/*+clearfix {*/
div.toolbar:after,
.multi-wizard .progress ul li:after,
@ -5454,6 +5453,10 @@ label.error {
overflow: hidden;
}
.multi-wizard.zone-wizard .setup-guest-traffic.basic .select-container {
background: #FFFFFF;
}
.multi-wizard.zone-wizard .main-desc {
width: 516px;
float: left;

View File

@ -2952,6 +2952,7 @@ dictionary = {
'message.validate.instance.name': '<fmt:message key="message.validate.instance.name" />',
'label.action.register.template': '<fmt:message key="label.action.register.template" />',
'label.action.register.iso': '<fmt:message key="label.action.register.iso" />',
'label.isolation.method': '<fmt:message key="label.isolation.method" />'
'label.isolation.method': '<fmt:message key="label.isolation.method" />',
'label.checksum': '<fmt:message key="label.checksum" />'
};
</script>

View File

@ -51,10 +51,7 @@
// For localization
return str;
},
label: 'label.state',
converter: function(str) {
return 'state.' + str;
},
label: 'label.state',
indicator: {
'enabled': 'on',
'Destroyed': 'off',

View File

@ -23,10 +23,14 @@ the session ID has been changed (i.e. another user logging into the UI via a dif
or it's the first time the user has come to this page.
*/
function onLogoutCallback() {
// Returning true means the LOGIN page will be show. If you wish to redirect the user
// to different login page, this is where you would do that.
g_loginResponse = null;
return true;
g_loginResponse = null; //clear single signon variable g_loginResponse
return true; // return true means the login page will show
/*
window.location.replace("http://www.google.com"); //redirect to a different location
return false; //return false means it will stay in the location window.location.replace() sets it to (i.e. "http://www.google.com")
*/
}
var g_loginResponse = null;

View File

@ -317,15 +317,14 @@
$.cookie('timezone', null);
$.cookie('supportELB', null);
if(onLogoutCallback()) { //set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
document.location.reload();
if(onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
document.location.reload(); //when onLogoutCallback() returns true, reload the current document.
}
},
error: function() {
if(onLogoutCallback()) { //set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
document.location.reload();
}
document.location.reload();
if(onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
document.location.reload(); //when onLogoutCallback() returns true, reload the current document.
}
},
beforeSend : function(XMLHttpResponse) {
return true;

View File

@ -47,11 +47,7 @@
instancename: { label: 'label.internal.name' },
zonename: { label: 'label.zone.name' },
state: {
label: 'label.state',
converter: function(str) {
// For localization
return 'state.' + str;
},
label: 'label.state',
indicator: {
'Running': 'on',
'Stopped': 'off',

View File

@ -899,11 +899,7 @@
title: 'label.menu.ipaddresses',
listView: {
id: 'ipAddresses',
label: 'IPs',
filters: {
allocated: { label: 'label.allocated' },
mine: { label: 'label.my.network' }
},
label: 'IPs',
fields: {
ipaddress: {
label: 'IP',

View File

@ -576,16 +576,13 @@
displaytext: { label: 'label.display.name' },
domain: { label: 'label.domain' },
account: { label: 'label.owner.account' },
state: {
converter: function(str) {
// For localization
return 'state.' + str;
},
label: 'label.status', indicator: {
converter: function(str) {
return 'state.' + str;
},
'Active': 'on', 'Destroyed': 'off', 'Disabled': 'off', 'Left Project': 'off'
state: {
label: 'label.status',
indicator: {
'Active': 'on',
'Destroyed': 'off',
'Disabled': 'off',
'Left Project': 'off'
}
}
},
@ -870,11 +867,7 @@
project: { label: 'label.project' },
domain: { label: 'label.domain' },
state: {
label: 'label.status',
converter: function(str) {
// For localization
return 'state.' + str;
},
label: 'label.status',
indicator: {
'Accepted': 'on', 'Completed': 'on',
'Pending': 'off', 'Declined': 'off'

View File

@ -35,14 +35,12 @@
type: { label: 'label.type' },
storagetype: { label: 'label.storage.type' },
vmdisplayname: { label: 'label.vm.display.name' },
state: {
converter: function(str) {
// For localization
return 'state.' + str;
},
label: 'State',
indicator: { 'Ready': 'on' }
}
state: {
label: 'State',
indicator: {
'Ready': 'on'
}
}
},
// List view actions
@ -172,8 +170,7 @@
poll: pollAsyncJobResult
}
},
//???
uploadVolume: {
isHeader: true,
label: 'label.upload.volume',
@ -216,7 +213,10 @@
url: {
label: 'label.url',
validation: { required: true }
}
},
checksum : {
label: 'label.checksum'
}
}
},
@ -226,26 +226,16 @@
array1.push("&zoneId=" + args.data.availabilityZone);
array1.push("&format=" + args.data.format);
array1.push("&url=" + todb(args.data.url));
if(args.data.checksum != null && args.data.checksum.length > 0)
array1.push("&checksum=" + todb(args.data.checksum));
$.ajax({
url: createURL("uploadVolume" + array1.join("")),
dataType: "json",
async: true,
success: function(json) {
debugger;
var jid = json.uploadvolumeresponse.jobid;
args.response.success(
{_custom:
{jobId: jid,
getUpdatedItem: function(json) {
return json.queryasyncjobresultresponse.jobresult.volume;
},
getActionFilter: function() {
return volumeActionfilter;
}
}
}
);
success: function(json) {
var items = json.uploadvolumeresponse.volume;
args.response.success({data:items[0]});
},
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
@ -254,11 +244,12 @@
},
notification: {
poll: pollAsyncJobResult
poll: function(args) {
args.complete();
}
}
}
//???
},
dataProvider: function(args) {
@ -1000,16 +991,11 @@
volumename: { label: 'label.volume' },
intervaltype: { label: 'label.interval.type' },
created: { label: 'label.created', converter: cloudStack.converters.toLocalDate },
state: {
converter: function(str) {
// For localization
return 'state.'+str;
},
label: 'label.state', indicator: {
converter: function(str) {
return 'state.' + str;
},
'BackedUp': 'on', 'Destroyed': 'off'
state: {
label: 'label.state',
indicator: {
'BackedUp': 'on',
'Destroyed': 'off'
}
}
},

View File

@ -1258,7 +1258,7 @@
var selectedNetworkOfferingId = $(this).val();
$(networkOfferingObjs).each(function(){
if(this.id == selectedNetworkOfferingId) {
if(this.guestiptype == "Isolated") {
if(this.guestiptype == "Isolated") { //*** Isolated ***
if(this.specifyipranges == false) {
$form.find('.form-item[rel=guestStartIp]').hide();
$form.find('.form-item[rel=guestEndIp]').hide();
@ -1266,26 +1266,40 @@
else {
$form.find('.form-item[rel=guestStartIp]').css('display', 'inline-block');
$form.find('.form-item[rel=guestEndIp]').css('display', 'inline-block');
}
var includingSourceNat = false;
var serviceObjArray = this.service;
for(var k = 0; k < serviceObjArray.length; k++) {
if(serviceObjArray[k].name == "SourceNat") {
includingSourceNat = true;
break;
}
}
if(includingSourceNat == true) { //Isolated with SourceNat
cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=guestGateway]')); //make guestGateway optional
cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=guestNetmask]')); //make guestNetmask optional
}
//cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=guestGateway]')); //make guestGateway optional
//cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=guestNetmask]')); //make guestNetmask optional
else { //Isolated with no SourceNat
cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=guestGateway]')); //make guestGateway required
cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=guestNetmask]')); //make guestNetmask required
}
}
else { //this.guestiptype == "Shared"
else { //*** Shared ***
$form.find('.form-item[rel=guestStartIp]').css('display', 'inline-block');
$form.find('.form-item[rel=guestEndIp]').css('display', 'inline-block');
//cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=guestGateway]')); //make guestGateway required
//cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=guestNetmask]')); //make guestNetmask required
cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=guestGateway]')); //make guestGateway required
cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=guestNetmask]')); //make guestNetmask required
}
if(this.specifyvlan == false) {
$form.find('.form-item[rel=vlanId]').hide();
//cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=vlanId]')); //make vlanId optional
cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=vlanId]')); //make vlanId optional
}
else {
$form.find('.form-item[rel=vlanId]').css('display', 'inline-block');
//cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=vlanId]')); //make vlanId required
cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=vlanId]')); //make vlanId required
}
return false; //break each loop
}
@ -7815,10 +7829,7 @@
'Enabled': 'on',
'Disabled': 'off',
'Destroyed': 'off'
},
converter: function(str) {
return 'state.' + str;
}
}
}
},

View File

@ -53,6 +53,7 @@
var fields = $.map(args.form.fields, function(value, key) {
return key;
})
$(fields).each(function() {
var key = this;
var field = args.form.fields[key];
@ -86,15 +87,21 @@
closeOnEscape: false
}); */
// Label field
//if( field.label == 'label.network.offering' || field.label == 'label.guest.gateway')
// debugger;
var $name = $('<div>').addClass('name')
.appendTo($formItem)
.append(
$('<label>').html(_l(field.label) + ':')
);
// Add 'required asterisk' if field is required
if (field.validation && field.validation.required) {
$name.find('label').prepend($('<span>').addClass('field-required').html('*'));
// red asterisk
var $astersikSpan = $('<span>').addClass('field-required').html('*');
$name.find('label').prepend($astersikSpan);
if (field.validation == null || field.validation.required == false) {
$astersikSpan.hide();
}
// Tooltip description
@ -314,25 +321,31 @@
$input.addClass("disallowSpecialCharacters");
}
$input.data('validation-rules', field.validation);
$('<label>').addClass('error').appendTo($value).html('*' + _l('label.required'));
if(field.validation != null)
$input.data('validation-rules', field.validation);
else
$input.data('validation-rules', {});
});
$form.find('select').trigger('change');
var getFormValues = function() {
var formValues = {};
$.each(args.form.fields, function(key) {});
};
// Setup form validation
// Setup form validation
$formContainer.find('form').validate();
$formContainer.find('input, select').each(function() {
$formContainer.find('input, select').each(function() {
if ($(this).data('validation-rules')) {
$(this).rules('add', $(this).data('validation-rules'));
}
});
else {
$(this).rules('add', {});
}
});
$form.find('select').trigger('change');
var complete = function($formContainer) {
var $form = $formContainer.find('form');
var data = cloudStack.serializeForm($form);
@ -404,31 +417,36 @@
createFormField: {
validation: {
required: {
add: function($formField) {
if($formField.find('.name').find('label').find('span.field-required').length == 0) {
$formField.find('.name').find('label').prepend($('<span>').addClass('field-required').html('*'));
var $input = $formField.find('input');
var validationRules = $input.data('validation-rules');
add: function($formField) {
var $input = $formField.find('input, select');
var validationRules = $input.data('validation-rules');
if(validationRules == null || validationRules.required == null || validationRules.required == false) {
$formField.find('.name').find('label').find('span.field-required').css('display', 'inline'); //show red asterisk
if(validationRules == null)
validationRules = {};
validationRules = {};
validationRules.required = true;
$input.data('validation-rules', validationRules);
}
},
remove: function($formField) {
if($formField.find('.name').find('label').find('span.field-required').length > 0) {
$formField.find('.name').find('label').find('span.field-required').remove();
var $input = $formField.find('input');
var validationRules = $input.data('validation-rules');
if(validationRules != null && validationRules.required != null)
delete validationRules.required;
$input.data('validation-rules', validationRules);
//$formField.find('.value').find('label.error[generated=true]').remove();
$formField.find('.value').find('label.error').hide();
}
$input.rules('add', { required: true });
}
},
remove: function($formField) {
var $input = $formField.find('input, select');
var validationRules = $input.data('validation-rules');
if(validationRules != null && validationRules.required != null && validationRules.required == true) {
$formField.find('.name').find('label').find('span.field-required').hide(); //hide red asterisk
delete validationRules.required;
$input.data('validation-rules', validationRules);
$input.rules('remove', 'required');
$formField.find('.value').find('label.error').hide();
}
}
}
}

View File

@ -235,6 +235,14 @@
},
configureGuestTraffic: function(args) {
if (args.data['network-model'] == 'Basic') {
$('.setup-guest-traffic').addClass('basic');
$('.setup-guest-traffic').removeClass('advanced');
} else {
$('.setup-guest-traffic').removeClass('basic');
$('.setup-guest-traffic').addClass('advanced');
}
return args.data['network-model'] == 'Basic' ||
$.grep(args.groupedData.physicalNetworks, function(network) {
return $.inArray('guest', network.trafficTypes) > -1;