[jira] [Commented] (CLOUDSTACK-10293) Single view network ACL rules listing

2018-02-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16368775#comment-16368775
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10293:
-

nvazquez commented on a change in pull request #2456: [CLOUDSTACK-10293] Single 
view network ACL rules listing
URL: https://github.com/apache/cloudstack/pull/2456#discussion_r168984710
 
 

 ##
 File path: ui/scripts/vpc.js
 ##
 @@ -1333,35 +1321,65 @@
 $.ajax({
 url: 
createURL('listNetworkACLs=' + args.context.aclLists[0].id),
 success: function(json) {
-var items = 
json.listnetworkaclsresponse.networkacl.sort(function(a, b) {
-return a.number >= 
b.number;
-}).map(function(acl) {
-if 
(parseInt(acl.protocol)) { // protocol number
-acl.protocolnumber 
= acl.protocol;
-acl.protocol = 
"protocolnumber";
-}
-
-return acl;
-});
+var items = 
json.listnetworkaclsresponse.networkacl;
+
+if(items){
+items.sort(function(a, 
b) {
+return a.number >= 
b.number;
+}).map(function(acl) {
+if 
(parseInt(acl.protocol)) { // protocol number
+
acl.protocolnumber = acl.protocol;
+acl.protocol = 
"protocolnumber";
+}
+
+return acl;
+});
+}
 
 args.response.success({
 data: items
-/* {
-   cidrlist: '10.1.1.0/24',
-   protocol: 'TCP',
-   startport: 22, endport: 22,
-   networkid: 0,
-   traffictype: 'Egress'
-   },
-   {
-   cidrlist: '10.2.1.0/24',
-   protocol: 'UDP',
-   startport: 56, endport: 72,
-   networkid: 0,
-   trafficType: 'Ingress'
-   }
-   ]*/
 });
+
if(jQuery('#details-tab-aclRules').siblings('div.toolbar').children('div.add').size()
 === 0){
+var 
$addAclRuleDivButton = jQuery('').addClass('button add');
+var 
$spanAddAclRuleButtonMessage = jQuery('').html(_l('label.add.ACL'));
+
+
$addAclRuleDivButton.html($spanAddAclRuleButtonMessage);
+
$addAclRuleDivButton.click(function(){
+   
cloudStack.dialog.createForm({
+form: {
+ title: 
'label.add.rule',
+ desc: 
'Create a new ACL rule',
+ fields: 
aclRuleFields
+ },
+ after: 
function(argsLocal) {
+var 
data = argsLocal.data;
+
data.aclid = 

[jira] [Commented] (CLOUDSTACK-10293) Single view network ACL rules listing

2018-02-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16368767#comment-16368767
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10293:
-

nvazquez commented on a change in pull request #2456: [CLOUDSTACK-10293] Single 
view network ACL rules listing
URL: https://github.com/apache/cloudstack/pull/2456#discussion_r168983742
 
 

 ##
 File path: ui/scripts/vpc.js
 ##
 @@ -1333,35 +1321,65 @@
 $.ajax({
 url: 
createURL('listNetworkACLs=' + args.context.aclLists[0].id),
 success: function(json) {
-var items = 
json.listnetworkaclsresponse.networkacl.sort(function(a, b) {
-return a.number >= 
b.number;
-}).map(function(acl) {
-if 
(parseInt(acl.protocol)) { // protocol number
-acl.protocolnumber 
= acl.protocol;
-acl.protocol = 
"protocolnumber";
-}
-
-return acl;
-});
+var items = 
json.listnetworkaclsresponse.networkacl;
+
+if(items){
+items.sort(function(a, 
b) {
+return a.number >= 
b.number;
+}).map(function(acl) {
+if 
(parseInt(acl.protocol)) { // protocol number
+
acl.protocolnumber = acl.protocol;
+acl.protocol = 
"protocolnumber";
+}
+
+return acl;
+});
+}
 
 args.response.success({
 data: items
-/* {
-   cidrlist: '10.1.1.0/24',
-   protocol: 'TCP',
-   startport: 22, endport: 22,
-   networkid: 0,
-   traffictype: 'Egress'
-   },
-   {
-   cidrlist: '10.2.1.0/24',
-   protocol: 'UDP',
-   startport: 56, endport: 72,
-   networkid: 0,
-   trafficType: 'Ingress'
-   }
-   ]*/
 });
+
if(jQuery('#details-tab-aclRules').siblings('div.toolbar').children('div.add').size()
 === 0){
+var 
$addAclRuleDivButton = jQuery('').addClass('button add');
+var 
$spanAddAclRuleButtonMessage = jQuery('').html(_l('label.add.ACL'));
+
+
$addAclRuleDivButton.html($spanAddAclRuleButtonMessage);
+
$addAclRuleDivButton.click(function(){
+   
cloudStack.dialog.createForm({
+form: {
+ title: 
'label.add.rule',
+ desc: 
'Create a new ACL rule',
 
 Review comment:
   How about using internationalization here as well?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Single view network ACL rules listing
> 

[jira] [Commented] (CLOUDSTACK-10293) Single view network ACL rules listing

2018-02-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16368763#comment-16368763
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10293:
-

nvazquez commented on a change in pull request #2456: [CLOUDSTACK-10293] Single 
view network ACL rules listing
URL: https://github.com/apache/cloudstack/pull/2456#discussion_r168983543
 
 

 ##
 File path: ui/scripts/vpc.js
 ##
 @@ -436,6 +401,38 @@
 isOptional: true,
 isEditable: true
 },
+'icmptype': {
+edit: true,
+label: 'ICMP.type',
+desc: 'Please specify -1 if you want to allow all ICMP types',
 
 Review comment:
   How about adding internationalization to desc field? (the same for icmpcode 
below)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Single view network ACL rules listing
> -
>
> Key: CLOUDSTACK-10293
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10293
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>Reporter: Rafael Weingärtner
>Assignee: Rafael Weingärtner
>Priority: Major
> Fix For: 4.12
>
>
> The ACL rules editing/addition page is not user-friendly. Users are not able 
> to see in a single view all of the detail of the ACL rule (they need to use a 
> scroll bar on the horizontal). The problem becomes worse when there are a 
> considerable number of rules. Therefore, we are proposing the following 
> changes:
> # Instead of using the table to create new ACL, we can create a button like 
> the one presented in attached pictures, where users can click, and then a 
> modal popup would appear and users would be able to create the new ACL there. 
> This is similar to the workings of the ACL edit button.
> # Remove the ability to add new ACL via table where they are presented. All 
> ACLs should be entered via the “New ACL” button. Therefore, the section “Add 
> ACL” would be removed as well;
> # Move the action section of the list ACL table to the most left position;
>  
> These changes would reduce the information in the table and facilitate users 
> to add new rules and easily edit them as well.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10250) Reinstall VM from bypassed registered template

2018-02-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16368756#comment-16368756
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10250:
-

nvazquez commented on issue #2423: CLOUDSTACK-10250: Reinstall VM from bypassed 
registered template
URL: https://github.com/apache/cloudstack/pull/2423#issuecomment-366579490
 
 
   Closing, as it is included on 2408


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Reinstall VM from bypassed registered template
> --
>
> Key: CLOUDSTACK-10250
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10250
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>Affects Versions: 4.11.0.0
>Reporter: Nicolas Vazquez
>Assignee: Nicolas Vazquez
>Priority: Major
>
> This fix allows users to restore a VM from a previously registered template 
> using the Direct Download option (only for KVM currently)
> NOTE: As Reinstall VM button prompts only featured templates, to be able to 
> restore a vm to a Direct Download template, it should be registered as 
> Featured



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10250) Reinstall VM from bypassed registered template

2018-02-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10250?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16368757#comment-16368757
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10250:
-

nvazquez closed pull request #2423: CLOUDSTACK-10250: Reinstall VM from 
bypassed registered template
URL: https://github.com/apache/cloudstack/pull/2423
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java 
b/server/src/com/cloud/vm/UserVmManagerImpl.java
index dab741c3c27..a5bfc47584d 100644
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -313,6 +313,7 @@
 import com.cloud.vm.snapshot.VMSnapshotVO;
 import com.cloud.vm.snapshot.dao.VMSnapshotDao;
 import com.cloud.storage.snapshot.SnapshotApiService;
+import com.cloud.storage.VMTemplateStorageResourceAssoc;
 
 public class UserVmManagerImpl extends ManagerBase implements UserVmManager, 
VirtualMachineGuru, UserVmService, Configurable {
 private static final Logger s_logger = 
Logger.getLogger(UserVmManagerImpl.class);
@@ -6100,10 +6101,8 @@ public UserVm restoreVMInternal(Account caller, UserVmVO 
vm, Long newTemplateId)
 throw ex;
 }
 }
-TemplateDataStoreVO tmplStore = 
_templateStoreDao.findByTemplateZoneReady(template.getId(), 
vm.getDataCenterId());
-if (tmplStore == null) {
-throw new InvalidParameterValueException("Cannot restore the 
vm as the template " + template.getUuid() + " isn't available in the zone");
-}
+
+checkRestoreVmFromTemplate(vm, template);
 
 if (needRestart) {
 try {
@@ -6217,6 +6216,27 @@ public UserVm restoreVMInternal(Account caller, UserVmVO 
vm, Long newTemplateId)
 
 }
 
+/**
+ * Perform basic checkings to make sure restore is possible. If not, 
#InvalidParameterValueException is thrown
+ * @param vm vm
+ * @param template template
+ * @throws InvalidParameterValueException if restore is not possible
+ */
+private void checkRestoreVmFromTemplate(UserVmVO vm, VMTemplateVO 
template) {
+TemplateDataStoreVO tmplStore;
+if (!template.isDirectDownload()) {
+tmplStore = 
_templateStoreDao.findByTemplateZoneReady(template.getId(), 
vm.getDataCenterId());
+if (tmplStore == null) {
+throw new InvalidParameterValueException("Cannot restore the 
vm as the template " + template.getUuid() + " isn't available in the zone");
+}
+} else {
+tmplStore = _templateStoreDao.findByTemplate(template.getId(), 
DataStoreRole.Image);
+if (tmplStore == null || (tmplStore != null && 
!tmplStore.getDownloadState().equals(VMTemplateStorageResourceAssoc.Status.BYPASSED)))
 {
+throw new InvalidParameterValueException("Cannot restore the 
vm as the bypassed template " + template.getUuid() + " isn't available in the 
zone");
+}
+}
+}
+
 private void handleManagedStorage(UserVmVO vm, VolumeVO root) {
 if (Volume.State.Allocated.equals(root.getState())) {
 return;


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Reinstall VM from bypassed registered template
> --
>
> Key: CLOUDSTACK-10250
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10250
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>Affects Versions: 4.11.0.0
>Reporter: Nicolas Vazquez
>Assignee: Nicolas Vazquez
>Priority: Major
>
> This fix allows users to restore a VM from a previously registered template 
> using the Direct Download option (only for KVM currently)
> NOTE: As Reinstall VM button prompts only featured templates, to be able to 
> restore a vm to a Direct Download template, it should be registered as 
> Featured



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10238) Fix for metalink support on SSVM agents

2018-02-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16368754#comment-16368754
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10238:
-

nvazquez commented on issue #2411: CLOUDSTACK-10238: Fix for metalink support 
on SSVM agents
URL: https://github.com/apache/cloudstack/pull/2411#issuecomment-366579457
 
 
   Closing as it is included on 2408


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Fix for metalink support on SSVM agents
> ---
>
> Key: CLOUDSTACK-10238
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10238
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>Reporter: Nicolas Vazquez
>Assignee: Nicolas Vazquez
>Priority: Major
>
> Fix for metalink support



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (CLOUDSTACK-10238) Fix for metalink support on SSVM agents

2018-02-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16368755#comment-16368755
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10238:
-

nvazquez closed pull request #2411: CLOUDSTACK-10238: Fix for metalink support 
on SSVM agents
URL: https://github.com/apache/cloudstack/pull/2411
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/core/src/com/cloud/storage/template/MetalinkTemplateDownloader.java 
b/core/src/com/cloud/storage/template/MetalinkTemplateDownloader.java
index 149c6a1e826..bf898c52cd9 100644
--- a/core/src/com/cloud/storage/template/MetalinkTemplateDownloader.java
+++ b/core/src/com/cloud/storage/template/MetalinkTemplateDownloader.java
@@ -34,22 +34,41 @@ public MetalinkTemplateDownloader(StorageLayer 
storageLayer, String downloadUrl,
 super(storageLayer, downloadUrl, toDir, maxTemplateSize, callback);
 String[] parts = _downloadUrl.split("/");
 String filename = parts[parts.length - 1];
+_callback = callback;
 _toFile = toDir + File.separator + filename;
 }
 
 @Override
 public long download(boolean resume, DownloadCompleteCallback callback) {
-if (!status.equals(Status.NOT_STARTED)) {
-// Only start downloading if we haven't started yet.
-LOGGER.debug("Template download is already started, not starting 
again. Template: " + _downloadUrl);
+if (_status == Status.ABORTED || _status == Status.UNRECOVERABLE_ERROR 
|| _status == Status.DOWNLOAD_FINISHED) {
 return 0;
 }
+
+LOGGER.info("Starting metalink download from: " + _downloadUrl);
+_start = System.currentTimeMillis();
+
 status = Status.IN_PROGRESS;
 Script.runSimpleBashScript("aria2c " + _downloadUrl + " -d " + _toDir);
+String metalinkFile = _toFile;
+Script.runSimpleBashScript("rm -f " + metalinkFile);
+String templateFileName = Script.runSimpleBashScript("ls " + _toDir);
+String downloadedFile = _toDir + File.separator + templateFileName;
+_toFile = _toDir + File.separator + "tmpdownld_";
+Script.runSimpleBashScript("mv " + downloadedFile + " " + _toFile);
+
+File file = new File(_toFile);
+if (!file.exists()) {
+_status = Status.UNRECOVERABLE_ERROR;
+LOGGER.error("Error downloading template from: " + _downloadUrl);
+return 0;
+}
+_totalBytes = file.length();
 status = Status.DOWNLOAD_FINISHED;
-String sizeResult = Script.runSimpleBashScript("ls -als " + _toFile + 
" | awk '{print $1}'");
-long size = Long.parseLong(sizeResult);
-return size;
+_downloadTime = System.currentTimeMillis() - _start;
+if (_callback != null) {
+_callback.downloadComplete(status);
+}
+return _totalBytes;
 }
 
 @Override
@@ -63,4 +82,13 @@ public int getDownloadPercent() {
 }
 }
 
+@Override
+public Status getStatus() {
+return status;
+}
+
+@Override
+public void setStatus(Status status) {
+this.status = status;
+}
 }
diff --git a/utils/src/main/java/com/cloud/utils/UriUtils.java 
b/utils/src/main/java/com/cloud/utils/UriUtils.java
index d7fbb89e47e..c91c9cc307c 100644
--- a/utils/src/main/java/com/cloud/utils/UriUtils.java
+++ b/utils/src/main/java/com/cloud/utils/UriUtils.java
@@ -444,7 +444,8 @@ private static void checkFormat(String format, String 
uripath) {
 && (!uripath.toLowerCase().endsWith("ova")
 && !uripath.toLowerCase().endsWith("ova.zip")
 && !uripath.toLowerCase().endsWith("ova.bz2")
-&& !uripath.toLowerCase().endsWith("ova.gz")))
+&& !uripath.toLowerCase().endsWith("ova.gz")
+&& !uripath.toLowerCase().endsWith("metalink")))
 || (format.equalsIgnoreCase("tar")
 && (!uripath.toLowerCase().endsWith("tar")
 && !uripath.toLowerCase().endsWith("tar.zip")
@@ -468,7 +469,8 @@ private static void checkFormat(String format, String 
uripath) {
 && (!uripath.toLowerCase().endsWith("iso")
 && !uripath.toLowerCase().endsWith("iso.zip")
 && !uripath.toLowerCase().endsWith("iso.bz2")
-&& !uripath.toLowerCase().endsWith("iso.gz" {
+&& !uripath.toLowerCase().endsWith("iso.gz"))
+&& !uripath.toLowerCase().endsWith("metalink"))) {
 throw new IllegalArgumentException("Please 

[jira] [Commented] (CLOUDSTACK-10293) Single view network ACL rules listing

2018-02-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/CLOUDSTACK-10293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16368739#comment-16368739
 ] 

ASF GitHub Bot commented on CLOUDSTACK-10293:
-

rafaelweingartner commented on issue #2456: [CLOUDSTACK-10293] Single view 
network ACL rules listing
URL: https://github.com/apache/cloudstack/pull/2456#issuecomment-366570188
 
 
   How do we proceed with this one? Will reviewers feedback be enough? No code 
was changed in the server side.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Single view network ACL rules listing
> -
>
> Key: CLOUDSTACK-10293
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10293
> Project: CloudStack
>  Issue Type: Bug
>  Security Level: Public(Anyone can view this level - this is the 
> default.) 
>Reporter: Rafael Weingärtner
>Assignee: Rafael Weingärtner
>Priority: Major
> Fix For: 4.12
>
>
> The ACL rules editing/addition page is not user-friendly. Users are not able 
> to see in a single view all of the detail of the ACL rule (they need to use a 
> scroll bar on the horizontal). The problem becomes worse when there are a 
> considerable number of rules. Therefore, we are proposing the following 
> changes:
> # Instead of using the table to create new ACL, we can create a button like 
> the one presented in attached pictures, where users can click, and then a 
> modal popup would appear and users would be able to create the new ACL there. 
> This is similar to the workings of the ACL edit button.
> # Remove the ability to add new ACL via table where they are presented. All 
> ACLs should be entered via the “New ACL” button. Therefore, the section “Add 
> ACL” would be removed as well;
> # Move the action section of the list ACL table to the most left position;
>  
> These changes would reduce the information in the table and facilitate users 
> to add new rules and easily edit them as well.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)