limit vmName to 15 chars for Windows
This commit is contained in:
Родитель
64f01181e8
Коммит
df06980ab7
|
@ -682,7 +682,24 @@ exports.init = function(cli) {
|
|||
});
|
||||
}
|
||||
|
||||
var vmName = dnsPrefix + crypto.randomBytes(8).toString('hex');
|
||||
var roleList = response.body.RoleList;
|
||||
var maxNum = 1;
|
||||
for (var i = 0; i < roleList.length; i++) {
|
||||
var numSplit = roleList[i].RoleName.split('-');
|
||||
if (numSplit.length > 1) {
|
||||
// did it start with dnsPrefix? If not, ignore.
|
||||
var leftSplit = numSplit.slice(0, -1).join('-');
|
||||
if (leftSplit === dnsPrefix.slice(0, leftSplit.length)) {
|
||||
var num = parseInt(numSplit[numSplit.length - 1], 10);
|
||||
if (!isNaN(num) && num !== num + 1 && num > maxNum) { // number that is not too big
|
||||
maxNum = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var tag = '-' + (maxNum + 1);
|
||||
var vmName = image.OS.toLowerCase() === 'linux' ? dnsPrefix : dnsPrefix.slice(0, 15 - tag.length);
|
||||
vmName += tag;
|
||||
if (!role) {
|
||||
createDefaultRole(vmName, addRole_);
|
||||
} else {
|
||||
|
@ -884,7 +901,7 @@ exports.init = function(cli) {
|
|||
var mediaLink = diskInfo.MediaLink;
|
||||
logger.verbose('Deleting disk ' + diskName + ' @ ' + mediaLink);
|
||||
deleteImage.deleteImage('Disk', 'Disk', logger, channel, diskName, mediaLink,
|
||||
null, null, true, function(error) {
|
||||
progress, true, function(error) {
|
||||
doneCount++;
|
||||
logger.silly('Finished deleding disk ' + doneCount + ' of ' + allCount +
|
||||
error ? 'error' : '');
|
||||
|
|
Загрузка…
Ссылка в новой задаче