corsinvest / cv4pve-api-java Goto Github PK
View Code? Open in Web Editor NEWProxmox VE Client API JAVA
Home Page: https://www.corsinvest.it/cv4pve
License: GNU General Public License v3.0
Proxmox VE Client API JAVA
Home Page: https://www.corsinvest.it/cv4pve
License: GNU General Public License v3.0
I don't see any in the documentation.
Hi,
I am opening a connection using vp4pve-api-java to my proxmox server. This connection is maintained for multi requests purposes.
After a day, each request returns an empty "data" JSON field as if there is no communication anymore.
I feel like the connection to the proxmox server goes timeout and there is no reconnection process included in the API nor a disconnect / logout method.
I would like to keep the connection open to increase performance.
Do you have any idea to help me solve this problem?
Thanks for any help you can provide.
The connection is renewed or at least give us the possibility to disconnect and reconnect manually.
org.json.JSONException: JSONObject["data"] not found.
SE 8
7.2
v7.1.0
No response
Linux
Hello,
i have a problem with configuring network devices via your api on lxc creation (and also qemu creation using cloudinit). Maybe i am doing something wrong, but maybe there is some internal problem in your api?
Basically, i have the following code:
Map<Integer, String> netN = new HashMap<>(); netN.put(0, "name=eth0,rate=15,bridge=vmbr0,firewall=1,gw=xx.xx.xx.xx,ip=xx.xx.xx.xx/24,hwaddr=02:00:be:0f:f2:63");
The netN map i am passing to the getLxc().createVm function.
I also tried it with only passing the name field ("name=eth0"). Am i doing something wrong?
I am also using your PHP api and there are no problems.
Here is the output of the debug messages, the net0 string is normally right, using the same in your php api:
Parameters: net0 : name=eth0,rate=15,bridge=vmbr0,firewall=1,gw=xx.xx.xx.xx,ip=xx.xx.xx.xx/24,hwaddr=02:00:be:0f:f2:63 memory : 1024 cpulimit : 1 ostemplate : local:vztmpl/debian-10.0-x86_64.tar.gz hostname : test password : test cores : 1 vmid : 289 swap : 512 start : 1 unprivileged : 1 onboot : 1 rootfs : disk1:50 arch : amd64
I always get the following result:
StatusCode: 400
ReasonPhrase: Parameter verification failed.
IsSuccessStatusCode: false
Set return type to png and return image png.
In line 476, class PveClientBase, there is the following condition in the method waitForTaskToFinish:
while (isRunning && (timeStart - System.currentTimeMillis()) < timeOut)
After a timeout, the (timeStart - System.currentTimeMillis()) < timeOut
condition should be false.
But this condition is never false, because timeStart - System.currentTimeMillis() is always negative and less than a positive timeout.
Right condition would be: (System.currentTimeMillis() - timeStart) < timeOut
Condition must also get corrected in the last line of this method.
Please correct me if i am wrong
// Edit: Maybe it would be better to return a boolean instead of an int. 'false' for timeout exceeded, 'true' for task finished in a time less than timeout
Hello,
is it possible to get the UPID of a shutdown task? I am calling the shutdown like this:
Result result = node.getLxc().get(serverId).getStatus().getShutdown().vmShutdown();
But the result doesn't contain a UPID. I want to wait for the task to finish.
When i call the shutdown POST method via pvesh i get the UPID:
pvesh create /nodes/host01/lxc/100/status/shutdown --output-format json-pretty
Results in the following output:
"UPID:host01:0000377E:19E15146:5F3C0469:vzshutdown:100:root@pam:"
Hi,
First of all thanks for your java portage. I have a problem when i try to create a VM.
If i call the methode node.getQemu().createVm(vmId) it work with default params. But when i try to customise a little bit i go trought params exceptions.
For example when i try to put a the net[n] parameters i got exception :
Map<Integer, String> netN = new HashMap<>();
netN.put(0,URLEncoder.encode("name=eth0,rate=15,bridge=vmbr0,firewall=1,gw=255.255.255.0,ip=192.168.0.1/24,hwaddr=02:00:be:0f:f2:63","utf8"));
the error is "Parameter verification failed."
Any help would be appreciated !
Hey there,
i am trying to change my ssh keys with the code below inside PVEConfig.
Now an error occures.
java.io.IOException: Server returned HTTP response code: 400 for URL: https://192.168.178.131:8006/api2/json/nodes/pve/qemu/1203/config
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_192]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_192]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_192]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_192]
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1944) ~[na:1.8.0_192]
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1939) ~[na:1.8.0_192]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_192]
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1938) ~[na:1.8.0_192]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1508) ~[na:1.8.0_192]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) ~[na:1.8.0_192]
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263) ~[na:1.8.0_192]
at it.corsinvest.proxmoxve.api.PveClientBase.executeAction(PveClientBase.java:355) [main/:na]
at it.corsinvest.proxmoxve.api.PveClientBase.create(PveClientBase.java:178) [main/:na]
at it.corsinvest.proxmoxve.api.PveClient$PVENodes$PVEItemNode$PVEQemu$PVEItemVmid$PVEConfig.setRest(PveClient.java:9391) [main/:na]
at de.vpsnow.restendpoint.service.impl.ProxmoxDeploymentService.lambda$createServer$0(ProxmoxDeploymentService.java:68) [main/:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_192]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_192]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_192]
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://192.168.178.131:8006/api2/json/nodes/pve/qemu/1203/config
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894) ~[na:1.8.0_192]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) ~[na:1.8.0_192]
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[na:1.8.0_192]
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347) ~[na:1.8.0_192]
at it.corsinvest.proxmoxve.api.PveClientBase.executeAction(PveClientBase.java:352) [main/:na]
... 6 common frames omitted
We have an AD Realm named e.x. ad. And the User test. The User has Administrator rights at /. But the login isnt working when i say: client.login("test", "test", "ad"). Other realms are working fine.
I'm experiencing an issue with the api at login:
org.json.JSONException: A JSONObject text must begin with '{' at character 0
The connection to the pve server works just fine with curl and the php api.
What is the issue here?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.