Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
0e4b38d
XSI-1498: Log any exceptions parsing existing bootloader config
alexbrett Oct 24, 2023
09f0562
CA-385350 Fix handling of NTP configuration over upgrade
alexbrett Nov 23, 2023
07c1a7d
CA-384621: Do not move partition to preserve data
freddy77 Nov 30, 2023
7f88db7
Use explicit integer division where necessary
freddy77 Dec 4, 2023
d974caf
Include mmcblk-devices in disk selection
stormi Nov 27, 2019
c6238e3
Use constant octal syntax compatible with Python3
freddy77 Dec 20, 2023
6a7b6f1
CP-37929: Remove legacy logrotate mechanism
GeraldEV Dec 18, 2023
3cf696b
CP-44441: Restore SNMP service config
Jan 8, 2024
417078c
CP-47538: Deprecate legacy BIOS boot
rosslagerwall Feb 1, 2024
9bffd2e
CP-45553: Add library for shrinking LVM devices
rosslagerwall Dec 7, 2023
2d15318
CP-45554: Implement support for upgrading from old MBR to new GPT layout
rosslagerwall Dec 7, 2023
2eeb155
Update probeDisk function documentation
freddy77 Dec 15, 2023
e76eb11
Remove unused variable
freddy77 Dec 15, 2023
89d2193
Remove unused parameter from probeDisk
freddy77 Dec 15, 2023
07c8fb4
Reuse constants.logsfs_label_prefix
freddy77 Dec 15, 2023
f765104
Return an object from probeDisk, not a tuple of tuples
freddy77 Dec 18, 2023
d277ab8
Rename inspectTargetDisk function
freddy77 Dec 15, 2023
e9d686a
Allows to restore really old layout used by NetScaler SDX machines
freddy77 Dec 19, 2023
6387fe6
CP-45747 Allow 4KN-capable SR type to be used
Nov 17, 2023
81047f8
CP-45747 Minor wording tweaks for local storage screens
Nov 30, 2023
05be3fc
CP-47742 Allow non-4kn-capable SR type use
Feb 9, 2024
041fe19
CA-389160: Filter secrets and sensitive data from the results/answer …
GeraldEV Feb 27, 2024
abb1518
CA-391659: Preserve hidden flag updating GPT partitions
freddy77 Apr 24, 2024
0353276
CA-391659: Set correct partition type restoring XS 7.1
freddy77 Apr 24, 2024
5abd998
CP-47625: Replace mkinitrd with dracut command
liulinC Apr 8, 2024
8855782
CA-392333: Do not use host-only fallback initrd
freddy77 Apr 29, 2024
d1a1264
Fix comment indentation
freddy77 Feb 21, 2024
07102a8
Reduce indentation
freddy77 Feb 21, 2024
99bec34
CA-391027: Mount devices specified by mount= only when needed
freddy77 Apr 16, 2024
8390720
Reuse context manager to mount directory for chroot executed commands
freddy77 Apr 29, 2024
02c15fa
setEfiBootEntry: make error messages more useful
ydirson May 2, 2024
a9ab497
Revert "Reuse context manager to mount directory for chroot executed …
freddy77 May 9, 2024
215171c
CA-389863: Speed up installation with newer systemd
rosslagerwall May 3, 2024
51fdf94
Compatibility for Python 2
freddy77 May 9, 2024
b4f3dae
Fix typo in comment
freddy77 May 9, 2024
0e867d8
Use list comprehension if possible
freddy77 May 9, 2024
8cf6e83
Remove shebang line where not needed
freddy77 May 9, 2024
d3f1100
CP-45668: Boot shim instead of grub
rosslagerwall Jan 30, 2023
29c7bb5
CP-47745: Detect EFI shim presence dynamically
freddy77 Apr 15, 2024
1446e84
Rewrite error_string function
freddy77 Dec 8, 2023
c61ac93
Add a test for error_string function
freddy77 Dec 8, 2023
1bd833e
Remove useless check
freddy77 Dec 20, 2023
ee4c19d
Fix sector computation for disk with sector size not 512
freddy77 Dec 4, 2023
0c5f6d1
Use blockdev command to read sector size
freddy77 Apr 30, 2024
366b686
Make print statements Python 2/3 compatible
freddy77 May 10, 2024
c127d60
Use universal_newlines option for Popen
freddy77 May 10, 2024
e8be46d
Force list in some cases
freddy77 May 10, 2024
52fe424
Use range and items to increase Python 2/3 compatibility
freddy77 May 13, 2024
30acf26
Use list comprehension if possible
freddy77 May 13, 2024
5143dfa
Repartition with one single command
freddy77 Apr 26, 2024
6c91221
CA-392935: Release device if partition does not need to be resized
freddy77 May 15, 2024
c28050d
Replace cpiofile._Stream() with GZipFile(BytesIO(fp.read())
bernhardkaindl May 15, 2024
19312e3
CA-392916: Create directory for mount= option
freddy77 May 15, 2024
df02532
CA-392758: Remove Firmware Boot Selected flag check
rosslagerwall May 7, 2024
27efb59
CP-49195: Allows to preserve first partition from MBR layout
freddy77 May 21, 2024
7463132
CP-49641: Ignore errors mounting/unmounting explicit mount points
freddy77 May 22, 2024
1fa9cb3
Use xl command instead of small inline python
freddy77 May 22, 2024
4e2c7c8
CA-393429: Fix upgrade to XS8 from downgraded SDX MBR installation
freddy77 May 28, 2024
f67aec4
CA-392317: Make sure kernel is up to date using Gdisk
freddy77 Jun 5, 2024
140c446
Provide a Makefile for installation
ydirson Dec 8, 2022
5d933d0
Replace brittle usage of sed with a patchfile
ydirson Jun 12, 2024
b14b31b
Remove unused variable "err"
freddy77 Jun 24, 2024
368af7d
Factor out a function to parse partition data from (s)gdisk output
freddy77 Jun 25, 2024
e09a331
Factor out a function to parse partition data from (s)gdisk output
freddy77 Jun 25, 2024
6186e98
Handle corrupted GPT data if disk is using MBR
freddy77 Jun 24, 2024
df8417b
Copy missing files during "make install"
freddy77 Jun 27, 2024
0d91e2d
CA-395582: Fix installation with multipath enabled
rosslagerwall Jul 12, 2024
819ed35
Ensure esp mount point is known before setting EFI boot entries
GeraldEV Oct 18, 2024
1a797d1
Preserve pool certificates across RPUs
psafont Feb 5, 2024
4edba24
Preserve more stunnel certificates on upgrade
ydirson Jul 12, 2024
087281f
squash! Preserve more stunnel certificates on upgrade
ydirson Aug 6, 2024
103440d
restore_file: make a single lookup of 're' in dict
ydirson Aug 6, 2024
1095053
restore_file: when no re is given for a dir, preserve whole dir in on…
ydirson Aug 6, 2024
db1bf25
Change buildRestoreList to return list of files
freddy77 Oct 28, 2024
179e42f
Dynamically compute layout string based on partition availability
freddy77 Oct 14, 2024
983c451
Use partition numbers to sort partitionTargetDisk output
freddy77 Oct 28, 2024
c36d778
Remove support for very old Xapi DB name
freddy77 Nov 7, 2024
934d166
Add a comment for ID_LINUX partition GUID
freddy77 Nov 25, 2024
020b868
Simplify results from partitionTargetDisk
freddy77 Nov 1, 2024
01f5af0
Start adding support for "target-platform" configuration
freddy77 Oct 24, 2024
e20f8ca
Allows to avoid some partitions during installation
freddy77 Oct 14, 2024
3ec7596
Allows automatic conversion of some partitions to GPT
freddy77 Nov 13, 2024
670ca91
CP-51857: Support clean install for SDX 8900 platform
freddy77 Nov 13, 2024
6ca7ba2
CP-51858: Support upgrades for SDX 8900 platform
freddy77 Nov 13, 2024
0a48ce6
Simplify partition order computation upgrading partition schema
freddy77 Oct 28, 2024
e4ca591
CA-403412: Do not backup GPT layout on temporary directory
freddy77 Dec 5, 2024
86347fc
CA-400058: fix preserve-first-partition installation
chunjiez Nov 4, 2024
bcea46d
CP-50298: Support restoring dir to specified mode and user/group
Sep 15, 2024
ff102e1
CA-407867: Add missed "attr" parameter to restore_file()
Mar 11, 2025
457b7ed
revert "CA-400058: fix preserve-first-partition installation"
chunjiez Mar 12, 2025
78dfd0c
CP-47621: Enable ability to set hostname from DHCP
liulinC Feb 23, 2024
3c6b1ff
Makefile: give more flexibility to select base multipath.conf
ydirson Mar 12, 2025
074bd0a
doc/answerfile: clarify and fix description of --network_device
ydirson Jan 17, 2025
bdd4872
__mkinitrd: pass -f to dracut
ydirson Jul 10, 2024
b4eb53d
Avoid attempting to re-read inventory file from unmounted partition
ydirson Mar 19, 2025
d24b832
doc/answerfile: reduce admin-interface confusion
ydirson Sep 3, 2024
6e8cbf6
XSI-1863: Use a disk size of zero if a disk size cannot be determined
GeraldEV Apr 7, 2025
1bf7cc9
XSI-1887: Fix upgrade
freddy77 Apr 29, 2025
6c5cafe
Keep user multipath configuration upon upgrade
benjamreis Jul 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -284,28 +284,3 @@ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.

========================================================================

cpiofile.py is licensed under the terms of the MIT license:

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
97 changes: 97 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# destinations
DESTDIR =
INSTALLER_DIR = /opt/xensource/installer
EFI_DIR = /EFI/xenserver

# root of a tree with sm.rpm unpacked
SM_ROOTDIR =
# multipath.conf to be taken as a base
XS_MPATH_CONF = $(SM_ROOTDIR)/etc/multipath.xenserver/multipath.conf

INSTALL = install

install:
$(INSTALL) -d $(DESTDIR)/usr/bin
$(INSTALL) -m755 support.sh $(DESTDIR)/usr/bin
$(INSTALL) -d $(DESTDIR)$(INSTALLER_DIR)/tui/installer/
$(INSTALL) -m755 \
init \
$(DESTDIR)$(INSTALLER_DIR)/
$(INSTALL) -m644 \
keymaps \
timezones \
answerfile.py \
backend.py \
common_criteria_firewall_rules \
constants.py \
disktools.py \
diskutil.py \
driver.py \
fcoeutil.py \
generalui.py \
hardware.py \
init_constants.py \
install.py \
netinterface.py \
netutil.py \
ppexpect.py \
product.py \
report.py \
repository.py \
restore.py \
scripts.py \
shrinklvm.py \
snackutil.py \
uicontroller.py \
upgrade.py \
util.py \
xelogging.py \
$(DESTDIR)$(INSTALLER_DIR)/
$(INSTALL) -m644 \
tui/__init__.py \
tui/init.py \
tui/fcoe.py \
tui/network.py \
tui/progress.py \
tui/repo.py \
$(DESTDIR)$(INSTALLER_DIR)/tui/
$(INSTALL) -m644 \
tui/installer/__init__.py \
tui/installer/screens.py \
$(DESTDIR)$(INSTALLER_DIR)/tui/installer/

# Startup files
$(INSTALL) -d \
$(DESTDIR)/etc/init.d \
$(DESTDIR)/etc/modprobe.d \
$(DESTDIR)/etc/modules-load.d \
$(DESTDIR)/etc/depmod.d \
$(DESTDIR)/etc/dracut.conf.d \
$(DESTDIR)/etc/systemd/system/systemd-udevd.d

$(INSTALL) -m755 startup/interface-rename-sideway startup/early-blacklist $(DESTDIR)/etc/init.d/
$(INSTALL) -m644 startup/functions $(DESTDIR)/etc/init.d/installer-functions
$(INSTALL) -m644 startup/early-blacklist.conf startup/bnx2x.conf $(DESTDIR)/etc/modprobe.d/
$(INSTALL) -m644 startup/blacklist $(DESTDIR)/etc/modprobe.d/installer-blacklist.conf
$(INSTALL) -m644 startup/modprobe.mlx4 $(DESTDIR)/etc/modprobe.d/mlx4.conf
$(INSTALL) -m644 startup/iscsi-modules $(DESTDIR)/etc/modules-load.d/iscsi.conf
$(INSTALL) -m644 startup/depmod.conf $(DESTDIR)/etc/depmod.d/
$(INSTALL) -m755 startup/preinit startup/S05ramdisk $(DESTDIR)/$(INSTALLER_DIR)/
$(INSTALL) -m644 startup/systemd-udevd_depmod.conf $(DESTDIR)/etc/systemd/system/systemd-udevd.d/installer.conf

# Generate a multipath configuration from sm's copy, removing
# the blacklist and blacklist_exception sections.
sed 's/\(^[[:space:]]*find_multipaths[[:space:]]*\)yes/\1no/' \
< $(XS_MPATH_CONF) \
> $(DESTDIR)/etc/multipath.conf.disabled

# bootloader files
$(INSTALL) -D -m644 bootloader/grub.cfg $(DESTDIR)$(EFI_DIR)/grub.cfg
$(INSTALL) -D -m644 bootloader/grub.cfg $(DESTDIR)$(EFI_DIR)/grub-usb.cfg

patch < bootloader/grub-usb.patch $(DESTDIR)$(EFI_DIR)/grub-usb.cfg

$(INSTALL) -D -m644 bootloader/isolinux.cfg $(DESTDIR)/boot/isolinux/isolinux.cfg

printf "echo Skipping initrd creation in the installer\nexit 0\n" \
> $(DESTDIR)/etc/dracut.conf.d/installer.conf
51 changes: 39 additions & 12 deletions answerfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python

# SPDX-License-Identifier: GPL-2.0-only

"""answerfile - parse installation answerfiles"""
Expand Down Expand Up @@ -113,7 +111,7 @@ def buildURL(stype, path):
script = buildURL(stype, getText(node))
scripts.add_script(stage, script)

# depreciated formats
# deprecated formats
nodes = getElementsByTagName(self.top_node, ['post-install-script'])
if len(nodes) == 1:
stype = getStrAttribute(nodes[0], ['type'], mandatory=False).lower()
Expand Down Expand Up @@ -181,7 +179,7 @@ def parseRestore(self):
disk = normalize_disk(getText(nodes[0]))
disk = disktools.getMpathMasterOrDisk(disk)
logger.log("Filtering backup list for disk %s" % disk)
backups = filter(lambda x: x.root_disk == disk, backups)
backups = [x for x in backups if x.root_disk == disk]
logger.log("Backup list filtered: %s" % ", ".join(str(b) for b in backups))

if len(backups) > 1:
Expand Down Expand Up @@ -222,6 +220,11 @@ def parseCommon(self):
if bl not in ['' , 'grub2']:
raise AnswerfileException("Unsupported bootloader '%s'" % bl)

results['target-platform'] = ''
nodes = getElementsByTagName(self.top_node, ['target-platform'])
if len(nodes) > 0:
results['target-platform'] = getText(nodes[0])

return results

def parseExistingInstallation(self):
Expand All @@ -236,13 +239,13 @@ def parseExistingInstallation(self):
results['primary-disk'] = disk

installations = product.findXenSourceProducts()
installations = filter(lambda x: x.primary_disk == disk or diskutil.idFromPartition(x.primary_disk) == disk, installations)
installations = [x for x in installations if x.primary_disk == disk or diskutil.idFromPartition(x.primary_disk) == disk]
if len(installations) == 0:
raise AnswerfileException("Could not locate the installation specified to be reinstalled.")
elif len(installations) > 1:
# FIXME non-multipath case?
logger.log("Warning: multiple paths detected - recommend use of --device_mapper_multipath=yes")
logger.log("Warning: selecting 1st path from %s" % str(map(lambda x: x.primary_disk, installations)))
logger.log("Warning: selecting 1st path from %s" % str([x.primary_disk for x in installations]))
results['installation-to-overwrite'] = installations[0]
return results

Expand Down Expand Up @@ -322,9 +325,33 @@ def parseDisks(self):
results['sr-on-primary'] = results['primary-disk'] in guest_disks
results['guest-disks'] = list(guest_disks)

results['sr-type'] = getMapAttribute(self.top_node, ['sr-type', 'srtype'],
[('lvm', SR_TYPE_LVM),
('ext', SR_TYPE_EXT)], default='lvm')
sr_type_mapping = []
for sr_type in SR_TYPE_LVM, SR_TYPE_EXT, SR_TYPE_LARGE_BLOCK:
if sr_type:
sr_type_mapping.append((sr_type, sr_type))

large_block_disks = [
disk
for disk in guest_disks
if diskutil.isLargeBlockDisk(disk)
]

if SR_TYPE_LARGE_BLOCK and len(large_block_disks) > 0:
default_sr_type = SR_TYPE_LARGE_BLOCK
else:
default_sr_type = SR_TYPE_LVM

sr_type = getMapAttribute(self.top_node,
['sr-type', 'srtype'],
sr_type_mapping,
default=default_sr_type)

if SR_TYPE_LARGE_BLOCK and sr_type != SR_TYPE_LARGE_BLOCK and len(large_block_disks) > 0:
raise AnswerfileException("%s not compatible with SR type %s"
% (", ".join(large_block_disks), sr_type))

results['sr-type'] = sr_type

return results

def parseFCoEInterface(self):
Expand All @@ -342,7 +369,7 @@ def parseFCoEInterface(self):
else:
if_hwaddr = getStrAttribute(interface, ['hwaddr'])
if if_hwaddr:
matching_list = filter(lambda x: x.hwaddr == if_hwaddr.lower(), nethw.values())
matching_list = [x for x in list(nethw.values()) if x.hwaddr == if_hwaddr.lower()]
if len(matching_list) == 1:
if_name = matching_list[0].name
if not if_name and not if_hwaddr:
Expand All @@ -364,7 +391,7 @@ def parseInterface(self):
else:
if_hwaddr = getStrAttribute(node, ['hwaddr'])
if if_hwaddr:
matching_list = filter(lambda x: x.hwaddr == if_hwaddr.lower(), nethw.values())
matching_list = [x for x in list(nethw.values()) if x.hwaddr == if_hwaddr.lower()]
if len(matching_list) == 1:
if_name = matching_list[0].name
if not if_name and not if_hwaddr:
Expand Down Expand Up @@ -416,7 +443,7 @@ def parseRootPassword(self):
def parseNSConfig(self):
results = {}
nodes = getElementsByTagName(self.top_node, ['name-server', 'nameserver'])
results['manual-nameservers'] = (len(nodes) > 0, map(lambda x: getText(x), nodes))
results['manual-nameservers'] = (len(nodes) > 0, [getText(x) for x in nodes])
nodes = getElementsByTagName(self.top_node, ['hostname'])
if len(nodes) > 0:
results['manual-hostname'] = (True, getText(nodes[0]))
Expand Down
Loading