Modify "Virtual Machine Template" from CLI

Hi,

after some updates (OpenNebula version and datasotre configuration), some VMs that were “undeployed” don’t start now because I have changed datastore TM_MAD from “qcow2” to “ssh”. In VMs that don’t restart now, I get this error:

and, in CLI, if I run “onevm show 9459” (for example), I can see these information:

[oneadmin@myserver ~]$ onevm show 9459
VIRTUAL MACHINE 9459 INFORMATION
ID                  : 9459
NAME                : rooter
USER                : sdci-5-4
GROUP               : SDCI
STATE               : PENDING
LCM_STATE           : LCM_INIT
LOCK                : None
RESCHED             : No
START TIME          : 07/11 12:42:28
END TIME            : -
DEPLOY ID           : 3b316a13-4047-4fc0-9cb6-0b9338390c85

VIRTUAL MACHINE MONITORING
CPU                 : 0.0
MEMORY              : 1011.6M
NETTX               : 33K
NETRX               : 1K
DISKRDBYTES         : 411789070
DISKRDIOPS          : 11661
DISKWRBYTES         : 24092672
DISKWRIOPS          : 1716
ID                  : 9459
TIMESTAMP           : 1658144850

PERMISSIONS
OWNER               : um-
GROUP               : ---
OTHER               : ---

VM DISKS
 ID DATASTORE  TARGET IMAGE                               SIZE      TYPE SAVE
  0 default    vda    Deb11ON                             84M/14G   file   NO
  1 -          hda    CONTEXT                             1M/-      -       -

VM NICS
 ID NETWORK              BRIDGE       IP              MAC               PCI_ID
  0 Internet             br1          10.10.10.40     02:00:0a:0a:0a:28
  1 Middle               br2          20.20.20.22     02:00:14:14:14:16

SECURITY

NIC_ID NETWORK                   SECURITY_GROUPS
     0 Internet                  0
     1 Middle                    0

SECURITY GROUP   TYPE     PROTOCOL NETWORK                       RANGE
  ID NAME                          VNET START             SIZE
   0 default     OUTBOUND ALL
   0 default     INBOUND  ALL

VIRTUAL MACHINE HISTORY
SEQ UID  REQ   HOST         ACTION       DS           START        TIME     PROLOG
  0 0    4752  localhost    undeploy-h    0  07/11 12:42:36   0d 14h17m   0h00m02s
  1 0    7744  localhost    undeploy-h    0  07/18 13:26:17   0d 00h07m   0h00m03s

USER TEMPLATE
HOT_RESIZE=[
  CPU_HOT_ADD_ENABLED="NO",
  MEMORY_HOT_ADD_ENABLED="NO" ]
HYPERVISOR="kvm"
INPUTS_ORDER=""
LOGO="images/logos/debian.png"
MEMORY_UNIT_COST="GB"
SCHED_DS_REQUIREMENTS="ID=\"0\""
SCHED_MESSAGE="Mon Jul 18 13:47:25 2022: Cannot dispatch VM: No system datastore meets capacity and SCHED_DS_REQUIREMENTS: (\"CLUSTERS/ID\" @> 0) & (TM_MAD = \"qcow2\") & ( ID=\"0\" )"
SCHED_REQUIREMENTS="ID=\"14\""
USER_INPUTS=[
  CPU="O|fixed|| |0.5",
  MEMORY="M|range||1024..3072|1024" ]

VIRTUAL MACHINE TEMPLATE
AUTOMATIC_DS_REQUIREMENTS="(\"CLUSTERS/ID\" @> 0) & (TM_MAD = \"qcow2\")"
AUTOMATIC_NIC_REQUIREMENTS="(\"CLUSTERS/ID\" @> 0)"
AUTOMATIC_REQUIREMENTS="(CLUSTER_ID = 0) & !(PUBLIC_CLOUD = YES) & !(PIN_POLICY = PINNED)"
CONTEXT=[
  DISK_ID="1",
  ETH0_CONTEXT_FORCE_IPV4="",
  ETH0_DNS="8.8.8.8",
  ETH0_EXTERNAL="",
  ETH0_GATEWAY="10.10.10.1",
  ETH0_GATEWAY6="",
  ETH0_IP="10.10.10.40",
  ETH0_IP6="",
  ETH0_IP6_GATEWAY="",
  ETH0_IP6_METHOD="",
  ETH0_IP6_METRIC="",
  ETH0_IP6_PREFIX_LENGTH="",
  ETH0_IP6_ULA="",
  ETH0_MAC="02:00:0a:0a:0a:28",
  ETH0_MASK="255.255.254.0",
  ETH0_METHOD="",
  ETH0_METRIC="",
  ETH0_METRIC6="",
  ETH0_MTU="",
  ETH0_NETWORK="10.10.10.0",
  ETH0_SEARCH_DOMAIN="",
  ETH0_VLAN_ID="",
  ETH0_VROUTER_IP="",
  ETH0_VROUTER_IP6="",
  ETH0_VROUTER_MANAGEMENT="",
  ETH1_CONTEXT_FORCE_IPV4="",
  ETH1_DNS="",
  ETH1_EXTERNAL="",
  ETH1_GATEWAY="",
  ETH1_GATEWAY6="",
  ETH1_IP="20.20.20.22",
  ETH1_IP6="",
  ETH1_IP6_GATEWAY="",
  ETH1_IP6_METHOD="",
  ETH1_IP6_METRIC="",
  ETH1_IP6_PREFIX_LENGTH="",
  ETH1_IP6_ULA="",
  ETH1_MAC="02:00:14:14:14:16",
  ETH1_MASK="255.255.254.0",
  ETH1_METHOD="",
  ETH1_METRIC="",
  ETH1_METRIC6="",
  ETH1_MTU="",
  ETH1_NETWORK="20.20.20.0",
  ETH1_SEARCH_DOMAIN="",
  ETH1_VLAN_ID="",
  ETH1_VROUTER_IP="",
  ETH1_VROUTER_IP6="",
  ETH1_VROUTER_MANAGEMENT="",
  NETWORK="YES",
  PASSWORD="5yoDK8jK3gKWuCS0RFtsNQ==",
  SSH_PUBLIC_KEY="",
  START_SCRIPT_BASE64="L2Jpbi9lY2hvICJhZG1pbnA6TmVidWxhQ2FvcyIgfCBjaHBhc3N3ZA==",
  TARGET="hda" ]
CPU="0.5"
CPU_COST="0.01"
CPU_MODEL=[
  MODEL="host-passthrough" ]
DISK_COST="7.5e-07"
FEATURES=[
  ACPI="yes" ]
GRAPHICS=[
  LISTEN="0.0.0.0",
  TYPE="VNC" ]
MEMORY="2048"
MEMORY_COST="1.46484e-05"
OS=[
  BOOT="disk0",
  UUID="3b316a13-4047-4fc0-9cb6-0b9338390c85" ]
TEMPLATE_ID="237"
TM_MAD_SYSTEM="qcow2"
VCPU="2"
VMID="9459"

So my question is if I could modify values in “VIRTUAL MACHINE TEMPLATE” section and remove “AUTOMATIC_DS_REQUIREMENTS” parameter and “TM_MAD_SYSTE;” (inside CONTEXT) to allow the VM restart.

Thanks a lot!!

You could try

onedb update-body vm --id 9459

BR,
Anton