Remove is_backup flag for snapshots
This won't be needed for anything.
This commit is contained in:
parent
2b1082590e
commit
fbd5b3cca3
|
@ -1600,6 +1600,22 @@ class API_VM_Root(Resource):
|
||||||
items:
|
items:
|
||||||
type: object
|
type: object
|
||||||
id: VMTag
|
id: VMTag
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
description: The name of the tag
|
||||||
|
type:
|
||||||
|
type: string
|
||||||
|
description: The type of the tag (user, system)
|
||||||
|
protected:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the tag is protected or not
|
||||||
|
snapshots:
|
||||||
|
type: array
|
||||||
|
description: The snapshot(s) of the VM
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
id: VMSnapshot
|
||||||
properties:
|
properties:
|
||||||
name:
|
name:
|
||||||
type: string
|
type: string
|
||||||
|
@ -1607,9 +1623,9 @@ class API_VM_Root(Resource):
|
||||||
timestamp:
|
timestamp:
|
||||||
type: string
|
type: string
|
||||||
descrpition: Unix timestamp of the snapshot
|
descrpition: Unix timestamp of the snapshot
|
||||||
is_backup:
|
age:
|
||||||
type: boolean
|
type: string
|
||||||
description: Whether the snapshot is from a backup or not (manual)
|
description: Human-readable age of the snapshot in the largest viable unit: seconds, minutes, hours, days
|
||||||
rbd_snapshots:
|
rbd_snapshots:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
|
@ -1620,22 +1636,6 @@ class API_VM_Root(Resource):
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
description: A list of strings representing the lines of an (n=1) unified diff between the current VM XML specification and the snapshot VM XML specification
|
description: A list of strings representing the lines of an (n=1) unified diff between the current VM XML specification and the snapshot VM XML specification
|
||||||
snapshots:
|
|
||||||
type: array
|
|
||||||
description: The snapshot(s) of the VM
|
|
||||||
items:
|
|
||||||
type: object
|
|
||||||
id: VMSnapshot
|
|
||||||
properties:
|
|
||||||
name:
|
|
||||||
type: string
|
|
||||||
description: The name of the tag
|
|
||||||
type:
|
|
||||||
type: string
|
|
||||||
description: The type of the tag (user, system)
|
|
||||||
protected:
|
|
||||||
type: boolean
|
|
||||||
description: Whether the tag is protected or not
|
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
description: The description of the VM
|
description: The description of the VM
|
||||||
|
|
|
@ -448,14 +448,12 @@ def getDomainSnapshots(zkhandler, dom_uuid):
|
||||||
(
|
(
|
||||||
snap_name,
|
snap_name,
|
||||||
snap_timestamp,
|
snap_timestamp,
|
||||||
snap_is_backup,
|
|
||||||
_snap_rbd_snapshots,
|
_snap_rbd_snapshots,
|
||||||
snap_dom_xml,
|
snap_dom_xml,
|
||||||
) = zkhandler.read_many(
|
) = zkhandler.read_many(
|
||||||
[
|
[
|
||||||
("domain.snapshots", dom_uuid, "domain_snapshot.name", snapshot),
|
("domain.snapshots", dom_uuid, "domain_snapshot.name", snapshot),
|
||||||
("domain.snapshots", dom_uuid, "domain_snapshot.timestamp", snapshot),
|
("domain.snapshots", dom_uuid, "domain_snapshot.timestamp", snapshot),
|
||||||
("domain.snapshots", dom_uuid, "domain_snapshot.is_backup", snapshot),
|
|
||||||
(
|
(
|
||||||
"domain.snapshots",
|
"domain.snapshots",
|
||||||
dom_uuid,
|
dom_uuid,
|
||||||
|
@ -486,7 +484,6 @@ def getDomainSnapshots(zkhandler, dom_uuid):
|
||||||
"name": snap_name,
|
"name": snap_name,
|
||||||
"timestamp": snap_timestamp,
|
"timestamp": snap_timestamp,
|
||||||
"xml_diff_lines": snap_dom_xml_diff,
|
"xml_diff_lines": snap_dom_xml_diff,
|
||||||
"is_backup": snap_is_backup,
|
|
||||||
"rbd_snapshots": snap_rbd_snapshots,
|
"rbd_snapshots": snap_rbd_snapshots,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"version": "14", "root": "", "base": {"root": "", "schema": "/schema", "schema.version": "/schema/version", "config": "/config", "config.maintenance": "/config/maintenance", "config.primary_node": "/config/primary_node", "config.primary_node.sync_lock": "/config/primary_node/sync_lock", "config.upstream_ip": "/config/upstream_ip", "config.migration_target_selector": "/config/migration_target_selector", "logs": "/logs", "faults": "/faults", "node": "/nodes", "domain": "/domains", "network": "/networks", "storage": "/ceph", "storage.health": "/ceph/health", "storage.util": "/ceph/util", "osd": "/ceph/osds", "pool": "/ceph/pools", "volume": "/ceph/volumes", "snapshot": "/ceph/snapshots"}, "logs": {"node": "", "messages": "/messages"}, "faults": {"id": "", "last_time": "/last_time", "first_time": "/first_time", "ack_time": "/ack_time", "status": "/status", "delta": "/delta", "message": "/message"}, "node": {"name": "", "keepalive": "/keepalive", "mode": "/daemonmode", "data.active_schema": "/activeschema", "data.latest_schema": "/latestschema", "data.static": "/staticdata", "data.pvc_version": "/pvcversion", "running_domains": "/runningdomains", "count.provisioned_domains": "/domainscount", "count.networks": "/networkscount", "state.daemon": "/daemonstate", "state.router": "/routerstate", "state.domain": "/domainstate", "cpu.load": "/cpuload", "vcpu.allocated": "/vcpualloc", "memory.total": "/memtotal", "memory.used": "/memused", "memory.free": "/memfree", "memory.allocated": "/memalloc", "memory.provisioned": "/memprov", "ipmi.hostname": "/ipmihostname", "ipmi.username": "/ipmiusername", "ipmi.password": "/ipmipassword", "sriov": "/sriov", "sriov.pf": "/sriov/pf", "sriov.vf": "/sriov/vf", "monitoring.plugins": "/monitoring_plugins", "monitoring.data": "/monitoring_data", "monitoring.health": "/monitoring_health", "network.stats": "/network_stats"}, "monitoring_plugin": {"name": "", "last_run": "/last_run", "health_delta": "/health_delta", "message": "/message", "data": "/data", "runtime": "/runtime"}, "sriov_pf": {"phy": "", "mtu": "/mtu", "vfcount": "/vfcount"}, "sriov_vf": {"phy": "", "pf": "/pf", "mtu": "/mtu", "mac": "/mac", "phy_mac": "/phy_mac", "config": "/config", "config.vlan_id": "/config/vlan_id", "config.vlan_qos": "/config/vlan_qos", "config.tx_rate_min": "/config/tx_rate_min", "config.tx_rate_max": "/config/tx_rate_max", "config.spoof_check": "/config/spoof_check", "config.link_state": "/config/link_state", "config.trust": "/config/trust", "config.query_rss": "/config/query_rss", "pci": "/pci", "pci.domain": "/pci/domain", "pci.bus": "/pci/bus", "pci.slot": "/pci/slot", "pci.function": "/pci/function", "used": "/used", "used_by": "/used_by"}, "domain": {"name": "", "xml": "/xml", "state": "/state", "profile": "/profile", "stats": "/stats", "node": "/node", "last_node": "/lastnode", "failed_reason": "/failedreason", "storage.volumes": "/rbdlist", "console.log": "/consolelog", "console.vnc": "/vnc", "meta.autostart": "/node_autostart", "meta.migrate_method": "/migration_method", "meta.migrate_max_downtime": "/migration_max_downtime", "meta.node_selector": "/node_selector", "meta.node_limit": "/node_limit", "meta.tags": "/tags", "migrate.sync_lock": "/migrate_sync_lock", "snapshots": "/snapshots"}, "tag": {"name": "", "type": "/type", "protected": "/protected"}, "domain_snapshot": {"name": "", "timestamp": "/timestamp", "is_backup": "/is_backup", "xml": "/xml", "rbd_snapshots": "/rbdsnaplist"}, "network": {"vni": "", "type": "/nettype", "mtu": "/mtu", "rule": "/firewall_rules", "rule.in": "/firewall_rules/in", "rule.out": "/firewall_rules/out", "nameservers": "/name_servers", "domain": "/domain", "reservation": "/dhcp4_reservations", "lease": "/dhcp4_leases", "ip4.gateway": "/ip4_gateway", "ip4.network": "/ip4_network", "ip4.dhcp": "/dhcp4_flag", "ip4.dhcp_start": "/dhcp4_start", "ip4.dhcp_end": "/dhcp4_end", "ip6.gateway": "/ip6_gateway", "ip6.network": "/ip6_network", "ip6.dhcp": "/dhcp6_flag"}, "reservation": {"mac": "", "ip": "/ipaddr", "hostname": "/hostname"}, "lease": {"mac": "", "ip": "/ipaddr", "hostname": "/hostname", "expiry": "/expiry", "client_id": "/clientid"}, "rule": {"description": "", "rule": "/rule", "order": "/order"}, "osd": {"id": "", "node": "/node", "device": "/device", "db_device": "/db_device", "fsid": "/fsid", "ofsid": "/fsid/osd", "cfsid": "/fsid/cluster", "lvm": "/lvm", "vg": "/lvm/vg", "lv": "/lvm/lv", "is_split": "/is_split", "stats": "/stats"}, "pool": {"name": "", "pgs": "/pgs", "tier": "/tier", "stats": "/stats"}, "volume": {"name": "", "stats": "/stats"}, "snapshot": {"name": "", "stats": "/stats"}}
|
{"version": "14", "root": "", "base": {"root": "", "schema": "/schema", "schema.version": "/schema/version", "config": "/config", "config.maintenance": "/config/maintenance", "config.primary_node": "/config/primary_node", "config.primary_node.sync_lock": "/config/primary_node/sync_lock", "config.upstream_ip": "/config/upstream_ip", "config.migration_target_selector": "/config/migration_target_selector", "logs": "/logs", "faults": "/faults", "node": "/nodes", "domain": "/domains", "network": "/networks", "storage": "/ceph", "storage.health": "/ceph/health", "storage.util": "/ceph/util", "osd": "/ceph/osds", "pool": "/ceph/pools", "volume": "/ceph/volumes", "snapshot": "/ceph/snapshots"}, "logs": {"node": "", "messages": "/messages"}, "faults": {"id": "", "last_time": "/last_time", "first_time": "/first_time", "ack_time": "/ack_time", "status": "/status", "delta": "/delta", "message": "/message"}, "node": {"name": "", "keepalive": "/keepalive", "mode": "/daemonmode", "data.active_schema": "/activeschema", "data.latest_schema": "/latestschema", "data.static": "/staticdata", "data.pvc_version": "/pvcversion", "running_domains": "/runningdomains", "count.provisioned_domains": "/domainscount", "count.networks": "/networkscount", "state.daemon": "/daemonstate", "state.router": "/routerstate", "state.domain": "/domainstate", "cpu.load": "/cpuload", "vcpu.allocated": "/vcpualloc", "memory.total": "/memtotal", "memory.used": "/memused", "memory.free": "/memfree", "memory.allocated": "/memalloc", "memory.provisioned": "/memprov", "ipmi.hostname": "/ipmihostname", "ipmi.username": "/ipmiusername", "ipmi.password": "/ipmipassword", "sriov": "/sriov", "sriov.pf": "/sriov/pf", "sriov.vf": "/sriov/vf", "monitoring.plugins": "/monitoring_plugins", "monitoring.data": "/monitoring_data", "monitoring.health": "/monitoring_health", "network.stats": "/network_stats"}, "monitoring_plugin": {"name": "", "last_run": "/last_run", "health_delta": "/health_delta", "message": "/message", "data": "/data", "runtime": "/runtime"}, "sriov_pf": {"phy": "", "mtu": "/mtu", "vfcount": "/vfcount"}, "sriov_vf": {"phy": "", "pf": "/pf", "mtu": "/mtu", "mac": "/mac", "phy_mac": "/phy_mac", "config": "/config", "config.vlan_id": "/config/vlan_id", "config.vlan_qos": "/config/vlan_qos", "config.tx_rate_min": "/config/tx_rate_min", "config.tx_rate_max": "/config/tx_rate_max", "config.spoof_check": "/config/spoof_check", "config.link_state": "/config/link_state", "config.trust": "/config/trust", "config.query_rss": "/config/query_rss", "pci": "/pci", "pci.domain": "/pci/domain", "pci.bus": "/pci/bus", "pci.slot": "/pci/slot", "pci.function": "/pci/function", "used": "/used", "used_by": "/used_by"}, "domain": {"name": "", "xml": "/xml", "state": "/state", "profile": "/profile", "stats": "/stats", "node": "/node", "last_node": "/lastnode", "failed_reason": "/failedreason", "storage.volumes": "/rbdlist", "console.log": "/consolelog", "console.vnc": "/vnc", "meta.autostart": "/node_autostart", "meta.migrate_method": "/migration_method", "meta.migrate_max_downtime": "/migration_max_downtime", "meta.node_selector": "/node_selector", "meta.node_limit": "/node_limit", "meta.tags": "/tags", "migrate.sync_lock": "/migrate_sync_lock", "snapshots": "/snapshots"}, "tag": {"name": "", "type": "/type", "protected": "/protected"}, "domain_snapshot": {"name": "", "timestamp": "/timestamp", "xml": "/xml", "rbd_snapshots": "/rbdsnaplist"}, "network": {"vni": "", "type": "/nettype", "mtu": "/mtu", "rule": "/firewall_rules", "rule.in": "/firewall_rules/in", "rule.out": "/firewall_rules/out", "nameservers": "/name_servers", "domain": "/domain", "reservation": "/dhcp4_reservations", "lease": "/dhcp4_leases", "ip4.gateway": "/ip4_gateway", "ip4.network": "/ip4_network", "ip4.dhcp": "/dhcp4_flag", "ip4.dhcp_start": "/dhcp4_start", "ip4.dhcp_end": "/dhcp4_end", "ip6.gateway": "/ip6_gateway", "ip6.network": "/ip6_network", "ip6.dhcp": "/dhcp6_flag"}, "reservation": {"mac": "", "ip": "/ipaddr", "hostname": "/hostname"}, "lease": {"mac": "", "ip": "/ipaddr", "hostname": "/hostname", "expiry": "/expiry", "client_id": "/clientid"}, "rule": {"description": "", "rule": "/rule", "order": "/order"}, "osd": {"id": "", "node": "/node", "device": "/device", "db_device": "/db_device", "fsid": "/fsid", "ofsid": "/fsid/osd", "cfsid": "/fsid/cluster", "lvm": "/lvm", "vg": "/lvm/vg", "lv": "/lvm/lv", "is_split": "/is_split", "stats": "/stats"}, "pool": {"name": "", "pgs": "/pgs", "tier": "/tier", "stats": "/stats"}, "volume": {"name": "", "stats": "/stats"}, "snapshot": {"name": "", "stats": "/stats"}}
|
|
@ -1249,7 +1249,7 @@ def get_list(
|
||||||
#
|
#
|
||||||
# VM Snapshot Tasks
|
# VM Snapshot Tasks
|
||||||
#
|
#
|
||||||
def create_vm_snapshot(zkhandler, domain, snapshot_name=None, is_backup=False):
|
def create_vm_snapshot(zkhandler, domain, snapshot_name=None):
|
||||||
# Validate that VM exists in cluster
|
# Validate that VM exists in cluster
|
||||||
dom_uuid = getDomainUUID(zkhandler, domain)
|
dom_uuid = getDomainUUID(zkhandler, domain)
|
||||||
if not dom_uuid:
|
if not dom_uuid:
|
||||||
|
@ -1317,15 +1317,6 @@ def create_vm_snapshot(zkhandler, domain, snapshot_name=None, is_backup=False):
|
||||||
),
|
),
|
||||||
tstart,
|
tstart,
|
||||||
),
|
),
|
||||||
(
|
|
||||||
(
|
|
||||||
"domain.snapshots",
|
|
||||||
dom_uuid,
|
|
||||||
"domain_snapshot.is_backup",
|
|
||||||
snapshot_name,
|
|
||||||
),
|
|
||||||
is_backup,
|
|
||||||
),
|
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
"domain.snapshots",
|
"domain.snapshots",
|
||||||
|
@ -1355,7 +1346,7 @@ def create_vm_snapshot(zkhandler, domain, snapshot_name=None, is_backup=False):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def remove_vm_snapshot(zkhandler, domain, snapshot_name, remove_backup=False):
|
def remove_vm_snapshot(zkhandler, domain, snapshot_name):
|
||||||
# Validate that VM exists in cluster
|
# Validate that VM exists in cluster
|
||||||
dom_uuid = getDomainUUID(zkhandler, domain)
|
dom_uuid = getDomainUUID(zkhandler, domain)
|
||||||
if not dom_uuid:
|
if not dom_uuid:
|
||||||
|
@ -1369,30 +1360,6 @@ def remove_vm_snapshot(zkhandler, domain, snapshot_name, remove_backup=False):
|
||||||
f'ERROR: Could not find snapshot "{snapshot_name}" of VM "{domain}"!',
|
f'ERROR: Could not find snapshot "{snapshot_name}" of VM "{domain}"!',
|
||||||
)
|
)
|
||||||
|
|
||||||
print(
|
|
||||||
zkhandler.read(
|
|
||||||
("domain.snapshots", dom_uuid, "domain_snapshot.is_backup", snapshot_name)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if (
|
|
||||||
strtobool(
|
|
||||||
zkhandler.read(
|
|
||||||
(
|
|
||||||
"domain.snapshots",
|
|
||||||
dom_uuid,
|
|
||||||
"domain_snapshot.is_backup",
|
|
||||||
snapshot_name,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
and not remove_backup
|
|
||||||
):
|
|
||||||
# Disallow removing backups normally, but expose `remove_backup` flag for internal usage by refactored backup handlers
|
|
||||||
return (
|
|
||||||
False,
|
|
||||||
f'ERROR: Snapshot "{snapshot_name}" of VM "{domain}" is a backup; please remove with "pvc backup"!',
|
|
||||||
)
|
|
||||||
|
|
||||||
tstart = time.time()
|
tstart = time.time()
|
||||||
|
|
||||||
_snapshots = zkhandler.read(
|
_snapshots = zkhandler.read(
|
||||||
|
|
|
@ -725,7 +725,6 @@ class ZKSchema(object):
|
||||||
"domain_snapshot": {
|
"domain_snapshot": {
|
||||||
"name": "", # The root key
|
"name": "", # The root key
|
||||||
"timestamp": "/timestamp",
|
"timestamp": "/timestamp",
|
||||||
"is_backup": "/is_backup",
|
|
||||||
"xml": "/xml",
|
"xml": "/xml",
|
||||||
"rbd_snapshots": "/rbdsnaplist",
|
"rbd_snapshots": "/rbdsnaplist",
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue