digitalspider / jlxd Goto Github PK
View Code? Open in Web Editor NEWJava API for LXD
Java API for LXD
Hello, Im working on a project with your API. I dont know if youre still active on here but I found some issues you might want to resolve.
Solution to Cannot create container from existing image (ILxdApiService):
You are missing closing brackets and single quotation mark in "public static final String URL_POST_CONTAINER_CREATE_LOCAL"
When LXD is installed with snap (current practice) the unix.socket has a different path (ILxdApiService):
It is in /var/snap/lxd/common/lxd/unix.socket instead of /var/lib/lxd/unix.socket
The certificates for remote connection have a different path as well, when installed with snap (needs to be changed in LxdConstants.java):
The certificate: /snap/lxd/common/config/client.crt
The key: /snap/lxd/common/config/client.key
In the RemoteServer.java change the name ob UBUNTU.enum to "ubuntu" instead of "ububtu"
Just a typo.
Maybe I am missing something, but I cannot get the library (or even jlxd-cli) to work. I do not get any errors, everything looks to work fine, but nothing actually happens.
ILxdService api = new LxdServiceImpl();
ILxdApiService lxdApiService = new LxdApiServiceImpl();
ILinuxCliService linuxCliService = new LinuxCliServiceImpl();
lxdApiService.setLinuxCliService(linuxCliService);
api.setLxdApiService(lxdApiService);
api.createContainer("container_name", "images:alpine/edge");
outputs
2017-10-28 14:54:19 INFO LxdApiServiceImpl:324 - repsonse=OperationResponse: type=async, status=Operation created, statusCode=100, metadata=Operation{id='326d330a-c190-4c29-b6b4-28c55cda92df', classType='task', createdDate='2017-10-28T14:54:19.26748073+03:00', updatedDate='2017-10-28T14:54:19.26748073+03:00', status='Running', statusCode='103', resources='{containers=[/1.0/containers/327592088315363328]}', metadata='null', mayCancel='null', err=''}, error=, errorCode=0
, but nothing happens (container should show up when doing lxc list
)
any further operations (like api.startContainer("container_name");
) causes an error with
java.lang.IllegalArgumentException: container: container_name has state null
at au.com.jcloud.lxd.service.impl.LxdServiceImpl.changeContainerState(LxdServiceImpl.java:125)
at au.com.jcloud.lxd.service.impl.LxdServiceImpl.startContainer(LxdServiceImpl.java:141)
And as earlier stated, even example project Jlxd-cli
fails to work. No errors, just nothing happens. Strangely enough, the webapp Jlxd-ui
works fine, but I can't figure out why.
Any assistance?
System info:
Lxd version: 2.18
Ubuntu version: 17.10
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.