Closed francio87 closed 2 years ago
Executing a snapshot usingvmid=all, but there are no VM on the host the system, an exception is raised.
vmid=all
Do not raise exception, maybe inform the user that there are no VM to take snapshot (?)
root@test:~# /usr/local/bin/cv4pve-autosnap --host=localhost --username="utente@pve" --password="OCnsmtodLXHHVgQ" --vmid="all" snap --label="daily" --keep=4 ACTION Snap VMs: all Label: daily Keep: 4 State: False Timeout: 30000 Timestamp format: yyMMddHHmmss Max % Storage : 95% ================ EXCEPTION ================ System.IndexOutOfRangeException Index was outside the bounds of the array. at BetterConsoleTables.Table.ToString(Int32[] columnLengths) at BetterConsoleTables.Table.ToString() at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout, String timestampFormat, Int32 optMaxPercentageStorage) at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args) With Debug flag: root@test:~# /usr/local/bin/cv4pve-autosnap --host=localhost --username="utente@pve" --password="OCnsmtodLXHHVgQ" --vmid="all" snap --label="daily" --keep=4 --debug Method: POST, Url: https://localhost:8006/api2/json/access/ticket Parameters: password : OCnsmtodLXHHVgQ username : utente realm : pve StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True { "data": { "username": "utente@pve", "CSRFPreventionToken": "61C6D2E2:5ayUbgll/59tw5w2zK38g9AuFk+ogtDPweLw0ydfjt0", "cap": { "nodes": { "Permissions.Modify": 1, "Sys.Modify": 1, "Sys.Audit": 1, "Sys.Syslog": 1, "Sys.PowerMgmt": 1, "Sys.Console": 1 }, "access": { "Group.Allocate": 1, "Permissions.Modify": 1, "User.Modify": 1 }, "storage": { "Datastore.AllocateTemplate": 1, "Datastore.AllocateSpace": 1, "Datastore.Allocate": 1, "Datastore.Audit": 1, "Permissions.Modify": 1 }, "vms": { "VM.PowerMgmt": 1, "VM.Allocate": 1, "VM.Config.Options": 1, "VM.Config.Network": 1, "VM.Migrate": 1, "VM.Config.Memory": 1, "VM.Monitor": 1, "VM.Config.HWType": 1, "VM.Audit": 1, "VM.Config.CDROM": 1, "VM.Config.Disk": 1, "Permissions.Modify": 1, "VM.Snapshot.Rollback": 1, "VM.Snapshot": 1, "VM.Config.Cloudinit": 1, "VM.Console": 1, "VM.Config.CPU": 1, "VM.Backup": 1, "VM.Clone": 1 }, "sdn": { "SDN.Allocate": 1, "Permissions.Modify": 1, "SDN.Audit": 1 }, "dc": { "SDN.Allocate": 1, "Sys.Audit": 1, "SDN.Audit": 1 } }, "ticket": "PVE:utente@pve:61C6D2E2::Bf4ME1iDsCj7YRvjY/PfzJRCDP9N95qLhxrVmqwk72Ym2Xtoe6lMPHfM7MJHSlXnx0ZDpxTF3NuwP7qa1/WpPmeejfrnfiZkNo0eGSiDfo3hkWF8WKyxJWySMxwICPWA3uy3LZwELaRSSknYiJmo0lgVU/HBr1xvIbDpTwM5qS8WO+7sxVQlZEytYSBTxma7h1UcyImFn+TA7VPWYLUAfipemnj/hqzBESGvR2k5Ktjf+Vdm68PwD61M9wmk/cplfi9xFDBHoRzUV8jM9l+TrQElSgPVy2+TGh+tJLQvxP/S/evi634WoKeJof0Iqdpe3pDdQVwrY+wdWvcrNdvb6A==" } } ============================= ACTION Snap VMs: all Label: daily Keep: 4 State: False Timeout: 30000 Timestamp format: yyMMddHHmmss Max % Storage : 95% Method: GET, Url: https://localhost:8006/api2/json/cluster/resources?type=vm StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True { "data": [] } ============================= Method: GET, Url: https://localhost:8006/api2/json/cluster/resources?type=storage StatusCode: OK ReasonPhrase: OK IsSuccessStatusCode: True { "data": [ { "maxdisk": 8087252992, "node": "test", "disk": 4410134528, "id": "storage/test/local", "shared": 0, "content": "iso,backup,vztmpl", "storage": "local", "status": "available", "plugintype": "dir", "type": "storage" }, { "node": "test", "maxdisk": 15028191232, "shared": 0, "disk": 0, "id": "storage/test/local-lvm", "plugintype": "lvmthin", "type": "storage", "status": "available", "storage": "local-lvm", "content": "rootdir,images" } ] } ============================= ================ EXCEPTION ================ System.IndexOutOfRangeException Index was outside the bounds of the array. at BetterConsoleTables.Table.ToString(Int32[] columnLengths) at BetterConsoleTables.Table.ToString() at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout, String timestampFormat, Int32 optMaxPercentageStorage) at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args) ================ EXCEPTION ================ System.IndexOutOfRangeException Index was outside the bounds of the array. at BetterConsoleTables.Table.ToString(Int32[] columnLengths) at BetterConsoleTables.Table.ToString() at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.Api.Extension.Helpers.TableHelper.Create(IEnumerable`1 columns, IEnumerable`1 rows, TableOutputType outputType, Boolean hasInnerRows) at Corsinvest.ProxmoxVE.AutoSnap.Api.Application.Snap(String vmIdsOrNames, String label, Int32 keep, Boolean state, Int64 timeout, String timestampFormat, Int32 optMaxPercentageStorage) at Corsinvest.ProxmoxVE.AutoSnap.ShellCommands.<>c__DisplayClass9_1.<Snap>b__1() at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass144_0.<OnExecute>b__0(CancellationToken _) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken) at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) at Corsinvest.ProxmoxVE.Api.Shell.Helpers.ShellHelper.ExecuteConsoleApp(CommandLineApplication app, String[] args)
7.1-8
1.13.2
1.11.0
Other
I fix in new version
What happened?
Executing a snapshot using
vmid=all
, but there are no VM on the host the system, an exception is raised.Expected behavior
Do not raise exception, maybe inform the user that there are no VM to take snapshot (?)
Relevant log output
Proxmox VE Version
7.1-8
Version (bug)
1.13.2
Version (working)
1.11.0
On what operating system are you experiencing the issue?
Other
Pull Request