David Mansfield
2011-Dec-21 22:23 UTC
[libvirt-users] for a guest accessing host "full disk", how to prevent host vgscan
Hi All. I have a dell system with a H700 raid. Within the hardware RAID config I've created a "virtual disk" which I have assigned to one of my guests. On the host the device is "/dev/sdb", on the guest it's "/dev/vdb". This works fine. Within the guest, we have created lvm PV on /dev/vdb (using the whole disk - no partitions) and created a volume group. The guest's hostname is "argo" and the vg is called "vg_argo_bkup". When I reboot the host, it does a vgscan and finds the volume group and activates it in the _host_, which I need to prevent (I think??). I have successfully done this by filtering "/dev/sdb" in /etc/lvm/lvm.conf (which does NOT work as advertised BTW), but referencing the extremely volatile SCSI "sd*" names seems a terrible way to do this. If I fiddle around in the HW raid config, the /dev/sd? may change. I plan on creating about 10 more VM's spread over a number of machines over the next weeks with a very similar setup, and the admin overhead seems like it'll be onerous and error-prone. I'd love to be able to filter the volume groups by VG name instead of pv device node. The host's hostname is "narnia" and I'd love to say, 'vgscan --include-regex "vg_narnia.*"' or something similar, if you get my drift. Does anyone have a best practice for this? I'm sure iSCSI enthusiasts must have the exact same issue all the time. Oh... I'm using centos 6.2 on host and guest, libvirt-0.9.4-23.el6_2.1.x86_64, although it hardly seems a libvirt issue at all, it seems to be a lvm host issue mainly. Thanks, David Mansfield
Daniel P. Berrange
2011-Dec-21 22:41 UTC
[libvirt-users] for a guest accessing host "full disk", how to prevent host vgscan
On Wed, Dec 21, 2011 at 05:23:33PM -0500, David Mansfield wrote:> Hi All. > > I have a dell system with a H700 raid. Within the hardware RAID > config I've created a "virtual disk" which I have assigned to one of > my guests. On the host the device is "/dev/sdb", on the guest it's > "/dev/vdb". > > This works fine. > > Within the guest, we have created lvm PV on /dev/vdb (using the > whole disk - no partitions) and created a volume group. The guest's > hostname is "argo" and the vg is called "vg_argo_bkup". > > When I reboot the host, it does a vgscan and finds the volume group > and activates it in the _host_, which I need to prevent (I think??). > > I have successfully done this by filtering "/dev/sdb" in > /etc/lvm/lvm.conf (which does NOT work as advertised BTW), but > referencing the extremely volatile SCSI "sd*" names seems a terrible > way to do this. If I fiddle around in the HW raid config, the > /dev/sd? may change. > > I plan on creating about 10 more VM's spread over a number of > machines over the next weeks with a very similar setup, and the > admin overhead seems like it'll be onerous and error-prone. > > I'd love to be able to filter the volume groups by VG name instead > of pv device node. The host's hostname is "narnia" and I'd love to > say, 'vgscan --include-regex "vg_narnia.*"' or something similar, if > you get my drift. > > Does anyone have a best practice for this? I'm sure iSCSI > enthusiasts must have the exact same issue all the time.The recommended approach is not to assign the entire disk to the guest. Partition the host disk, to contain 1 single partition consuming all space, then assign the partition to the guest. Worst case is you loose a few KB of space due to partition alignment, but this is a small price to pay to avoid the LVM problems you describe all to well. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Maybe Matching Threads
- Re: [PATCH 2/3] New API: lvm_scan, deprecate vgscan (RHBZ#1602353).
- openssh remote add user exploits?
- problems with win-linux connection
- [PATCH 2/3] New API: lvm_scan, deprecate vgscan (RHBZ#1602353).
- [PATCH 0/3] New API: lvm_scan, deprecate vgscan (RHBZ#1602353).