Skip to main content
  1. Blog
  2. Article

Canonical
on 27 May 2015


In part of my work for nova-compute-lxd, we use a combination of httplib, UNIX domain sockets, and JSON to talk to the LXD daemon via the REST API. Talking to various people involved in the LXD project, I have decided to split this part of nova-compute-lxd into its own project called pylxd. Pylxd is a general python library that you can use to interact with LXD in order to do container operations.

Right now, it is about 80% complete, the bits that are missing is that it needs more unit tests and needs more container operations (snapshots, running commands in the container, etc). That functionality will be coming in later releases of pylxd. I intend to use pylxd in the next version of nova-compute-lxd for the Liberty release of OpenStack as well. I am sure that there is other use cases that developers and users can use pylxd for.

To use pylxd, you just have to clone the git tree and build it. An example usage of pylxd is that you need a way to display the ‘/etc/hosts’ from your running ‘test1′ container. With pylxd this is pretty simple to do:

#!/usr/bin/python

from pylxd import api
c = api.API()
print c.get_container_file(‘test1′, ‘/etc/hosts’)

The result of the above snippet is that the ‘/etc/hosts’ from the ‘test1′ container will be displayed. Pretty simple eh?

The code for pylxd is available on github. Please report give it a twirl, please report bugs, and would love to get feedback.

About the author

Chuck Short is a software engineer at Canonical. Originally from Vancouver but based in Ottawa, Chuck’s mission is to make sure OpenStack is a first class experience for both the X86 world and ARM world. You can follow his blog at zulcss.wordpress.com

Related posts


Rhys Knipe
7 July 2026

Ubuntu Server: a platform made for enterprise scale

Ubuntu Article

A platform is an environment that allows software to run smoothly across the infrastructure, runtime, and application layers. The key word there is “smoothly”: a good platform connects those layers so well that you don’t notice it. That’s what Ubuntu Server has become: the essential layer between bare metal and the apps running on top, ...


Canonical
30 June 2026

Canonical becomes Gold Sponsor of Trifecta Tech Foundation

Canonical announcements Article

Canonical is pleased to announce it is now a Gold Sponsor of the Trifecta Tech Foundation, a non-profit that creates open source building blocks for critical infrastructure software.  Canonical has supported the foundation’s work since 2025, co-sponsoring the development of projects like sudo-rs. The new €40,000/year contribution will hel ...


ilvipero
22 June 2026

Ubuntu Summit 26.04: connected by open source

Ubuntu Ubuntu tech blog

What an incredible experience! Ubuntu Summit 26.04 has officially drawn to a close, but the energy from our global community is still buzzing – in the comments section, on social media, and in news reports. Whether you joined us in person or tuned in from across the globe, you helped make this edition our most ...