From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 qemu-server 04/13] migration: split out config_update_local_disksizes from scan_local_volumes
Date: Fri, 29 Jan 2021 16:11:34 +0100 [thread overview]
Message-ID: <20210129151143.10014-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210129151143.10014-1-f.ebner@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
No changes from v1
PVE/QemuMigrate.pm | 55 ++++++++++++++++++++++++++--------------------
1 file changed, 31 insertions(+), 24 deletions(-)
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index d0295f8..455581c 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -587,28 +587,6 @@ sub scan_local_volumes {
'PVE::QemuConfig', $self->{replication_jobcfg}, $start_time, $start_time, $logfunc);
}
- # sizes in config have to be accurate for remote node to correctly
- # allocate disks
- PVE::QemuConfig->foreach_volume($conf, sub {
- my ($key, $drive) = @_;
- return if $key eq 'efidisk0'; # skip efidisk, will be handled later
-
- my $volid = $drive->{file};
- return if !defined($local_volumes->{$volid}); # only update sizes for local volumes
-
- my ($updated, $msg) = PVE::QemuServer::Drive::update_disksize($drive, $local_volumes->{$volid}->{size});
- if (defined($updated)) {
- $conf->{$key} = PVE::QemuServer::print_drive($updated);
- $self->log('info', "drive '$key': $msg");
- }
- });
-
- # we want to set the efidisk size in the config to the size of the
- # real OVMF_VARS.fd image, else we can create a too big image, which does not work
- if (defined($conf->{efidisk0})) {
- PVE::QemuServer::update_efidisk_size($conf);
- }
-
foreach my $volid (sort keys %$local_volumes) {
my $ref = $local_volumes->{$volid}->{ref};
if ($self->{running} && $ref eq 'config') {
@@ -628,6 +606,33 @@ sub scan_local_volumes {
die "Problem found while scanning volumes - $@" if $@;
}
+sub config_update_local_disksizes {
+ my ($self) = @_;
+
+ my $conf = $self->{vmconf};
+ my $local_volumes = $self->{local_volumes};
+
+ PVE::QemuConfig->foreach_volume($conf, sub {
+ my ($key, $drive) = @_;
+ return if $key eq 'efidisk0'; # skip efidisk, will be handled later
+
+ my $volid = $drive->{file};
+ return if !defined($local_volumes->{$volid}); # only update sizes for local volumes
+
+ my ($updated, $msg) = PVE::QemuServer::Drive::update_disksize($drive, $local_volumes->{$volid}->{size});
+ if (defined($updated)) {
+ $conf->{$key} = PVE::QemuServer::print_drive($updated);
+ $self->log('info', "drive '$key': $msg");
+ }
+ });
+
+ # we want to set the efidisk size in the config to the size of the
+ # real OVMF_VARS.fd image, else we can create a too big image, which does not work
+ if (defined($conf->{efidisk0})) {
+ PVE::QemuServer::update_efidisk_size($conf);
+ }
+}
+
sub filter_local_volumes {
my ($self, $migration_mode) = @_;
@@ -732,9 +737,11 @@ sub phase1 {
$conf->{lock} = 'migrate';
PVE::QemuConfig->write_config($vmid, $conf);
- # scan_local_volumes fixes disk sizes to match their actual size, write changes so
- # target allocates correct volumes
$self->scan_local_volumes($vmid);
+
+ # fix disk sizes to match their actual size and write changes,
+ # so that the target allocates the correct volumes
+ $self->config_update_local_disksizes();
PVE::QemuConfig->write_config($vmid, $conf);
$self->sync_offline_local_volumes();
--
2.20.1
next prev parent reply other threads:[~2021-01-29 15:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 15:11 [pve-devel] [PATCH-SERIES v2 qemu-server] Cleanup migration code and improve migration disk cleanup Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 01/13] test: migration: add parse_volume_id calls Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 02/13] migration: split sync_disks into two functions Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 03/13] migration: avoid re-scanning all volumes Fabian Ebner
2021-01-29 15:11 ` Fabian Ebner [this message]
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 05/13] migration: fix calculation of bandwith limit for non-disk migration Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 06/13] migration: save targetstorage and bwlimit in local_volumes hash and re-use information Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 07/13] migration: add nbd migrated volumes to volume_map earlier Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 08/13] migration: simplify removal of local volumes and get rid of self->{volumes} Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 09/13] migration: cleanup_remotedisks: simplify and include more disks Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 10/13] migration: use storage_migration for checks instead of online_local_volumes Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 11/13] migration: keep track of replicated volumes via local_volumes Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 12/13] migration: split out replication from scan_local_volumes Fabian Ebner
2021-01-29 15:11 ` [pve-devel] [PATCH v2 qemu-server 13/13] migration: move finishing block jobs to phase2 for better/uniform error handling Fabian Ebner
2021-04-19 6:49 ` [pve-devel] [PATCH-SERIES v2 qemu-server] Cleanup migration code and improve migration disk cleanup Fabian Ebner
2021-04-19 11:50 ` [pve-devel] applied-series: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210129151143.10014-5-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox