Skip to content

Conversation

@shwstppr
Copy link
Contributor

@shwstppr shwstppr commented Aug 7, 2025

Fixes #144

When using cmk in its shell, the following APIs will prompt for file upload,

  • getuploadparamsforiso
  • getuploadparamsforvolume
  • getuploadparamsfotemplate

The user can input file paths separated by a comma to allow uploading of files

cmk-upload-arg.mp4

@shwstppr shwstppr marked this pull request as ready for review August 8, 2025 06:29
@shwstppr shwstppr added this to the 6.5.0 milestone Aug 8, 2025
@shwstppr shwstppr closed this Aug 8, 2025
@shwstppr shwstppr reopened this Aug 8, 2025
@shwstppr shwstppr closed this Aug 8, 2025
@shwstppr shwstppr reopened this Aug 8, 2025
@github-actions
Copy link

github-actions bot commented Aug 8, 2025

✅ Build complete for PR #177.

🔗 Download the cmk binaries (expires on August 23, 2025)

@rohityadavcloud
Copy link
Member

rohityadavcloud commented Aug 11, 2025

@shwstppr can we add a file= or filepath= parameter for only cmk to:

  • check that file exists & is readable (mod bits...)
  • move this in the first step itself, so cmk does not need to prompt the user and it simply / automatically upload the provided file or filepath to ACS
  • optional - can we show some kind of upload progress bar (using ascii chars like [==== ] percent% here) like pv (https://www.geeksforgeeks.org/linux-unix/pv-command-in-linux-with-examples/)

https://github.com/charmbracelet/bubbles
https://github.com/cheggaaa/pb
https://github.com/briandowns/spinner (like 36)

@shwstppr
Copy link
Contributor Author

@shwstppr can we add a file= or filepath= parameter for only cmk to:

* check that file exists & is readable (mod bits...)

* move this in the first step itself, so cmk does not need to prompt the user and it simply / automatically upload the provided file or filepath to ACS

* optional - can we show some kind of upload progress bar (using ascii chars like [====   ] percent% here) like pv (https://www.geeksforgeeks.org/linux-unix/pv-command-in-linux-with-examples/)

https://github.com/charmbracelet/bubbles https://github.com/cheggaaa/pb https://github.com/briandowns/spinner (like 36)

@rohityadavcloud when not in shell, should the response return any additional data or just the response of upload API?

Copy link
Member

@rohityadavcloud rohityadavcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't test this - but really exciting feature!

@DaanHoogland
Copy link
Contributor

@shwstppr , in you flick I can see you are using https. I did not get to work (yet) http works fine. Any howto for enabling https from the cli?

(randy) 🐱 > get uploadparamsfortemplate zoneid=bbfa5a32-88b2-4721-b5b7-27e5b31f0712 format=qcow2 hypervisor=kvm name=fedora ostypeid=8e6168d7-4629-4d09-b305-d18081489f84 filepath=/Users/daan/Downloads/Fedora-Cloud-Base-Generic-42-1.1.x86_64.qcow2 
{
  "getuploadparams": {
    "expires": "2025-08-14T14:47:08.548Z",
    "id": "f27fb284-b1f8-4468-a236-57726159532b",
    "metadata": "LK9xw79RipRAwje0RqDEg4vurZ6YN8JUPMldeZ0goafGnbCUTDNE0oRS4ViDj3gZlAwf8WEtiW7V6ul8auj2iR4zwAFHSrM2qcKIEkvwA6OalVq1uvV1LX8yKSN2pVng1nCQ9OZDIKZM0ySZHzuqC6l8wiaWmI4S7+IpRV94GkqMh2n+FPAT3tqLzy008LInpoSHbla35Y70KCn6OXPyWmPPxKysUjjt55hwdnDa0JRKNsNMFxMXMz2U56nmIGz5MtncLg7rAOQd5u1lgmnw976X2kqKUCnqMyG4NNZppFdyeqj8WIdqQq+xwMbY4/nyhYunDUhF0XrbXK+9NEFzq4SMhG0kalQU/vCdZwFjqzMaYxrlxn7fIqV9xBFy98p/nwxPk8zZopJ5IntNjjiO6RYTu0Zdm7rbTT3cCI4GtWdKF/9Ap2cMhzw8B9hSoxXw3+sEuk9u8ztpe6RFDAaLlIF94Ycoj2C43b9gvHuyztI3RBHiKvyLjR1X14EymISAYZTp0k8TuOBTcWPsvQelCslAnY55ozrwwom0M72S2r2/v3lTu4fAc3U7CKO7H8VW4J1bMed2r/FQ0SGNiaz06s3hrZ4Rbz7yeS8ks0xVSX/xRQPtGOEyAanwDgUu8Q5jcuDmpUewlN98LKxGEB94UaT9oS5m9dCKOLjkuYvM62tNOHlKJLcVsAHcG1M=",
    "postURL": "https://10.0.55.142/upload/f27fb284-b1f8-4468-a236-57726159532b",
    "signature": "7WmkTDhbcNr0qRuk5KB7Vk76byk="
  }
}
Uploading files for getUploadParamsForTemplate : [/Users/daan/Downloads/Fedora-Cloud-Base-Generic-42-1.1.x86_64.qcow2]
Error uploading /Users/daan/Downloads/Fedora-Cloud-Base-Generic-42-1.1.x86_64.qcow2 : Post "https://10.0.55.142/upload/f27fb284-b1f8-4468-a236-57726159532b": tls: failed to verify certificate: x509: “*.realhostip.com” certificate is using a broken signature algorithm
🙈 1 out of 1 files failed to upload.

with http:

(randy) 🐱 > get uploadparamsfortemplate zoneid=bbfa5a32-88b2-4721-b5b7-27e5b31f0712 format=qcow2 hypervisor=kvm name=fedora ostypeid=8e6168d7-4629-4d09-b305-d18081489f84 filepath=/Users/daan/Downloads/Fedora-Cloud-Base-Generic-42-1.1.x86_64.qcow2
getuploadparams:
+--------------------------+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------+------------------------------+
|         EXPIRES          |                  ID                  |                                                                                                                                                                                                                                                                                                                                                           METADATA                                                                                                                                                                                                                                                                                                                                                           |                            POSTURL                             |          SIGNATURE           |
+--------------------------+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------+------------------------------+
| 2025-08-14T15:34:04.701Z | 23e6a5cf-d76a-42c4-b7c3-4f26a55f9305 | cWjoJlqAwF54Xqdlej7oFMUsD+kT3uBqt3FjR6q6a3sCoL3YZwWQBRTaNGYXIwdsdyPAwuUV2XqZWQTUxUXlbCmFLjeLmpv9Z0PRbHv+rSP0QX6rwAJb/0HOtCEp88fHYV3j2PbGy6HZAgbZLfksSVyNbQWC4SInGaXHsyojYdRLPsqBd75X0pS0GBIprbaN+UVRkHttF8CEOar3d4fahOZ6N5n818waLTL6Bt6Hfv2JduAONUEyaF2zDk7tQqhVnBbz9JCVtKlEwkeZ5RE2/bz3xVZXNqtMXmuOGUDFEfvr3gsnQ3qq0Y8pXffS1oe1nMzU1NorvvAeiQ8SJ3dOxU1RbiDR+udskBYNjRydUy0wKXSI2uFTLVVwgyBoAUDu/xHAJlOYws4y24+Qi8Nq0UuJ+TOk+ZLtTIK9O4c5vxYBEOKc7ZXSuoIQy8obhlC411Mxd75tflMPGv0XMRs2Fr6sojU+LabFcW14DAJiWyMiT2+zSzHs84Q/C0wFNurqkdjIzb25Yt+U0eAfdeGN+mJNhiZLuHypGmBamYHTCuWyjyYW4o8L+rBwjm4PDzRPlTSYgv4Ecp6e8p2rDAYjjzs/l9EugGfEmP1AG61UrJF62Ie9RfZPSleLEgSiCeRrZ+gGRY/RK7Wfok1p9rbHg9U2JekcaZMY4Ke9uFy4wnsOTZpI3TLxw6ikIw0= | http://10.0.55.142/upload/23e6a5cf-d76a-42c4-b7c3-4f26a55f9305 | k7vNh4vBazL7LZc7zikI+ybrstc= |
+--------------------------+--------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------+------------------------------+
Uploading files for getUploadParamsForTemplate : [/Users/daan/Downloads/Fedora-Cloud-Base-Generic-42-1.1.x86_64.qcow2]
⣟ 😺 [1/1] Fedora-Cloud-Base-Generic-42-1.1.x86_64.qcow2	[===============>        ] 63%

@weizhouapache
Copy link
Member

@shwstppr , in you flick I can see you are using https. I did not get to work (yet) http works fine. Any howto for enabling https from the cli?

does https upload work on the UI ?

@shwstppr
Copy link
Contributor Author

@DaanHoogland my testing was with http. I think we may have to add another param to support self signed certificates

@weizhouapache
Copy link
Member

@DaanHoogland @shwstppr

https works in my testing

(localcloud) 🐱 > get uploadparamsfortemplate format=qcow2 hypervisor=kvm name=systemvm-upload ostypeid=f85a99a8-782d-11f0-a8cb-1e001b0003c8 zoneid=e58d87c5-bc92-47f3-9395-ce3f1a0dd415 filepath=/root/systemvmtemplate-4.20.2-x86_64-kvm.qcow2
{
  "getuploadparams": {
    "expires": "2025-08-15T08:37:44.223Z",
    "id": "a9197f7f-73e0-4707-b5da-89b3b372a9ae",
    "metadata": "awP2MN5HGEjF5vfdgpxyrSlr0CGN5ifW7Tx5z+UDO9yl3EqjqLqZs+WOgOY/PV7i4t3eiTTRJu+OMBVd8wln/8ar0wOIti9pL3/IBdIwi1Q1mlvE5w60fsKXHi+1xZXxaDFIVlUHtaDMG+HUE6IePnBiqYc73UGmyKCf+GxBluX8Fmvm3trTAeJKDnFKk6ws++QdXPGNxjnq3fLxgPxTm9Dm8Dl1p5hHt2Y/MW08SGKll9DvBT7gtVc0nZ7kS157FBIqCPTDJP/Df8Fz5kSH2JxLMVjaM3E5njBanEWWokGhqVN66tsbe5+0eb7sdpq9SinvV50vBr4AtBJ+8IaV23DAtzDdW5l6qEAMOowGXNMKuGFg13XX4qRVkEeiBrYAH4I0SN0fOApD6kddS4tX9CJ0E4lcvvbMlvoszH3hpz6HFaNXPkecnVCq7QzNWqT6DUwpx/vW+8sTpKxAoRWO6LxJn6Wa2YI9z8p3dGE6jgDCaK/Xuvwe3GMC0g0r55TvNSDNvI2dnMPjWgw4AaHP59W74J7ozTLdDxwVoTVP7EeUn5pjKHeff0HhdTDac3ePfBeco2D2jdpJkrfqvaB32Wd6cYSEeVjRv9U6j2S49fu0lvCt7F2+KGCnPF9Rp8naLnGwQjMLlqKZuthb4QQUfSdi4jOSOpXty2BOdISrYMK2m8jjFbGtu4hU",
    "postURL": "https://10-0-55-22.sbcloud.uk/upload/a9197f7f-73e0-4707-b5da-89b3b372a9ae",
    "signature": "u7RC8xXKzNETYw+T0/edohsIc2A="
  }
}
Uploading files for getUploadParamsForTemplate : [/root/systemvmtemplate-4.20.2-x86_64-kvm.qcow2]
⣽ 😾 [1/1] systemvmtemplate-4.20.2-x86_64-kvm.qcow2	[====>                   ] 20%

finally

Uploading files for getUploadParamsForTemplate : [/root/systemvmtemplate-4.20.2-x86_64-kvm.qcow2]
[1/1] systemvmtemplate-4.20.2-x86_64-kvm.qcow2	[========================] ✅
All files uploaded successfully.

.qcow2.bz2 file does not work, but I think it is NOT an issue

Uploading files for getUploadParamsForTemplate : [/root/systemvmtemplate-4.20.2-x86_64-kvm.qcow2.bz2]
Error uploading /root/systemvmtemplate-4.20.2-x86_64-kvm.qcow2.bz2 : [1/1] systemvmtemplate-4.20.2-x86_64-kvm.qcow2.bz2	upload failed: File type mismatch between uploaded file and selected format. Selected file format: QCOW2. Received: bzip2 compressed data, block size = 900k
🙈 1 out of 1 files failed to upload.

@weizhouapache
Copy link
Member

upload volume from local

(localcloud) 🐱 > get uploadparamsforvolume format=qcow2 hypervisor=kvm name=systemvm-image-upload zoneid=e58d87c5-bc92-47f3-9395-ce3f1a0dd415 filepath=/root/systemvmtemplate-4.20.2-x86_64-kvm.qcow2
{
  "getuploadparams": {
    "expires": "2025-08-15T08:39:19.045Z",
    "id": "1254350d-639d-4778-9b11-6a123db7c2dd",
    "metadata": "i1wBGothRVWB4h/MAjWZ50AeASpRM9uazN8taEsWnm8wFV4egq/TkELz0bQOZ8PZ0EhnIgBsIcboMxpp/3ECVFd4Sw/JDM9TAIm3ERDfhcdkq6BfZiFx6b5ZMq50xOQXwI1Z4/ljRGhPc2/EkRPjC10ZrZkeHANa0U7hSfpSw2gKFk0mdopLhJWCA06XSHE9gWsCG4VNpJbe8HV6y/knnxXkkYdBsRXZPOTgqn2E/MncRIHny/kGoDDkz+OlR0NP7l/9L9tufpXb+TfQq6W52JAZW7zMABCmYaMqCTrMSzlloeZNiKe1FAhBRHpOLVfrSBOFhnt9sASLZXnq1vU6OtOmyaBdul1pobsYLwXFwXYXktvocgACq6atuqcyK4KRljsXRwPUS9qhYjmNH0pa/zMUG/ctTa0eecGlzqHIYVXgDEmaxb8DJeFvA4wST5hceZkcG3E6J+P82diLzyc0Jk1Xy2TgQuH05gygAeCxLKgcHFTOUGEhGJylIMigftxlN0rRjKAWo4kFYeGTEsG8Ux+VLddaP/H3JbiKdRkuRM7vUNkZz96SBMuSFGHMUy4=",
    "postURL": "https://10-0-55-22.sbcloud.uk/upload/1254350d-639d-4778-9b11-6a123db7c2dd",
    "signature": "oKST8NtYinWur9XvZF1rhjL6mK0="
  }
}
Uploading files for getUploadParamsForVolume : [/root/systemvmtemplate-4.20.2-x86_64-kvm.qcow2]
[1/1] systemvmtemplate-4.20.2-x86_64-kvm.qcow2	[========================] ✅
All files uploaded successfully.

upload iso from local

(localcloud) 🐱 > get uploadparamsforiso name=systemvm-upload ostypeid=f85a99a8-782d-11f0-a8cb-1e001b0003c8 zoneid=e58d87c5-bc92-47f3-9395-ce3f1a0dd415 filepath=/root/setup-v1.33.1-calico-x86_64.iso format=ISO
{
  "getuploadparams": {
    "expires": "2025-08-15T08:40:20.453Z",
    "id": "91242e92-7914-41ec-9d5f-914adb05f1ea",
    "metadata": "bsn95H60cM1Us41iFX5xTSw/DRyBCJMS07pb0VnuhqAC9SYYIyqBDFU16F9BZZkDCi8VhFlC1CkYnBSpyV8hqAJ69BfOGn+ox5qXI/QxEInAX/rZhMooYUwlFOlqscV6GB0/WEOURW8E/gq4zJ4wW4dvW04uxZmwbZ3GwoqhF4chw102hMKylPufknzzZHo41SoQqw9EYHw8bjWJSiC/nE9NiSr9mGfHS9LaLXxGHOuf5Vs6OWiaK8CUAY0PGbuAuwn/t60zmpRSfbVOn8qc8uW7UKPwvu3w+opBngg4WamVTbJ6dhJWfPccCBtR/n/XMRlE7rioTMfMP5a1vg1EhBrE3UeT0B0xpEo26QsywQTwtdudEadE/8Ulxx/3yHuIOXMQdRTP3k0lY+INomuK1gKmZHbOdKYQdWSWXYPunFayPhzaXeaMrXt05VWb8tG+sez15d7e1Emf0ejDL1hVRfS3tgYLUdyLYpxM6q0eT+jy2AK3Ljqdfwlf7yA+uaRGTWNTQccEeTXmbyYXDPWpMLSqaegQKyQ+AuPsLE+qBWBLFUc01umhuMkhggPpapVJDHnBR7h4CYD0+exWAya/alKC7eAx7e47Evhl/Rg0yMqYSXc+maXos+vLG0XhhcreIeHUapeNdMAv9QET/hUaO1r4CnNnBW4uX2pWkYX8WMLWl9TeSJkO",
    "postURL": "https://10-0-55-22.sbcloud.uk/upload/91242e92-7914-41ec-9d5f-914adb05f1ea",
    "signature": "7ZX1BuOmTYcqQB2rr0tajG8UArA="
  }
}
Uploading files for getUploadParamsForIso : [/root/setup-v1.33.1-calico-x86_64.iso]
[1/1] setup-v1.33.1-calico-x86_64.iso	[========================] ✅
All files uploaded successfully.

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

tested https upload of template, ISO and volume from local

@DaanHoogland DaanHoogland merged commit 9f8ce06 into apache:main Aug 15, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explore template/iso file upload from cmk

4 participants