Git Product home page Git Product logo

libvirt-automount's Introduction

libvirt-automount

This is a libvirt hook that will automatically mount your file systems in /mnt/$name This code makes a lot of assumptions, but can be quickly changed to meet your needs.

Problem

Running hooks to mount a remote file system after a libvirtd daemon sends in a started hook doesn't work right away, since sshd on the VM must be started, and that doesn't happen as soon as libvirtd sends this hook.

Solution

Use the started hook to launch a script that calls into a C program that immediately forks, and exists the parent. The C program then calls execlp('qemu-start-wrapped');

Assumptions

  • The name of your VM, which is passed to your hook from libvirtd has a resolved name. For example, virtual machine with name (domname) dns, can be resolved on your machine. This can be accomplished by simply editing your /etc/hosts file.

Quick start

To get started, Edit qemu-start-wrapped and replace ryan and IdentityFile with correct values

Ensure up SSH key validation on the virtual machine, password login is not supported

  1. git clone https://github.com/rmccullagh/libvirt-automount
  2. cd libvirt-automount
  3. gcc -Wall -Wextra mount-sshfs.c -o mount-sshfs
  4. sudo cp mount-ssfs /etc/libvirt/hooks/
  5. sudo cp qemu /etc/libvirt/hooks
  6. sudo cp qemu-start-wrapped /etc/libvirt/hooks
  7. sudo systemctl restart libvirtd.service

You can tail -f /var/log/syslog to see the messages written.

libvirt-automount's People

Contributors

rmccullagh avatar

Stargazers

 avatar  avatar

Watchers

James Cloos avatar  avatar  avatar

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.