Tidy up virtiofs and 9p synced_folder messages (#1527)

Remove the excessive output generated for the synced_folder messages
emitted when using 9p and virtiofs synced_folders.

Fixes: #1525
This commit is contained in:
Darragh Bailey 2022-07-12 18:28:51 +01:00 committed by GitHub
parent c5ed4bd89c
commit 41d153b91f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 7 deletions

View File

@ -45,7 +45,7 @@ module VagrantPlugins
mount_tag = Digest::MD5.new.update(folder_opts[:hostpath]).to_s[0, 31]
folder_opts[:mount_tag] = mount_tag
machine.ui.info "================\nMachine id: #{machine.id}\nShould be mounting folders\n #{id}, opts: #{folder_opts}"
machine.ui.info I18n.t("vagrant_libvirt.cap.9p.preparing")
xml = Nokogiri::XML::Builder.new do |xml|
xml.filesystem(type: 'mount', accessmode: folder_opts[:accessmode]) do
@ -74,7 +74,7 @@ module VagrantPlugins
# once up, mount folders
def enable(machine, folders, _opts)
# Go through each folder and mount
machine.ui.info('mounting 9p share in guest')
machine.ui.info I18n.t("vagrant_libvirt.cap.9p.mounting")
# Only mount folders that have a guest path specified.
mount_folders = {}
folders.each do |id, opts|
@ -94,6 +94,7 @@ module VagrantPlugins
raise Vagrant::Errors::Error('No Libvirt connection')
end
@conn = machine.provider.driver.connection.client
machine.ui.info I18n.t("vagrant_libvirt.cap.9p.cleanup")
begin
if machine.id && machine.id != ''
dom = @conn.lookup_domain_by_uuid(machine.id)
@ -101,7 +102,6 @@ module VagrantPlugins
'/domain/devices/filesystem'
).each do |xml|
dom.detach_device(xml.to_s)
machine.ui.info 'Cleaned up shared folders'
end
end
rescue => e

View File

@ -34,6 +34,8 @@ module VagrantPlugins
raise Vagrant::Errors::Error('No Libvirt connection') if machine.provider.driver.connection.nil?
@conn = machine.provider.driver.connection.client
machine.ui.info I18n.t("vagrant_libvirt.cap.virtiofs.preparing")
begin
# loop through folders
folders.each do |id, folder_opts|
@ -44,8 +46,6 @@ module VagrantPlugins
mount_tag = Digest::MD5.new.update(folder_opts[:hostpath]).to_s[0, 31]
folder_opts[:mount_tag] = mount_tag
machine.ui.info "================\nMachine id: #{machine.id}\nShould be mounting folders\n #{id}, opts: #{folder_opts}"
xml = Nokogiri::XML::Builder.new do |xml|
xml.filesystem(type: 'mount', accessmode: 'passthrough') do
xml.driver(type: 'virtiofs')
@ -73,7 +73,7 @@ module VagrantPlugins
# once up, mount folders
def enable(machine, folders, _opts)
# Go through each folder and mount
machine.ui.info('mounting virtiofs share in guest')
machine.ui.info I18n.t("vagrant_libvirt.cap.virtiofs.mounting")
# Only mount folders that have a guest path specified.
mount_folders = {}
folders.each do |id, opts|
@ -91,6 +91,7 @@ module VagrantPlugins
raise Vagrant::Errors::Error('No Libvirt connection')
end
@conn = machine.provider.driver.connection.client
machine.ui.info I18n.t("vagrant_libvirt.cap.virtiofs.cleanup")
begin
if machine.id && machine.id != ''
dom = @conn.lookup_domain_by_uuid(machine.id)
@ -98,7 +99,6 @@ module VagrantPlugins
'/domain/devices/filesystem'
).each do |xml|
dom.detach_device(xml.to_s)
machine.ui.info 'Cleaned up shared folders'
end
end
rescue => e

View File

@ -214,3 +214,13 @@ en:
preparing: |-
The vagrant machine is being prepared for creation, please wait for
it to reach a steady state before issuing commands on it.
cap:
virtiofs:
preparing: Configuring virtiofs device for shared folders...
mounting: Mounting virtiofs shared folders...
cleanup: Removing virtiofs device for shared folders...
9p:
preparing: Configuring 9p device for shared folders...
mounting: Mounting 9p shared folders...
cleanup: Removing 9p device for shared folders...