Richard W.M. Jones
2020-Aug-27 12:36 UTC
Re: [Libguestfs] Virt Customize features from python
On Thu, Aug 27, 2020 at 08:32:35AM -0400, Donny Davis wrote:> Hey Richard, > > I have been playing around with guestfs-python.3 and I am curious if there > is a method to call virt-customize like functions from python. Specifically > I need to install a package into the guest image.There isn't directly, you'd have to either run virt-customize as an external command, or emulate what virt-customize does using guestfs python calls: https://github.com/libguestfs/libguestfs/blob/fce82fe55a2b64a1a7e494858aa272d608e5e54e/customize/customize_run.ml#L70 https://github.com/libguestfs/libguestfs/blob/fce82fe55a2b64a1a7e494858aa272d608e5e54e/customize/customize_run.ml#L272 Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Richard, Thank you for the lightning fast reply! I will check out both methods. Donny Davis c: 805 814 6800 On Thu, Aug 27, 2020, 8:36 AM Richard W.M. Jones <rjones@redhat.com> wrote:> On Thu, Aug 27, 2020 at 08:32:35AM -0400, Donny Davis wrote: > > Hey Richard, > > > > I have been playing around with guestfs-python.3 and I am curious if > there > > is a method to call virt-customize like functions from python. > Specifically > > I need to install a package into the guest image. > > There isn't directly, you'd have to either run virt-customize as an > external command, or emulate what virt-customize does using guestfs > python calls: > > > https://github.com/libguestfs/libguestfs/blob/fce82fe55a2b64a1a7e494858aa272d608e5e54e/customize/customize_run.ml#L70 > > https://github.com/libguestfs/libguestfs/blob/fce82fe55a2b64a1a7e494858aa272d608e5e54e/customize/customize_run.ml#L272 > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat > http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-builder quickly builds VMs from scratch > http://libguestfs.org/virt-builder.1.html > >
Possibly Parallel Threads
- [PATCH 1/2] customize: check for file existence with --edit (RHBZ#1275806)
- [PATCH] customize: remove "core" from description of --update
- [PATCH] customize: fix --upload to FAT partition (RHBZ#1196101)
- [PATCH] customize: Make dnf upgrade to the latest versions of packages.
- [PATCH] customize: remove zypper's gpg keys auto-import