+ if self.container.mnt:
+ for mount in self.container.mnt:
+ host_dir, guest_dir = mount.split(':')
+ entry = 'lxc.mount.entry = {host_dir} '\
+ '/var/lib/lxc/{c.name}/rootfs{guest_dir} none ' \
+ 'bind,create=dir 0 0'.format(c=self.container,
+ host_dir=host_dir,
+ guest_dir=guest_dir)
+ ret, _, _ = self.container.ssh.exec_command_sudo(
+ "sh -c 'echo \"{e}\" >> /var/lib/lxc/{c.name}/config'".
+ format(e=entry, c=self.container))
+ if int(ret) != 0:
+ raise RuntimeError('Failed to write {c.name} config.'
+ .format(c=self.container))
+