[pve-devel] [PATCH v5 qemu-server 3/3] add target-cpu param

Alexandre Derumier aderumier at odiso.com
Thu Oct 26 10:57:10 CEST 2023


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/API2/Qemu.pm   | 7 +++++++
 PVE/CLI/qm.pm      | 7 +++++++
 PVE/QemuMigrate.pm | 1 +
 3 files changed, 15 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index c0ae516..291eb2b 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -4597,6 +4597,13 @@ __PACKAGE__->register_method({
 		description => "Mapping from source to target bridges. Providing only a single bridge ID maps all source bridges to that bridge. Providing the special value '1' will map each source bridge to itself.",
 		format => 'bridge-pair-list',
 	    },
+	    'target-cpu' => {
+		optional => 1,
+		description => "Target Emulated CPU model. For online migration, this require restart option",
+		type => 'string',
+		requires => 'restart',
+		format => 'pve-vm-cpu-conf',
+	    },
 	    bwlimit => {
 		description => "Override I/O bandwidth limit (in KiB/s).",
 		optional => 1,
diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index 12c5291..358ace6 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -194,6 +194,13 @@ __PACKAGE__->register_method({
 		description => "For online migration , skip memory migration and restart the vm.",
 		optional => 1,
 	    },
+	    'target-cpu' => {
+		optional => 1,
+		description => "Target Emulated CPU model. For online migration, this require restart option",
+		type => 'string',
+		requires => 'restart',
+		format => 'pve-vm-cpu-conf',
+	    },
 	    'target-storage' => get_standard_option('pve-targetstorage', {
 		completion => \&PVE::QemuServer::complete_migration_storage,
 		optional => 0,
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index c801362..a0e3d04 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -998,6 +998,7 @@ sub phase1_remote {
     my ($self, $vmid) = @_;
 
     my $remote_conf = PVE::QemuConfig->load_config($vmid);
+    $remote_conf->{cpu} = $self->{opts}->{'target-cpu'} if $self->{opts}->{'target-cpu'};
     PVE::QemuConfig->update_volume_ids($remote_conf, $self->{volume_map});
 
     my $bridges = map_bridges($remote_conf, $self->{opts}->{bridgemap});
-- 
2.39.2





More information about the pve-devel mailing list