mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-02 09:47:16 +03:00
installer: Remove --location nfs support
Removal was discussed here: https://www.redhat.com/archives/virt-tools-list/2018-May/msg00011.html Basically I don't think many people use this, the feature is very inflexible, it's hard to test, and users can essentially do it themselves with a bit more effort.
This commit is contained in:
parent
8e150901f4
commit
7a2abb5abf
@ -19,8 +19,9 @@ VNC or SPICE, as well as text mode installs over serial console. The guest
|
|||||||
can be configured to use one or more virtual disks, network interfaces,
|
can be configured to use one or more virtual disks, network interfaces,
|
||||||
audio devices, physical USB or PCI devices, among others.
|
audio devices, physical USB or PCI devices, among others.
|
||||||
|
|
||||||
The installation media can be held locally or remotely on NFS, HTTP, FTP
|
The installation media can be local ISO or CDROM media, or a distro install
|
||||||
servers. In the latter case C<virt-install> will fetch the minimal files
|
tree hosted remotely over HTTP, FTP, or in a local directory. In the install
|
||||||
|
tree case C<virt-install> will fetch the minimal files
|
||||||
necessary to kick off the installation process, allowing the guest
|
necessary to kick off the installation process, allowing the guest
|
||||||
to fetch the rest of the OS distribution as needed. PXE booting, and importing
|
to fetch the rest of the OS distribution as needed. PXE booting, and importing
|
||||||
an existing disk image (thus skipping the install phase) are also supported.
|
an existing disk image (thus skipping the install phase) are also supported.
|
||||||
@ -397,10 +398,6 @@ An HTTP server location containing an installable distribution image.
|
|||||||
|
|
||||||
An FTP server location containing an installable distribution image.
|
An FTP server location containing an installable distribution image.
|
||||||
|
|
||||||
=item nfs:host:/path or nfs://host/path
|
|
||||||
|
|
||||||
An NFS server location containing an installable distribution image. This requires running virt-install as root.
|
|
||||||
|
|
||||||
=item DIRECTORY
|
=item DIRECTORY
|
||||||
|
|
||||||
Path to a local directory containing an installable distribution image. Note that the directory will not be accessible by the guest after initial boot, so the OS installer will need another way to access the rest of the install media.
|
Path to a local directory containing an installable distribution image. Note that the directory will not be accessible by the guest after initial boot, so the OS installer will need another way to access the rest of the install media.
|
||||||
|
@ -10,8 +10,6 @@ import os
|
|||||||
|
|
||||||
# Need to do this before any tests or virtinst import
|
# Need to do this before any tests or virtinst import
|
||||||
os.environ["VIRTINST_TEST_SUITE"] = "1"
|
os.environ["VIRTINST_TEST_SUITE"] = "1"
|
||||||
os.environ["VIRTINST_TEST_URL_DIR"] = os.path.abspath(
|
|
||||||
"tests/cli-test-xml/fakefedoratree/")
|
|
||||||
|
|
||||||
# pylint: disable=wrong-import-position
|
# pylint: disable=wrong-import-position
|
||||||
from virtcli import cliconfig
|
from virtcli import cliconfig
|
||||||
|
@ -1,119 +0,0 @@
|
|||||||
<domain type="kvm">
|
|
||||||
<name>foobar</name>
|
|
||||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
|
||||||
<memory>65536</memory>
|
|
||||||
<currentMemory>65536</currentMemory>
|
|
||||||
<vcpu>1</vcpu>
|
|
||||||
<os>
|
|
||||||
<type arch="x86_64">hvm</type>
|
|
||||||
<kernel>/tmp/virtinst-vmlinuz.</kernel>
|
|
||||||
<initrd>/tmp/virtinst-initrd.img.</initrd>
|
|
||||||
<cmdline>method=nfs:example.com/fake</cmdline>
|
|
||||||
</os>
|
|
||||||
<features>
|
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
|
||||||
<vmport state="off"/>
|
|
||||||
</features>
|
|
||||||
<cpu mode="custom" match="exact">
|
|
||||||
<model>Opteron_G4</model>
|
|
||||||
</cpu>
|
|
||||||
<clock offset="utc">
|
|
||||||
<timer name="rtc" tickpolicy="catchup"/>
|
|
||||||
<timer name="pit" tickpolicy="delay"/>
|
|
||||||
<timer name="hpet" present="no"/>
|
|
||||||
</clock>
|
|
||||||
<on_reboot>destroy</on_reboot>
|
|
||||||
<pm>
|
|
||||||
<suspend-to-mem enabled="no"/>
|
|
||||||
<suspend-to-disk enabled="no"/>
|
|
||||||
</pm>
|
|
||||||
<devices>
|
|
||||||
<emulator>/usr/bin/qemu-kvm</emulator>
|
|
||||||
<controller type="usb" index="0" model="ich9-ehci1"/>
|
|
||||||
<controller type="usb" index="0" model="ich9-uhci1">
|
|
||||||
<master startport="0"/>
|
|
||||||
</controller>
|
|
||||||
<controller type="usb" index="0" model="ich9-uhci2">
|
|
||||||
<master startport="2"/>
|
|
||||||
</controller>
|
|
||||||
<controller type="usb" index="0" model="ich9-uhci3">
|
|
||||||
<master startport="4"/>
|
|
||||||
</controller>
|
|
||||||
<console type="pty"/>
|
|
||||||
<channel type="spicevmc">
|
|
||||||
<target type="virtio" name="com.redhat.spice.0"/>
|
|
||||||
</channel>
|
|
||||||
<input type="tablet" bus="usb"/>
|
|
||||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
|
|
||||||
<image compression="off"/>
|
|
||||||
</graphics>
|
|
||||||
<sound model="ich6"/>
|
|
||||||
<video>
|
|
||||||
<model type="qxl"/>
|
|
||||||
</video>
|
|
||||||
<redirdev bus="usb" type="spicevmc"/>
|
|
||||||
<redirdev bus="usb" type="spicevmc"/>
|
|
||||||
<rng model="virtio">
|
|
||||||
<backend model="random">/dev/urandom</backend>
|
|
||||||
</rng>
|
|
||||||
</devices>
|
|
||||||
</domain>
|
|
||||||
<domain type="kvm">
|
|
||||||
<name>foobar</name>
|
|
||||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
|
||||||
<memory>65536</memory>
|
|
||||||
<currentMemory>65536</currentMemory>
|
|
||||||
<vcpu>1</vcpu>
|
|
||||||
<os>
|
|
||||||
<type arch="x86_64">hvm</type>
|
|
||||||
<boot dev="hd"/>
|
|
||||||
</os>
|
|
||||||
<features>
|
|
||||||
<acpi/>
|
|
||||||
<apic/>
|
|
||||||
<vmport state="off"/>
|
|
||||||
</features>
|
|
||||||
<cpu mode="custom" match="exact">
|
|
||||||
<model>Opteron_G4</model>
|
|
||||||
</cpu>
|
|
||||||
<clock offset="utc">
|
|
||||||
<timer name="rtc" tickpolicy="catchup"/>
|
|
||||||
<timer name="pit" tickpolicy="delay"/>
|
|
||||||
<timer name="hpet" present="no"/>
|
|
||||||
</clock>
|
|
||||||
<pm>
|
|
||||||
<suspend-to-mem enabled="no"/>
|
|
||||||
<suspend-to-disk enabled="no"/>
|
|
||||||
</pm>
|
|
||||||
<devices>
|
|
||||||
<emulator>/usr/bin/qemu-kvm</emulator>
|
|
||||||
<controller type="usb" index="0" model="ich9-ehci1"/>
|
|
||||||
<controller type="usb" index="0" model="ich9-uhci1">
|
|
||||||
<master startport="0"/>
|
|
||||||
</controller>
|
|
||||||
<controller type="usb" index="0" model="ich9-uhci2">
|
|
||||||
<master startport="2"/>
|
|
||||||
</controller>
|
|
||||||
<controller type="usb" index="0" model="ich9-uhci3">
|
|
||||||
<master startport="4"/>
|
|
||||||
</controller>
|
|
||||||
<console type="pty"/>
|
|
||||||
<channel type="spicevmc">
|
|
||||||
<target type="virtio" name="com.redhat.spice.0"/>
|
|
||||||
</channel>
|
|
||||||
<input type="tablet" bus="usb"/>
|
|
||||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
|
|
||||||
<image compression="off"/>
|
|
||||||
</graphics>
|
|
||||||
<sound model="ich6"/>
|
|
||||||
<video>
|
|
||||||
<model type="qxl"/>
|
|
||||||
</video>
|
|
||||||
<redirdev bus="usb" type="spicevmc"/>
|
|
||||||
<redirdev bus="usb" type="spicevmc"/>
|
|
||||||
<rng model="virtio">
|
|
||||||
<backend model="random">/dev/urandom</backend>
|
|
||||||
</rng>
|
|
||||||
</devices>
|
|
||||||
</domain>
|
|
@ -734,7 +734,6 @@ c.add_compare("--connect " + utils.URIs.kvm_session + " --disk size=8 --os-varia
|
|||||||
|
|
||||||
# misc KVM config tests
|
# misc KVM config tests
|
||||||
c.add_compare("--disk none --location %(EXISTIMG3)s --nonetworks", "location-iso", skip_check=not find_executable("isoinfo")) # Using --location iso mounting
|
c.add_compare("--disk none --location %(EXISTIMG3)s --nonetworks", "location-iso", skip_check=not find_executable("isoinfo")) # Using --location iso mounting
|
||||||
c.add_compare("--disk none --location nfs:example.com/fake --nonetworks", "location-nfs") # Using --location nfs
|
|
||||||
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel6.4", "kvm-rhel6") # RHEL6 defaults
|
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel6.4", "kvm-rhel6") # RHEL6 defaults
|
||||||
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel7.0", "kvm-rhel7") # RHEL7 defaults
|
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel7.0", "kvm-rhel7") # RHEL7 defaults
|
||||||
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant centos7.0", "kvm-centos7") # Centos 7 defaults
|
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant centos7.0", "kvm-centos7") # Centos 7 defaults
|
||||||
@ -748,6 +747,7 @@ c.add_valid("--arch aarch64 --nodisks --pxe --connect " + utils.URIs.kvm_nodomca
|
|||||||
c.add_invalid("--disk none --boot network --machine foobar") # Unknown machine type
|
c.add_invalid("--disk none --boot network --machine foobar") # Unknown machine type
|
||||||
c.add_invalid("--nodisks --boot network --arch mips --virt-type kvm") # Invalid domain type for arch
|
c.add_invalid("--nodisks --boot network --arch mips --virt-type kvm") # Invalid domain type for arch
|
||||||
c.add_invalid("--nodisks --boot network --paravirt --arch mips") # Invalid arch/virt combo
|
c.add_invalid("--nodisks --boot network --paravirt --arch mips") # Invalid arch/virt combo
|
||||||
|
c.add_invalid("--disk none --location nfs:example.com/fake --nonetworks") # Using --location nfs, no longer supported
|
||||||
|
|
||||||
c = vinst.add_category("kvm-q35", "--noautoconsole --connect " + utils.URIs.kvm_q35, compare_check=support.SUPPORT_CONN_VMPORT)
|
c = vinst.add_category("kvm-q35", "--noautoconsole --connect " + utils.URIs.kvm_q35, compare_check=support.SUPPORT_CONN_VMPORT)
|
||||||
c.add_compare("--boot uefi --disk none", "boot-uefi")
|
c.add_compare("--boot uefi --disk none", "boot-uefi")
|
||||||
|
@ -280,7 +280,7 @@
|
|||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkRadioButton" id="method-tree">
|
<object class="GtkRadioButton" id="method-tree">
|
||||||
<property name="label" translatable="yes">Network _Install (HTTP, FTP, or NFS)</property>
|
<property name="label" translatable="yes">Network _Install (HTTP, HTTPS, or FTP)</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">False</property>
|
<property name="receives_default">False</property>
|
||||||
|
@ -824,8 +824,8 @@ def parse_args():
|
|||||||
insg.add_argument("-c", dest="cdrom_short", help=argparse.SUPPRESS)
|
insg.add_argument("-c", dest="cdrom_short", help=argparse.SUPPRESS)
|
||||||
insg.add_argument("--cdrom", help=_("CD-ROM installation media"))
|
insg.add_argument("--cdrom", help=_("CD-ROM installation media"))
|
||||||
insg.add_argument("-l", "--location",
|
insg.add_argument("-l", "--location",
|
||||||
help=_("Installation source (eg, nfs:host:/path, "
|
help=_("Distro install URL, eg. https://host/path. See man "
|
||||||
"https://host/path, ftp://host/path)"))
|
"page for specific distro examples."))
|
||||||
insg.add_argument("--pxe", action="store_true",
|
insg.add_argument("--pxe", action="store_true",
|
||||||
help=_("Boot from the network using the PXE protocol"))
|
help=_("Boot from the network using the PXE protocol"))
|
||||||
insg.add_argument("--import", action="store_true", dest="import_install",
|
insg.add_argument("--import", action="store_true", dest="import_install",
|
||||||
|
@ -20,33 +20,14 @@ from .osdict import OSDB
|
|||||||
|
|
||||||
def _is_url(conn, url):
|
def _is_url(conn, url):
|
||||||
"""
|
"""
|
||||||
Check if passed string is a (pseudo) valid http, ftp, or nfs url.
|
Check if passed string is an http or ftp URL
|
||||||
"""
|
"""
|
||||||
if not conn.is_remote() and os.path.exists(url):
|
if not conn.is_remote() and os.path.exists(url):
|
||||||
return os.path.isdir(url)
|
return os.path.isdir(url)
|
||||||
|
|
||||||
return (url.startswith("http://") or url.startswith("https://") or
|
return (url.startswith("http://") or
|
||||||
url.startswith("ftp://") or url.startswith("nfs:"))
|
url.startswith("https://") or
|
||||||
|
url.startswith("ftp://"))
|
||||||
|
|
||||||
def _sanitize_url(url):
|
|
||||||
"""
|
|
||||||
Do nothing for http or ftp, but make sure nfs is in the expected format
|
|
||||||
"""
|
|
||||||
if url.startswith("nfs://"):
|
|
||||||
# Convert RFC compliant NFS nfs://server/path/to/distro
|
|
||||||
# to what mount/anaconda expect nfs:server:/path/to/distro
|
|
||||||
# and carry the latter form around internally
|
|
||||||
url = "nfs:" + url[6:]
|
|
||||||
|
|
||||||
# If we need to add the : after the server
|
|
||||||
index = url.find("/", 4)
|
|
||||||
if index == -1:
|
|
||||||
raise ValueError(_("Invalid NFS format: No path specified."))
|
|
||||||
if url[index - 1] != ":":
|
|
||||||
url = url[:index] + ":" + url[index:]
|
|
||||||
|
|
||||||
return url
|
|
||||||
|
|
||||||
|
|
||||||
# Enum of the various install media types we can have
|
# Enum of the various install media types we can have
|
||||||
@ -160,14 +141,14 @@ class DistroInstaller(Installer):
|
|||||||
1) it can be a local file (ex. boot.iso), directory (ex. distro
|
1) it can be a local file (ex. boot.iso), directory (ex. distro
|
||||||
tree) or physical device (ex. cdrom media)
|
tree) or physical device (ex. cdrom media)
|
||||||
|
|
||||||
2) http, ftp, or nfs path for an install tree
|
2) http, https, or ftp for an install tree
|
||||||
"""
|
"""
|
||||||
self._cached_store = None
|
self._cached_store = None
|
||||||
self._cached_fetcher = None
|
self._cached_fetcher = None
|
||||||
|
|
||||||
if _is_url(self.conn, val):
|
if _is_url(self.conn, val):
|
||||||
logging.debug("DistroInstaller location is a network source.")
|
logging.debug("DistroInstaller location is a network source.")
|
||||||
return _sanitize_url(val)
|
return val
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dev = DeviceDisk(self.conn)
|
dev = DeviceDisk(self.conn)
|
||||||
@ -178,6 +159,12 @@ class DistroInstaller(Installer):
|
|||||||
val = dev.path
|
val = dev.path
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.debug("Error validating install location", exc_info=True)
|
logging.debug("Error validating install location", exc_info=True)
|
||||||
|
if val.startswith("nfs:"):
|
||||||
|
logging.warning("NFS URL installs are no longer supported. "
|
||||||
|
"Access your install media over an alternate transport "
|
||||||
|
"like HTTP, or manually mount the NFS share and install "
|
||||||
|
"from the local directory mount point.")
|
||||||
|
|
||||||
raise ValueError(_("Validating install media '%s' failed: %s") %
|
raise ValueError(_("Validating install media '%s' failed: %s") %
|
||||||
(str(val), e))
|
(str(val), e))
|
||||||
|
|
||||||
|
@ -16,14 +16,14 @@ import urllib
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
#########################################################################
|
###########################################################################
|
||||||
# Backends for the various URL types we support (http, ftp, nfs, local) #
|
# Backends for the various URL types we support (http, https, ftp, local) #
|
||||||
#########################################################################
|
###########################################################################
|
||||||
|
|
||||||
class _URLFetcher(object):
|
class _URLFetcher(object):
|
||||||
"""
|
"""
|
||||||
This is a generic base class for fetching/extracting files from
|
This is a generic base class for fetching/extracting files from
|
||||||
a media source, such as CD ISO, NFS server, or HTTP/FTP server
|
a media source, such as CD ISO, or HTTP/HTTPS/FTP server
|
||||||
"""
|
"""
|
||||||
_block_size = 16384
|
_block_size = 16384
|
||||||
|
|
||||||
@ -286,55 +286,6 @@ class _LocalURLFetcher(_URLFetcher):
|
|||||||
return urlobj, size
|
return urlobj, size
|
||||||
|
|
||||||
|
|
||||||
class _MountedURLFetcher(_LocalURLFetcher):
|
|
||||||
"""
|
|
||||||
Fetcher capable of extracting files from a NFS server
|
|
||||||
or loopback mounted file, or local CDROM device
|
|
||||||
"""
|
|
||||||
_in_test_suite = bool("VIRTINST_TEST_SUITE" in os.environ)
|
|
||||||
_mounted = False
|
|
||||||
|
|
||||||
def prepareLocation(self):
|
|
||||||
if self._mounted:
|
|
||||||
return
|
|
||||||
|
|
||||||
if self._in_test_suite:
|
|
||||||
self._srcdir = os.environ["VIRTINST_TEST_URL_DIR"]
|
|
||||||
else:
|
|
||||||
self._srcdir = tempfile.mkdtemp(prefix="virtinstmnt.",
|
|
||||||
dir=self.scratchdir)
|
|
||||||
mountcmd = "/bin/mount"
|
|
||||||
|
|
||||||
logging.debug("Preparing mount at %s", self._srcdir)
|
|
||||||
cmd = [mountcmd, "-o", "ro", self.location[4:], self._srcdir]
|
|
||||||
|
|
||||||
logging.debug("mount cmd: %s", cmd)
|
|
||||||
if not self._in_test_suite:
|
|
||||||
ret = subprocess.call(cmd)
|
|
||||||
if ret != 0:
|
|
||||||
self.cleanupLocation()
|
|
||||||
raise ValueError(_("Mounting location '%s' failed") %
|
|
||||||
(self.location))
|
|
||||||
|
|
||||||
self._mounted = True
|
|
||||||
|
|
||||||
def cleanupLocation(self):
|
|
||||||
if not self._mounted:
|
|
||||||
return
|
|
||||||
|
|
||||||
logging.debug("Cleaning up mount at %s", self._srcdir)
|
|
||||||
try:
|
|
||||||
if not self._in_test_suite:
|
|
||||||
cmd = ["/bin/umount", self._srcdir]
|
|
||||||
subprocess.call(cmd)
|
|
||||||
try:
|
|
||||||
os.rmdir(self._srcdir)
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
finally:
|
|
||||||
self._mounted = False
|
|
||||||
|
|
||||||
|
|
||||||
class _ISOURLFetcher(_URLFetcher):
|
class _ISOURLFetcher(_URLFetcher):
|
||||||
_cache_file_list = None
|
_cache_file_list = None
|
||||||
|
|
||||||
@ -375,8 +326,6 @@ def fetcherForURI(uri, *args, **kwargs):
|
|||||||
fclass = _HTTPURLFetcher
|
fclass = _HTTPURLFetcher
|
||||||
elif uri.startswith("ftp://"):
|
elif uri.startswith("ftp://"):
|
||||||
fclass = _FTPURLFetcher
|
fclass = _FTPURLFetcher
|
||||||
elif uri.startswith("nfs:"):
|
|
||||||
fclass = _MountedURLFetcher
|
|
||||||
elif os.path.isdir(uri):
|
elif os.path.isdir(uri):
|
||||||
# Pointing to a local tree
|
# Pointing to a local tree
|
||||||
fclass = _LocalURLFetcher
|
fclass = _LocalURLFetcher
|
||||||
|
Loading…
x
Reference in New Issue
Block a user