Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 12 additions & 6 deletions backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def getPrepSequence(ans, interactive):
seq = [
Task(util.getUUID, As(ans), ['installation-uuid']),
Task(util.getUUID, As(ans), ['control-domain-uuid']),
Task(util.getMgmtAddrType, As(ans), ['management-address-type']),
Task(util.randomLabelStr, As(ans), ['disk-label-suffix']),
Task(partitionTargetDisk, A(ans, 'primary-disk', 'installation-to-overwrite', 'preserve-first-partition','sr-on-primary', 'target-platform'),
['target-boot-mode', 'primary-partnum', 'backup-partnum', 'storage-partnum', 'boot-partnum', 'logs-partnum', 'swap-partnum']),
Expand Down Expand Up @@ -188,7 +189,7 @@ def getFinalisationSequence(ans):
Task(writeFstab, A(ans, 'mounts', 'target-boot-mode', 'primary-disk', 'logs-partnum', 'swap-partnum', 'disk-label-suffix'), []),
Task(enableAgent, A(ans, 'mounts', 'network-backend', 'services'), []),
Task(configureCC, A(ans, 'mounts'), []),
Task(writeInventory, A(ans, 'installation-uuid', 'control-domain-uuid', 'mounts', 'primary-disk',
Task(writeInventory, A(ans, 'installation-uuid', 'control-domain-uuid', 'management-address-type', 'mounts', 'primary-disk',
'backup-partnum', 'logs-partnum', 'boot-partnum', 'swap-partnum', 'storage-partnum',
'guest-disks', 'net-admin-bridge',
'branding', 'net-admin-configuration', 'host-config', 'install-type'), []),
Expand Down Expand Up @@ -1590,7 +1591,7 @@ def writeXencommons(controlID, mounts):
with open(os.path.join(mounts['root'], constants.XENCOMMONS_FILE), "w") as f:
f.write(contents)

def writeInventory(installID, controlID, mounts, primary_disk, backup_partnum, logs_partnum, boot_partnum, swap_partnum,
def writeInventory(installID, controlID, mgmtAddrType, mounts, primary_disk, backup_partnum, logs_partnum, boot_partnum, swap_partnum,
storage_partnum, guest_disks, admin_bridge, branding, admin_config, host_config, install_type):
inv = open(os.path.join(mounts['root'], constants.INVENTORY_FILE), "w")
if 'product-brand' in branding:
Expand Down Expand Up @@ -1640,11 +1641,16 @@ def writeInventory(installID, controlID, mounts, primary_disk, backup_partnum, l
inv.write("DOM0_MEM='%d'\n" % host_config['dom0-mem'])
inv.write("DOM0_VCPUS='%d'\n" % host_config['dom0-vcpus'])
inv.write("MANAGEMENT_INTERFACE='%s'\n" % admin_bridge)
# Default to IPv4 unless we have only got an IPv6 admin interface
if ((not admin_config.mode) and admin_config.modev6):
inv.write("MANAGEMENT_ADDRESS_TYPE='IPv6'\n")
# If we read MANAGEMENT_ADDRESS_TYPE from xensource-inventory use it
if mgmtAddrType:
Comment thread
gthvn1 marked this conversation as resolved.
# On upgrade, persist value read from install
inv.write("MANAGEMENT_ADDRESS_TYPE='%s'\n" % mgmtAddrType)
else:
inv.write("MANAGEMENT_ADDRESS_TYPE='IPv4'\n")
# On install, default to IPv4 unless we have only got an IPv6 admin interface
if ((not admin_config.mode) and admin_config.modev6):
inv.write("MANAGEMENT_ADDRESS_TYPE='IPv6'\n")
else:
inv.write("MANAGEMENT_ADDRESS_TYPE='IPv4'\n")
if constants.CC_PREPARATIONS and install_type == constants.INSTALL_TYPE_FRESH:
inv.write("CC_PREPARATIONS='true'\n")
inv.close()
Expand Down
11 changes: 6 additions & 5 deletions upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,18 +592,19 @@ def replace_config(config_file, destination):
finally:
primary_fs.unmount()

prepUpgradeArgs = ['installation-uuid', 'control-domain-uuid']
prepStateChanges = ['installation-uuid', 'control-domain-uuid']
def prepareUpgrade(self, progress_callback, installID, controlID):
prepUpgradeArgs = []
prepStateChanges = ['installation-uuid', 'control-domain-uuid', 'management-address-type']
def prepareUpgrade(self, progress_callback):
""" Try to preserve the installation and control-domain UUIDs from
xensource-inventory."""
try:
installID = self.source.getInventoryValue("INSTALLATION_UUID")
controlID = self.source.getInventoryValue("CONTROL_DOMAIN_UUID")
mgmtAddrType = self.source.getInventoryValue("MANAGEMENT_ADDRESS_TYPE")
except KeyError:
raise RuntimeError("Required information (INSTALLATION_UUID, CONTROL_DOMAIN_UUID) was missing from your xensource-inventory file. Aborting installation; please replace these keys and try again.")
raise RuntimeError("Required information (INSTALLATION_UUID, CONTROL_DOMAIN_UUID, MANAGEMENT_ADDRESS_TYPE) was missing from your xensource-inventory file. Aborting installation; please replace these keys and try again.")

return installID, controlID
return installID, controlID, mgmtAddrType

def buildRestoreList(self, src_base):
restore_list = []
Expand Down
3 changes: 3 additions & 0 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@ def udevinfoCmd():
def randomLabelStr():
return "".join([random.choice(string.ascii_lowercase) for x in range(6)])

def getMgmtAddrType():
return None

def getLocalTime(timezone=None):
if timezone:
os.environ['TZ'] = timezone
Expand Down