Strongly welcome! Suppose there is some abstract server with centos 7
and libvirt + libguestfs (virt-(builder,install,sysprep,customize и иже с ними))
on board. I'm trying to knock out a new virtual machine.
# virt-builder centos-7.6 \ --format qcow2 \ --size 10G \ --hostname test-1.local \ --timezone Asia/Kolkata \ -o /images/test-1.qcow2 # virt-install --import --name test-1 \ --memory 1024 --vcpus 1 --cpu host \ --disk /images/test-1.qcow2,format=qcow2,bus=virtio \ --network bridge=br121 \ --os-type=linux \ --os-variant=centos7.0 \ --graphics spice \ --noautoconsole
Everything is great, the pre-installed image is downloaded, builds, the disk expands and a new machine is created. Everything seems to be fine, but there are a few questions that I just can’t solve with libguestfs:
- How to set a static IP ( WITHOUT dhcp , just the address from the pool 192.168.0.0/24) address using (any of) the libguestfs utilities?
- Is it possible, and if so how to change the disk layout?
UPD Partially answering the first question, I found this method --upload /root/ifcfg-eth0:/etc/sysconfig/network-scripts/ifcfg-eth0
(Where /root/ifcfg-eth0
is an interface that is pre-configured as needed), in principle option working, but maybe somehow "better" you can do it? Maybe there are some built-in methods out of the box?