David Scott [Wed, 26 Jan 2011 17:39:06 +0000 (17:39 +0000)]
Rewrite the pool database restore processing to use the type-safe Db.* API, now that it's possible to have multiple active databases. Fold the 'post_restore_hook' logic into a single 'prepare' step as there was no special reason it had to be done so late (and in the wrong layer of the code)
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:06 +0000 (17:39 +0000)]
Now that all the release-specific upgrade rules are in the 'db_hiupgrade' (from where they can use the type-safe Db.* API), remove the unneeded low-level logic.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:06 +0000 (17:39 +0000)]
Rewrite the database upgrade update_snapshots to use the type-safe Db.* API rather than the unsafe low-level database API. Move this xapi-specific stuff out of the database layer and put it further up the stack.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:06 +0000 (17:39 +0000)]
Rewrite the database upgrade upgrade_bios_strings to use the type-safe Db.* API rather than the unsafe low-level database API. Move this xapi-specific stuff out of the database layer and put it further up the stack.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:06 +0000 (17:39 +0000)]
Rewrite the database upgrade upgrade_vm_records to use the type-safe Db.* API rather than the unsafe low-level database API. Move this xapi-specific stuff out of the database layer and put it further up the stack.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:06 +0000 (17:39 +0000)]
Add a new type: Db_ref.t which may be either (In_memory x) or Remote. At the xapi-level, each Context can have a different Db_ref.t, allowing the type-safe Db API to be used on multiple disjoint databases.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:05 +0000 (17:39 +0000)]
Add the possibility of automatically managed many-to-many relationships between objects in the datamodel.
1. Add the concept of a many-to-many mapping in the database schema
2. Loosen the existing datamodel sanity checks to permit this new configuration
3. Enforce referential integrity in the mid-level database update functions (remove_row; set_row_in_table)
Also add a set of unit-tests to check referential integity is maintained across create/destroy/modify
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:05 +0000 (17:39 +0000)]
Always regenerate the 'many' side of a 'one-to-many' relationship at indexing time. This means that every system start acts equivalently to an upgrade from a previous version, simplifying testing.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:05 +0000 (17:39 +0000)]
Remove all mutable state within the database layer, leaving one single global reference (to the master's single "database"). Allow the type-safe Db.* API to be used on more than one database at a time, by adding the "current database" to Context.t. Add a notion of database callbacks which are used by xapi for both the redo-log(s) and the event system.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:05 +0000 (17:39 +0000)]
Remove the xapi_minor from the database manifest because it shouldn't have been used: version checks should have considered the schema version instead.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:05 +0000 (17:39 +0000)]
Remove the xapi_major from the database manifest because it shouldn't have been used: version checks should have considered the schema version instead.
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
David Scott [Wed, 26 Jan 2011 17:39:05 +0000 (17:39 +0000)]
Remove the pool_token from the database manifest since it doesn't make sense to preserve the pool secret if all other hosts are being deleted anyway (on database restore)
Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Mike McClurg [Wed, 26 Jan 2011 17:39:05 +0000 (17:39 +0000)]
CA-47663 The host blob sync logs 10s of thousands of log lines per iteration
The rsync command called by Xapi_sync.sync_host was given the -v (verbose) option, which made it spew tens of thousands of lines into the xensource.log file. I removed the -v option and added --stats in order to keep the file transfer summaries in the output.
Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
Mike McClurg [Wed, 26 Jan 2011 17:39:05 +0000 (17:39 +0000)]
CA-47663: Fix indentation and whitespace problems in xapi_sync.ml
This patch is in preparation to resolve issue CA-47663. I wanted to make a lot of whitespace and indentation changes to this file for readability's sake, and decided to keep those changes separate from the (minor) changes that I will make to actually fix this issue.
Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
Alex Zeffertt [Wed, 26 Jan 2011 17:39:05 +0000 (17:39 +0000)]
CA-47556: Revert to PV template for RHEL 6 64 bit for now
From ticket description:
See CP-1876 - RH have changed their kernel to require an option to use PV on HVM.
We currently have no way to set that option ourselves so would rely on the customer
doing it which they will be very unlikely to do in most cases. Also it's not easy
to switch from emulated drivers to PV therefore the chances are customers will end
up with a poorly performing fully HVM VM.
For RTM I suggest we revert to using the PV template for 64 bit (just like we do
for 32 bit). This is a simple revert of the template code.
Long term we want to move to HVM to avoid the performance penalty of 64 bit PV but
RH6 isn't quite ready yet. This could be a change we make when we turn RH6 support
into fully supported, rather than experimental, in a future LCM update
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Mike McClurg [Wed, 26 Jan 2011 17:39:05 +0000 (17:39 +0000)]
CA-47135 Add "experimental" to RHEL 6 and Debian Squeeze templates
Added "is_experimental" argument to make_long_name function, and added
optional "is_experimental" argument to template building functions. If
a template is experimental (untested), pass the argument
~is_experimental:true to the *_template function.
CA-48240: Debian Squeeze 32-bit shouldn't be experimental, Ubuntu 32-bit
and 64-bit should.
CP-1686: In Boston the Ubuntu templates should not be marked experimental
as they will be tested and supported.
Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com> Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Fixed whitespace (again) in a few files. Modified xapi_ha.ml to
deactivate statefile/metadata vdis before detaching them. Added helper
files in xha_*.ml to do this for us.
Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
Zheng Li [Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)]
CA-41553: Fix logic bugs in vm_install_real and do some code cleanup
There were two logic bugs in vm_install_real
* When user create a VM based on a snapshot (which is also considered as a template from XenServer point of view), and neither sr-name-lable or sr-uuid is specified (neither is wanted any way), the code will fail if the pool doesn't have default SR set (which is not necessary as well). This is the problem spot in CA-41553.
* When both sr-uuid and sr-name-lable are specified in command line at the same time
- If there is some contradiction, say the SR with sr-uuid doesn't have the name as specified in sr-name-label, XenServer will only take sr-name-label into consideration and ignore sr-uuid without a warning
- If sr-name-label corresponding to several SRs in the system, instead of using the sr-uuid information to restrict the candidate to one, XenServer will simply fail and complain "Multiple SRs with that name-label found".
xapi was failing nastily on start-up if the xensource-inventory file was
missing. Now it generates a minimal one if none exists. This does not include
a build number, so version.ml now falls back to using a build number from the
Make environment if one is not available from the inventory, i.e. it falls
back to the behaviour from before Matthias's commit for CA-43574 (build number
from xensource-inventory).
Signed-off-by: Thomas Sanders <thomas.sanders@citrix.com>
Alex Zeffertt [Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)]
Call /opt/xensource/sm/mpathcount.py after xapi started if root disk is multipathed
mpathcount.py now updates the host object when the root disk is multipathed as well
as updating pbd objects. (It writes values into other-config to show XenCenter
how many paths are active and how many are failed.)
Normally it is multipathd that calls mpathcount.py, but in the case of the root
disk the /dev/mapper node is created by the initrd before multipathd is started.
Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com>
Jon Ludlam [Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)]
CP-1981: Hook in the reset-vdis script to HA
The 'locks' for the VDIs, which are maintained by the SM backends now, are stored in xapi's database. In the event of a master failover, the pool database may rev
ert to a previous backup, which is then resynced with reality. Unfortunately there's no logic to resync the SM backends' data, nor any hook point to do this. Idea
lly, the SM backends would store their critical data internally somehow, but until this happens xapi will have to contain the important logic to resynchronise the
se locks.
This patch adds a host-post-declare-dead script that causes the reset of the locks of VDIs that were present on a host that has been declared dead.
Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Jon Ludlam [Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)]
CP-1981: Resynchronise the locks in the sm_config maps of VDIs in dbsync_slave
The 'locks' for the VDIs, which are maintained by the SM backends now, are stored in xapi's database. In the event of a master failover, the pool database may revert to a previous backup, which is then resynced with reality. Unfortunately there's no logic to resync the SM backends' data, nor any hook point to do this. Ideally, the SM backends would store their critical data internally somehow, but until this happens xapi will have to contain the important logic to resynchronise these locks.
This patch implements the logic to resynchronise the sm_config keys based on the information stored in the local database
Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Jon Ludlam [Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)]
CP-1981: Track the vdi_activations in the local database
The 'locks' for the VDIs, which are maintained by the SM backends now, are stored in xapi's database. In the event of a master failover, the pool database may revert to a previous backup, which is then resynced with reality. Unfortunately there's no logic to resync the SM backends' data, nor any hook point to do this. Ideally, the SM backends would store their critical data internally somehow, but until this happens xapi will have to contain the important logic to resynchronise these locks.
This patch maintains a list of the VDIs that have been activatedi (including RW/RO mode) in the local database.
Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Jonathan Knowles [Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)]
[CA-46591] Prevents build_pre from overwriting xen_maxmem.
Signed-off-by: Jonathan Knowles <jonathan.knowles@eu.citrix.com>
Previously, during a VM.resume, both of the following functions would overwrite xen_maxmem:
Xen hg user [Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)]
[whitespace] Conservatively corrects the whitespace for a small number of functions that invoke VM start, in preparation for further patches that will add parameters to VM start.
Signed-off-by: Jonathan Knowles <jonathan.knowles@eu.citrix.com>
Proof that this patch introduces no semantic changes:
Jonathan Knowles [Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)]
[CA-47369] Enables shadow memory by default for PV domains, with a hard-wired multiplier of 1.
Signed-off-by: Jonathan Knowles <jonathan.knowles@eu.citrix.com> Acked-by: Jonathan Ludlam <jonathan.ludlam@eu.citrix.com>
This change enables successful migrations of PV domains away from hosts with no spare memory.
David Scott [Wed, 26 Jan 2011 17:39:04 +0000 (17:39 +0000)]
SCTX-525: only write the names of interfaces ("current interfaces") into the inventory file and cause them to be ifup'ed on system boot if they actually have an IP address configuration in dom0. This avoids initialising bridges for bonds and VLANs which are only for guests and which can be initialised on demand.
Stats:
* 5 host pool
* 300 VLANs, none used
Pool reboot time drops from 45 mins to 8 mins
Signed-off-by: David Scott <dave.scott@eu.citrix.com>