How to Apply Promox Patch?

HE_Cole

Member
Oct 25, 2018
45
1
6
33
Miami, FL
Hi everyone!

I want to apply this patch but i am not sure how.

Patch: https://pve.proxmox.com/pipermail/pve-devel/2019-April/036621.html

and the code

Code:
use list_images to check for existence of cloudinit disk instead of
'-e'. this should solve the problem with rbd where the path returned by
PVE::Storage::path is not checkable with '-e'.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
 PVE/QemuServer/Cloudinit.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer/Cloudinit.pm b/PVE/QemuServer/Cloudinit.pm
index 445c777..da08470 100644
--- a/PVE/QemuServer/Cloudinit.pm
+++ b/PVE/QemuServer/Cloudinit.pm
@@ -31,13 +31,17 @@ sub commit_cloudinit_disk {
     my $iso_path = PVE::Storage::path($storecfg, $drive->{file});
     my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
     my $format = PVE::QemuServer::qemu_img_format($scfg, $volname);
-    if (! -e $iso_path) {
+
+    my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+    my $vollist = $plugin->list_images($storeid, $scfg, $vmid);
+    my $exists = grep { $_->{volid} eq $drive->{file} } @$vollist;
+
+    if (!$exists) {
     $volname =~ m/(vm-$vmid-cloudinit(.(qcow2|raw))?)/;
     my $name = $1;
     my $d = PVE::Storage::vdisk_alloc($storecfg, $storeid, $vmid, $format, $name, 4 * 1024);
     }
 
-    my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
     $plugin->activate_volume($storeid, $scfg, $volname);
 
     my $size = PVE::Storage::file_size_info($iso_path);
--
2.11.0

Could someone please explain, I am sure its simple.

I assume

the - means remove line in file
the + is add line in file
?

Thanks
 
Last edited:
This patch was created with the tool 'diff' and the easiest way to apply it is with the tool 'patch'. Copy/Paste the patch into a file, starting with these two lines:
--- a/PVE/QemuServer/Cloudinit.pm
+++ b/PVE/QemuServer/Cloudinit.pm

and ending with
my $size = PVE::Storage::file_size_info($iso_path);

(so do not include the "--" above.)

If you called the file "cloudinit.patch", then you apply it by running:

patch < cloudinit.patch

I highly recommend that you use the "--dry-run" option first. You may need to make sure to run in the right directory so the files can be found, or check the man page for "patch" for details.

hope this helps.

Usually, it is not recommended to apply patches like this, unless you really need to, and can't wait for a packaged update. Also, make sure to back up any files that may be changed.
 
  • Like
Reactions: HE_Cole
This patch was created with the tool 'diff' and the easiest way to apply it is with the tool 'patch'. Copy/Paste the patch into a file, starting with these two lines:
--- a/PVE/QemuServer/Cloudinit.pm
+++ b/PVE/QemuServer/Cloudinit.pm

and ending with
my $size = PVE::Storage::file_size_info($iso_path);

(so do not include the "--" above.)

If you called the file "cloudinit.patch", then you apply it by running:

patch < cloudinit.patch

I highly recommend that you use the "--dry-run" option first. You may need to make sure to run in the right directory so the files can be found, or check the man page for "patch" for details.

hope this helps.

Usually, it is not recommended to apply patches like this, unless you really need to, and can't wait for a packaged update. Also, make sure to back up any files that may be changed.


I waited but in the next update from Promox there was no patch still. And i need live migration working again.

The guide you wrote is good but i have some questions.


1. Do i need to be in the directory of file i am patching?
2 . If so where is that file?

My steps

I created a file called cloudinit.patch in /

i pasted everything from

--- a/PVE/QemuServer/Cloudinit.pm
to the end at
my $size = PVE::Storage::file_size_info($iso_path);

Where is it you said i need to remove the "--" from ?
The beginning of the a/PVE/Qemu ?

I did "patch < /cloudinit.patch --dry-run"
and i get error

Code:
can't find file to patch at input line 3
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|--- a/PVE/QemuServer/Cloudinit.pm
|+++ b/PVE/QemuServer/Cloudinit.pm
--------------------------
File to patch:

All help is greatly appreciated!
 
  • Like
Reactions: shantanu
If you don't know how to apply a patch you shouldn't do it.
In this case however it seems that the mailing list archive doesn't contain the Patch files thus even with the needed skills you can't apply them. The git repos doesn't seem to have them either so I guess somebody of proxmox staff would need to supply the files.
Maybe a version of pve-network with applied Patch is available via the testing repository, can a staff member shed sone light on this?
 
If you don't know how to apply a patch you shouldn't do it.
In this case however it seems that the mailing list archive doesn't contain the Patch files thus even with the needed skills you can't apply them. The git repos doesn't seem to have them either so I guess somebody of proxmox staff would need to supply the files.
Maybe a version of pve-network with applied Patch is available via the testing repository, can a staff member shed sone light on this?
how can i find this patch applied on test repo or not? and can i upgrade a specific package from test repo?
because i need vmbr isolation on my server
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!