Giter Club home page Giter Club logo

cv4pve-api-java's People

Contributors

dependabot[bot] avatar franklupo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

cv4pve-api-java's Issues

Connection timeout

What happened?

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.

Expected behavior

The connection is renewed or at least give us the possibility to disconnect and reconnect manually.

Relevant log output

org.json.JSONException: JSONObject["data"] not found.

Java Version

SE 8

Proxmox VE Version

7.2

Version (bug)

v7.1.0

Version (working)

No response

On what operating system are you experiencing the issue?

Linux

Pull Request

  • I would like to do a Pull Request

Parameter verification failed when configuring network devices for lxc / qemu

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

Don't manage to create QEMU VM

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 !

Login dont Work with another realm

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.

Mistake in waitForTaskToFinish

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

Get UPID of shutdown task

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:"

SSH Keys not working

Hey there,

i am trying to change my ssh keys with the code below inside PVEConfig.
Bildschirmfoto 2020-04-13 um 23 51 36

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

Connection not working with pam

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.